Remove IDO

This commit is contained in:
CrashOveride95 committed 2021-02-01 18:23:36 -05:00
1 parent 906f34af45
commit 17b936a3ad
38 files changed
+6 -8485

No files matched your search

+3 -128
View File
@@ -36,11 +36,9 @@ else ifeq ($(CONSOLE),bb)
endif
# COMPILER - selects the C compiler to use
# ido - uses the SGI IRIS Development Option compiler, which is used to build
# an original matching N64 ROM
# gcc - uses the GNU C Compiler
COMPILER ?= gcc
$(eval $(call validate-option,COMPILER,ido gcc))
$(eval $(call validate-option,COMPILER,gcc))
# SAVETYPE - selects the save type
@@ -131,24 +129,7 @@ else ifeq ($(GRUCODE),super3d) # Super3D
DEFINES += SUPER3D_GBI=1 F3D_NEW=1
endif
# USE_QEMU_IRIX - when ido is selected, select which way to emulate IRIX programs
# 1 - use qemu-irix
# 0 - statically recompile the IRIX programs
USE_QEMU_IRIX ?= 0
$(eval $(call validate-option,USE_QEMU_IRIX,0 1))
ifeq ($(COMPILER),ido)
ifeq ($(USE_QEMU_IRIX),1)
# Verify that qemu-irix exists
QEMU_IRIX ?= $(call find-command,qemu-irix)
ifeq (, $(QEMU_IRIX))
$(error Using the IDO compiler requires qemu-irix. Please install qemu-irix package or set the QEMU_IRIX environment variable to the full qemu-irix binary path)
endif
endif
MIPSISET := -mips2
else ifeq ($(COMPILER),gcc)
ifeq ($(COMPILER),gcc)
NON_MATCHING := 1
MIPSISET := -mips3
OPT_FLAGS := -O2
@@ -261,7 +242,7 @@ ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),)
# Make tools if out of date
$(info Building tools...)
DUMMY != $(MAKE) -s -C $(TOOLS_DIR) $(if $(filter-out ido0,$(COMPILER)$(USE_QEMU_IRIX)),all-except-recomp,) >&2 || echo FAIL
DUMMY != $(MAKE) -s -C $(TOOLS_DIR) >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to build tools)
endif
@@ -327,18 +308,6 @@ LIBZ_O_FILES := $(foreach file,$(LIBZ_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
# Automatic dependency files
DEP_FILES := $(O_FILES:.o=.d) $(LIBZ_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d
# Files with GLOBAL_ASM blocks
ifeq ($(NON_MATCHING),0)
ifeq ($(VERSION),sh)
GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/**/*.c) $(wildcard lib/src/*.c)
else
GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/**/*.c)
endif
GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
GLOBAL_ASM_DEP = $(BUILD_DIR)/src/audio/non_matching_dep
endif
#==============================================================================#
# Compiler Options #
#==============================================================================#
@@ -361,18 +330,6 @@ export LD_LIBRARY_PATH=./tools
AS := $(CROSS)as
ifeq ($(COMPILER),gcc)
CC := $(CROSS)gcc
else
ifeq ($(USE_QEMU_IRIX),1)
IRIX_ROOT := $(TOOLS_DIR)/ido5.3_compiler
CC := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
ACPP := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/acpp
COPT := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt
else
IDO_ROOT := $(TOOLS_DIR)/ido5.3_recomp
CC := $(IDO_ROOT)/cc
ACPP := $(IDO_ROOT)/acpp
COPT := $(IDO_ROOT)/copt
endif
endif
# Prefer gcc's cpp if installed on the system
ifneq (,$(call find-command,cpp-10))
@@ -402,10 +359,6 @@ endif
C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
# Check code syntax with host compiler
CC_CHECK := gcc
CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(CC_CFLAGS) $(TARGET_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB $(DEF_INC_CFLAGS)
# C compiler options
CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
ifeq ($(COMPILER),gcc)
@@ -420,17 +373,6 @@ RSPASMFLAGS := $(foreach d,$(DEFINES),-definelabel $(subst =, ,$(d)))
# C preprocessor flags
CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
ifeq ($(shell getconf LONG_BIT), 32)
# Work around memory allocation bug in QEMU
export QEMU_GUEST_BASE := 1
else
# Ensure that gcc treats the code as 32-bit
CC_CHECK_CFLAGS += -m32
endif
# Prevent a crash with -sopt
export LANG := C
#==============================================================================#
# Miscellaneous Tools #
#==============================================================================#
@@ -439,7 +381,6 @@ export LANG := C
YAY0TOOL := $(TOOLS_DIR)/slienc
RNCPACK := $(TOOLS_DIR)/rncpack
ROMALIGN := $(TOOLS_DIR)/romalign
BFSIZE := $(TOOLS_DIR)/bfsize
FILESIZER := $(TOOLS_DIR)/filesizer
N64CKSUM := $(TOOLS_DIR)/n64cksum
N64GRAPHICS := $(TOOLS_DIR)/n64graphics
@@ -714,17 +655,6 @@ $(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in
$(call print,Preprocessing level headers:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I . levels/level_headers.h.in | $(PYTHON) $(TOOLS_DIR)/output_level_headers.py > $(BUILD_DIR)/include/level_headers.h
# Run asm_processor on files that have NON_MATCHING code
ifeq ($(NON_MATCHING),0)
$(GLOBAL_ASM_O_FILES): CC := $(V)$(PYTHON) $(TOOLS_DIR)/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
endif
# Rebuild files with 'GLOBAL_ASM' if the NON_MATCHING flag changes.
$(GLOBAL_ASM_O_FILES): $(GLOBAL_ASM_DEP).$(NON_MATCHING)
$(GLOBAL_ASM_DEP).$(NON_MATCHING):
@$(RM) $(GLOBAL_ASM_DEP).*
$(V)touch $@
# Generate version_data.h
$(BUILD_DIR)/src/game/version_data.h: tools/make_version.sh
@$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n"
@@ -737,70 +667,15 @@ $(BUILD_DIR)/src/game/version_data.h: tools/make_version.sh
# Compile C code
$(BUILD_DIR)/%.o: %.c
$(call print,Compiling:,$<,$@)
ifeq ($(COMPILER),ido)
@$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(V)$(CC) -c $(CFLAGS) -o $@ $<
else
$(V)$(CC) -c $(CFLAGS) -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
endif
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c
$(call print,Compiling:,$<,$@)
ifeq ($(COMPILER),ido)
@$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(V)$(CC) -c $(CFLAGS) -o $@ $<
else
$(V)$(CC) -c $(CFLAGS) -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
endif
# Alternate compiler flags needed for matching
ifeq ($(COMPILER),ido)
$(BUILD_DIR)/levels/%/leveldata.o: OPT_FLAGS := -g
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -g
$(BUILD_DIR)/bin/%.o: OPT_FLAGS := -g
ifeq ($(VERSION),eu)
$(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3
$(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3
$(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3
$(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3
# Enable loop unrolling except for external.c (external.c might also have used
# unrolling, but it makes one loop harder to match).
# For all audio files other than external.c and port_eu.c, put string literals
# in .data. (In Shindou, the port_eu.c string literals also moved to .data.)
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -use_readwrite_const
$(BUILD_DIR)/src/audio/port_eu.o: OPT_FLAGS := -O2
$(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
endif
ifeq ($(VERSION_JP_US),true)
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -framepointer -Wo,-loopunroll,0
endif
ifeq ($(VERSION_JP_US),true)
# The source-to-source optimizer copt is enabled for audio. This makes it use
# acpp, which needs -Wp,-+ to handle C++-style comments.
# All other files than external.c should really use copt, but only a few have
# been matched so far.
$(BUILD_DIR)/src/audio/effects.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -sopt,-inline=sequence_channel_process_sound,-scalaroptimize=1 -Wp,-+
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -O2 -sopt,-scalaroptimize=1 -Wp,-+
endif
# Add a target for build/eu/src/audio/*.copt to make it easier to see debug
$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
$(ACPP) $(TARGET_CFLAGS) $(DEF_INC_CFLAGS) -D__sgi -+ $< > $@
$(BUILD_DIR)/src/audio/%.copt: $(BUILD_DIR)/src/audio/%.acpp
$(COPT) -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1 $(COPTFLAGS)
$(BUILD_DIR)/src/audio/seqplayer.copt: COPTFLAGS := -inline_manual
endif
# Assemble assembly code
$(BUILD_DIR)/%.o: %.s
$(call print,Assembling:,$<,$@)
ifeq ($(COMPILER),ido)
$(V)$(CPP) $(CPPFLAGS) $< | $(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@
else
$(V)$(CC) -c $(CFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
endif
$(BUILD_DIR)/sound/sequences/00_sound_player.o: sound/sequences/00_sound_player.s
$(call print,Assembling:,$<,$@)
-1
View File
@@ -1,7 +1,6 @@
/aifc_decode
/aiff_extract_codebook
/armips
/bfsize
/extract_data_for_mio
/filesizer
/mio0
+3 -9
View File
@@ -7,7 +7,7 @@ CC := gcc
CXX := g++
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -O2 -s
LDFLAGS := -lm
ALL_PROGRAMS := armips bfsize filesizer rncpack n64graphics n64graphics_ci mio0 slienc n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
ALL_PROGRAMS := armips filesizer rncpack n64graphics n64graphics_ci mio0 slienc n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
LIBAUDIOFILE := audiofile/libaudiofile.a
# Only build armips from tools if it is not found on the system
@@ -19,8 +19,6 @@ endif
default: all
bfsize_SOURCES := bfsize.c
filesizer_SOURCES := filesizer.c
rncpack_SOURCES := rncpack.c
@@ -69,24 +67,20 @@ endif
all-except-recomp: $(LIBAUDIOFILE) $(BUILD_PROGRAMS)
all: all-except-recomp ido5.3_recomp
all: all-except-recomp
clean:
$(RM) $(ALL_PROGRAMS)
$(MAKE) -C audiofile clean
$(MAKE) -C ido5.3_recomp clean
define COMPILE
$(1): $($1_SOURCES)
$$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@ $($1_LDFLAGS) $(LDFLAGS)
endef
ido5.3_recomp:
$(MAKE) -C ido5.3_recomp
$(foreach p,$(BUILD_PROGRAMS),$(eval $(call COMPILE,$(p))))
$(LIBAUDIOFILE):
@$(MAKE) -C audiofile
.PHONY: all all-except-recomp clean default ido5.3_recomp
.PHONY: all all-except-recomp clean default
File diff suppressed because it is too large. Load diff
-36
View File
@@ -1,36 +0,0 @@
#!/usr/bin/env python3
import sys
import os
import shlex
import subprocess
import tempfile
dir_path = os.path.dirname(os.path.realpath(__file__))
asm_processor = ['python3', os.path.join(dir_path, "asm-processor.py")]
prelude = os.path.join(dir_path, "prelude.inc")
all_args = sys.argv[1:]
sep1 = all_args.index('--')
sep2 = all_args.index('--', sep1+1)
compiler = all_args[:sep1]
assembler = all_args[sep1+1:sep2]
assembler_sh = ' '.join(shlex.quote(x) for x in assembler)
compile_args = all_args[sep2+1:]
in_file = compile_args[-1]
out_ind = compile_args.index('-o')
out_file = compile_args[out_ind + 1]
del compile_args[-1]
del compile_args[out_ind + 1]
del compile_args[out_ind]
in_dir = os.path.split(os.path.realpath(in_file))[0]
opt_flags = [x for x in compile_args if x in ['-g', '-O2', '-O1', '-framepointer']]
preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c')
subprocess.check_call(asm_processor + opt_flags + [in_file], stdout=preprocessed_file)
subprocess.check_call(compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name])
subprocess.check_call(asm_processor + opt_flags + [in_file, '--post-process', out_file, '--assembler', assembler_sh, '--asm-prelude', prelude])
-5
View File
@@ -1,5 +0,0 @@
.set noat
.set noreorder
.set gp=64
.include "macros.inc"
-44
View File
@@ -1,44 +0,0 @@
/*
* Copyright (C) 2011 <fwhacking|gmail:com>
*
* This is free software, licensed under the GNU General Public License v2.
* See /LICENSE for more information.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
static void print_usage(const char *name)
{
printf("Usage: %s file\n", name);
}
int main(int argc, char **argv)
{
FILE *fd;
long size;
if (argc != 2)
{
print_usage(argv[0]);
exit(1);
}
fd = fopen(argv[1], "rb");
if (fd == NULL)
{
printf("Could not read the file '%s'\n", argv[1]);
print_usage(argv[0]);
exit(1);
}
size = fseek(fd, 0L, SEEK_END);
size = ftell(fd);
fclose(fd);
printf("%ld\n", size);
exit(0);
}
-18
View File
@@ -1,18 +0,0 @@
# Silicon Graphics Freeware Legal Notice
## Copyright 1995, Silicon Graphics, Inc. -- ALL RIGHTS RESERVED
You may copy, modify, use and distribute this software, (i) provided that you include the entirety of this reservation of rights notice in all such copies, and (ii) you comply with any additional or different obligations and/or use restrictions specified by any third party owner or supplier of the software in other notices that may be included with the software.
**SGI DISCLAIMS ALL WARRANTIES WITH RESPECT TO THIS SOFTWARE, EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. SGI SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST REVENUES, LOST PROFITS, OR LOSS OF PROSPECTIVE ECONOMIC ADVANTAGE, RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.**
**U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:**
Use, duplication or disclosure by the Government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement. Unpublished - rights reserved under the Copyright Laws of United States. Contractor/manufacturer is Silicon Graphics, Inc., 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
## Product Support
Freeware products are not supported by Silicon Graphics or any of its support providers. The software contained in this package is made available through the generous efforts of their authors. Although they are interested in your feedback, they are under no obligation to address bugs, enhancements, or answer questions.
----
**NOTE:** This license was copied verbatim from https://web.archive.org/web/19991008090202/http://toolbox.sgi.com/TasteOfDT/public/freeware1.0/legal_notice.html .
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-16
View File
@@ -1,16 +0,0 @@
/recomp
/recomp-conservative
/cc*
/cfe*
/uopt*
/ugen*
/as1*
/acpp*
/copt*
/ujoin*
/uld*
/umerge*
/usplit*
/err.english.cc
-37
View File
@@ -1,37 +0,0 @@
IRIX_ROOT := ../ido5.3_compiler
cc: OPT_CFLAGS := -O2
cfe: OPT_CFLAGS := -O2
uopt: OPT_CFLAGS := -O2
ugen: OPT_CFLAGS := -O2
as1: OPT_CFLAGS := -O2
acpp: OPT_CFLAGS := -O2
RECOMP := recomp
ugen_c.c: RECOMP_FLAGS := --conservative
all: cc cfe uopt ugen as1 acpp copt ujoin uld umerge usplit err.english.cc
clean:
$(RM) cc* cfe* uopt* ugen* as1* acpp* copt* ujoin* uld* umerge* usplit* err.english.cc $(RECOMP) libc_impl.o
$(RECOMP): recomp.cpp
$(CXX) $^ -o $@ -std=c++11 -O2 -Wno-switch `pkg-config --cflags --libs capstone`
libc_impl.o: libc_impl.c libc_impl.h
$(CC) $< -c -fno-strict-aliasing -O2 -DIDO53
err.english.cc: $(IRIX_ROOT)/usr/lib/err.english.cc
cp $^ $@
cc_c.c: $(IRIX_ROOT)/usr/bin/cc $(RECOMP)
./$(RECOMP) $(RECOMP_FLAGS) $< > $@
%_c.c: $(IRIX_ROOT)/usr/lib/% $(RECOMP)
./$(RECOMP) $(RECOMP_FLAGS) $< > $@
%: %_c.c libc_impl.o
$(CC) libc_impl.o $< -o $@ $(OPT_CFLAGS) -fno-strict-aliasing -lm -no-pie
.PHONY: all clean
-99
View File
@@ -1,99 +0,0 @@
#ifndef ELF_H
#define ELF_H
#include <stdint.h>
#define EI_DATA 5
#define EI_NIDENT 16
#define SHT_SYMTAB 2
#define SHT_DYNAMIC 6
#define SHT_REL 9
#define SHT_DYNSYM 11
#define SHT_MIPS_REGINFO 0x70000006
#define STN_UNDEF 0
#define STT_OBJECT 1
#define STT_FUNC 2
#define DT_PLTGOT 3
#define DT_MIPS_LOCAL_GOTNO 0x7000000a
#define DT_MIPS_SYMTABNO 0x70000011
#define DT_MIPS_GOTSYM 0x70000013
#define ELF32_R_SYM(info) ((info) >> 8)
#define ELF32_R_TYPE(info) ((info) & 0xff)
#define ELF32_ST_TYPE(info) ((info) & 0xf)
#define R_MIPS_26 4
#define R_MIPS_HI16 5
#define R_MIPS_LO16 6
#define SHN_UNDEF 0
#define SHN_COMMON 0xfff2
#define SHN_MIPS_ACOMMON 0xff00
#define SHN_MIPS_TEXT 0xff01
#define SHN_MIPS_DATA 0xff02
typedef uint32_t Elf32_Addr;
typedef uint32_t Elf32_Off;
typedef struct {
uint8_t e_ident[EI_NIDENT];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} Elf32_Ehdr;
typedef struct {
uint32_t sh_name;
uint32_t sh_type;
uint32_t sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
uint32_t sh_size;
uint32_t sh_link;
uint32_t sh_info;
uint32_t sh_addralign;
uint32_t sh_entsize;
} Elf32_Shdr;
typedef struct {
uint32_t st_name;
Elf32_Addr st_value;
uint32_t st_size;
uint8_t st_info;
uint8_t st_other;
uint16_t st_shndx;
} Elf32_Sym;
typedef struct {
Elf32_Addr r_offset;
uint32_t r_info;
} Elf32_Rel;
typedef struct
{
uint32_t ri_gprmask; /* General registers used. */
uint32_t ri_cprmask[4]; /* Coprocessor registers used. */
int32_t ri_gp_value; /* $gp register value. */
} Elf32_RegInfo;
typedef struct
{
int32_t d_tag; /* Dynamic entry type */
union {
uint32_t d_val; /* Integer value */
Elf32_Addr d_ptr; /* Address value */
} d_un;
} Elf32_Dyn;
#endif
-30
View File
@@ -1,30 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "libc_impl.h"
#include "helpers.h"
#define RM_RN 0
#define RM_RZ 1
#define RM_RP 2
#define RM_RM 3
union FloatReg {
float f[2];
uint32_t w[2];
double d;
};
#define cvt_w_d(f) \
((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0))
#define cvt_w_s(f) cvt_w_d((double)f)
static union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}},
f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}},
f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}};
static uint32_t fcsr = 1;
-13
View File
@@ -1,13 +0,0 @@
#ifndef HELPERS_H
#define HELPERS_H
#include <stdint.h>
#define MEM_U32(a) (*(uint32_t *)(mem + a))
#define MEM_S32(a) (*(int32_t *)(mem + a))
#define MEM_U16(a) (*(uint16_t *)(mem + ((a) ^ 2)))
#define MEM_S16(a) (*(int16_t *)(mem + ((a) ^ 2)))
#define MEM_U8(a) (*(uint8_t *)(mem + ((a) ^ 3)))
#define MEM_S8(a) (*(int8_t *)(mem + ((a) ^ 3)))
#endif
File diff suppressed because it is too large. Load diff
-163
View File
@@ -1,163 +0,0 @@
#include <stdint.h>
void mmap_initial_data_range(uint8_t *mem, uint32_t start, uint32_t end);
void setup_libc_data(uint8_t *mem);
uint32_t wrapper_sbrk(uint8_t *mem, int increment);
uint32_t wrapper_malloc(uint8_t *mem, uint32_t size);
uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size);
uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size);
int wrapper_fscanf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp);
int wrapper_printf(uint8_t *mem, uint32_t format_addr, uint32_t sp);
int wrapper_sprintf(uint8_t *mem, uint32_t str_addr, uint32_t format_addr, uint32_t sp);
int wrapper_fprintf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp);
int wrapper__doprnt(uint8_t *mem, uint32_t format_addr, uint32_t params_addr, uint32_t fp_addr);
void wrapper_free(uint8_t *mem, uint32_t data_addr);
uint32_t wrapper_strlen(uint8_t *mem, uint32_t str_addr);
int wrapper_open(uint8_t *mem, uint32_t pathname_addr, int flags, int mode);
int wrapper_creat(uint8_t *mem, uint32_t pathname_addr, int mode);
int wrapper_access(uint8_t *mem, uint32_t pathname_addr, int mode);
int wrapper_rename(uint8_t *mem, uint32_t oldpath_addr, uint32_t newpath_addr);
int wrapper_utime(uint8_t *mem, uint32_t filename_addr, uint32_t times_addr);
int wrapper_flock(uint8_t *mem, int fd, int operation);
int wrapper_chmod(uint8_t *mem, uint32_t path_addr, uint32_t mode);
int wrapper_umask(int mode);
uint32_t wrapper_ecvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr);
uint32_t wrapper_fcvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr);
double wrapper_sqrt(double v);
float wrapper_sqrtf(float v);
int wrapper_atoi(uint8_t *mem, uint32_t nptr_addr);
int wrapper_atol(uint8_t *mem, uint32_t nptr_addr);
double wrapper_atof(uint8_t *mem, uint32_t nptr_addr);
int wrapper_strtol(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base);
uint32_t wrapper_strtoul(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base);
double wrapper_strtod(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr);
uint32_t wrapper_strchr(uint8_t *mem, uint32_t str_addr, int c);
uint32_t wrapper_strrchr(uint8_t *mem, uint32_t str_addr, int c);
uint32_t wrapper_strcspn(uint8_t *mem, uint32_t str_addr, uint32_t invalid_addr);
uint32_t wrapper_strpbrk(uint8_t *mem, uint32_t str_addr, uint32_t accept_addr);
int wrapper_fstat(uint8_t *mem, int fildes, uint32_t buf_addr);
int wrapper_stat(uint8_t *mem, uint32_t pathname_addr, uint32_t buf_addr);
int wrapper_ftruncate(uint8_t *mem, int fd, int length);
void wrapper_bcopy(uint8_t *mem, uint32_t src_addr, uint32_t dst_addr, uint32_t len);
uint32_t wrapper_memcpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, uint32_t len);
uint32_t wrapper_memccpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, int c, uint32_t len);
int wrapper_read(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes);
int wrapper_write(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes);
uint32_t wrapper_fopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr);
uint32_t wrapper_freopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr, uint32_t fp_addr);
int wrapper_fclose(uint8_t *mem, uint32_t fp_addr);
int wrapper_fflush(uint8_t *mem, uint32_t fp_addr);
int wrapper_ftell(uint8_t *mem, uint32_t fp_addr);
void wrapper_rewind(uint8_t *mem, uint32_t fp_addr);
int wrapper_fseek(uint8_t *mem, uint32_t fp_addr, int offset, int origin);
int wrapper_lseek(uint8_t *mem, int fd, int offset, int whence);
int wrapper_dup(uint8_t *mem, int fd);
int wrapper_dup2(uint8_t *mem, int oldfd, int newfd);
int wrapper_pipe(uint8_t *mem, uint32_t pipefd_addr);
void wrapper_perror(uint8_t *mem, uint32_t str_addr);
int wrapper_fdopen(uint8_t *mem, int fd, uint32_t mode_addr);
uint32_t wrapper_memset(uint8_t *mem, uint32_t dest_addr, int byte, uint32_t n);
int wrapper_bcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n);
int wrapper_memcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n);
int wrapper_getpid(void);
int wrapper_getpgrp(uint8_t *mem);
int wrapper_remove(uint8_t *mem, uint32_t path_addr);
int wrapper_unlink(uint8_t *mem, uint32_t path_addr);
int wrapper_close(uint8_t *mem, int fd);
int wrapper_strcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr);
int wrapper_strncmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n);
uint32_t wrapper_strcpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr);
uint32_t wrapper_strncpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n);
uint32_t wrapper_strcat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr);
uint32_t wrapper_strncat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n);
uint32_t wrapper_strtok(uint8_t *mem, uint32_t str_addr, uint32_t delimiters_addr);
uint32_t wrapper_strstr(uint8_t *mem, uint32_t str1_addr, uint32_t str2_addr);
uint32_t wrapper_strdup(uint8_t *mem, uint32_t str_addr);
int wrapper_toupper(int c);
int wrapper_tolower(int c);
int wrapper_gethostname(uint8_t *mem, uint32_t name_addr, uint32_t len);
int wrapper_isatty(uint8_t *mem, int fd);
int wrapper_times(uint8_t *mem, uint32_t buffer_addr);
uint32_t wrapper_strftime(uint8_t *mem, uint32_t ptr_addr, uint32_t maxsize, uint32_t format_addr, uint32_t timeptr_addr);
int wrapper_clock(void);
uint32_t wrapper_ctime(uint8_t *mem, uint32_t timep_addr);
uint32_t wrapper_localtime(uint8_t *mem, uint32_t timep_addr);
int wrapper_setvbuf(uint8_t *mem, uint32_t fp_addr, uint32_t buf_addr, int mode, uint32_t size);
int wrapper___semgetc(uint8_t *mem, uint32_t fp_addr);
int wrapper___semputc(uint8_t *mem, int c, uint32_t fp_addr);
int wrapper_fgetc(uint8_t *mem, uint32_t fp_addr);
int wrapper_fgets(uint8_t *mem, uint32_t str_addr, int count, uint32_t fp_addr);
int wrapper___filbuf(uint8_t *mem, uint32_t fp_addr);
int wrapper___flsbuf(uint8_t *mem, int ch, uint32_t fp_addr);
int wrapper_ungetc(uint8_t *mem, int ch, uint32_t fp_addr);
uint32_t wrapper_gets(uint8_t *mem, uint32_t str_addr);
uint32_t wrapper_fread(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr);
uint32_t wrapper_fwrite(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr);
int wrapper_fputs(uint8_t *mem, uint32_t str_addr, uint32_t fp_addr);
int wrapper_puts(uint8_t *mem, uint32_t str_addr);
uint32_t wrapper_getcwd(uint8_t *mem, uint32_t buf_addr, uint32_t size);
int wrapper_time(uint8_t *mem, uint32_t tloc_addr);
void wrapper_bzero(uint8_t *mem, uint32_t str_addr, uint32_t n);
int wrapper_fp_class_d(double d);
double wrapper_ldexp(double d, int i);
int64_t wrapper___ll_mul(int64_t a0, int64_t a1);
int64_t wrapper___ll_div(int64_t a0, int64_t a1);
int64_t wrapper___ll_rem(uint64_t a0, int64_t a1);
int64_t wrapper___ll_lshift(int64_t a0, uint64_t shift);
int64_t wrapper___ll_rshift(int64_t a0, uint64_t shift);
uint64_t wrapper___ull_div(uint64_t a0, uint64_t a1);
uint64_t wrapper___ull_rem(uint64_t a0, uint64_t a1);
uint64_t wrapper___ull_rshift(uint64_t a0, uint64_t shift);
uint64_t wrapper___d_to_ull(double d);
int64_t wrapper___d_to_ll(double d);
uint64_t wrapper___f_to_ull(float f);
int64_t wrapper___f_to_ll(float f);
float wrapper___ull_to_f(uint64_t v);
float wrapper___ll_to_f(int64_t v);
double wrapper___ull_to_d(uint64_t v);
double wrapper___ll_to_d(int64_t v);
void wrapper_abort(uint8_t *mem);
void wrapper_exit(uint8_t *mem, int status);
void wrapper__exit(uint8_t *mem, int status);
void wrapper__cleanup(uint8_t *mem);
uint32_t wrapper__rld_new_interface(uint8_t *mem, uint32_t operation, uint32_t sp);
void wrapper__exithandle(uint8_t *mem);
int wrapper__prctl(uint8_t *mem, int operation, uint32_t sp);
double wrapper__atod(uint8_t *mem, uint32_t buffer_addr, int ndigits, int dexp);
int wrapper_pathconf(uint8_t *mem, uint32_t path_addr, int name);
uint32_t wrapper_getenv(uint8_t *mem, uint32_t name_addr);
uint32_t wrapper_gettxt(uint8_t *mem, uint32_t msgid_addr, uint32_t default_str_addr);
uint32_t wrapper_setlocale(uint8_t *mem, int category, uint32_t locale_addr);
uint32_t wrapper_mmap(uint8_t *mem, uint32_t addr, uint32_t length, int prot, int flags, int fd, int offset);
int wrapper_munmap(uint8_t *mem, uint32_t addr, uint32_t length);
int wrapper_mprotect(uint8_t *mem, uint32_t addr, uint32_t length, int prot);
int wrapper_sysconf(uint8_t *mem, int name);
int wrapper_getpagesize(uint8_t *mem);
int wrapper_strerror(uint8_t *mem, int errnum);
int wrapper_ioctl(uint8_t *mem, int fd, uint32_t request, uint32_t sp);
int wrapper_fcntl(uint8_t *mem, int fd, int cmd, uint32_t sp);
uint32_t wrapper_signal(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t handler_addr, uint32_t sp);
uint32_t wrapper_sigset(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t disp_addr, uint32_t sp);
int wrapper_get_fpc_csr(uint8_t *mem);
int wrapper_set_fpc_csr(uint8_t *mem, int csr);
int wrapper_setjmp(uint8_t *mem, uint32_t addr);
void wrapper_longjmp(uint8_t *mem, uint32_t addr, int status);
uint32_t wrapper_tempnam(uint8_t *mem, uint32_t dir_addr, uint32_t pfx_addr);
uint32_t wrapper_tmpnam(uint8_t *mem, uint32_t str_addr);
uint32_t wrapper_mktemp(uint8_t *mem, uint32_t template_addr);
int wrapper_mkstemp(uint8_t *mem, uint32_t name_addr);
uint32_t wrapper_tmpfile(uint8_t *mem);
int wrapper_wait(uint8_t *mem, uint32_t wstatus_addr);
int wrapper_kill(uint8_t *mem, int pid, int sig);
int wrapper_execlp(uint8_t *mem, uint32_t file_addr, uint32_t sp);
int wrapper_execv(uint8_t *mem, uint32_t pathname_addr, uint32_t argv_addr);
int wrapper_execvp(uint8_t *mem, uint32_t file_addr, uint32_t argv_addr);
int wrapper_fork(uint8_t *mem);
int wrapper_system(uint8_t *mem, uint32_t command_addr);
uint32_t wrapper_tsearch(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr);
uint32_t wrapper_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr);
uint32_t wrapper_qsort(uint8_t *mem, uint32_t base_addr, uint32_t num, uint32_t size, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t compare_addr, uint32_t sp);
uint32_t wrapper_regcmp(uint8_t *mem, uint32_t string1_addr, uint32_t sp);
uint32_t wrapper_regex(uint8_t *mem, uint32_t re_addr, uint32_t subject_addr, uint32_t sp);
void wrapper___assert(uint8_t *mem, uint32_t assertion_addr, uint32_t file_addr, int line);
File diff suppressed because it is too large. Load diff
BIN
View File
Binary file not shown.