├── tools ├── .gitignore ├── asmproc │ ├── .gitignore │ ├── mypy.ini │ ├── tests │ │ ├── line-continuation-separate-file.s │ │ ├── label-sameline.c │ │ ├── line-continuation.asmproc.d │ │ ├── comments.c │ │ ├── ascii.c │ │ ├── force.c │ │ ├── line-continuation.c │ │ ├── o2.c │ │ ├── o0.c │ │ ├── static.c │ │ ├── static-global.c │ │ ├── comments.objdump │ │ ├── label-sameline.objdump │ │ ├── late_rodata_misaligned_doubles.c │ │ ├── late_rodata_doubles.c │ │ ├── late_rodata_align.c │ │ ├── late_rodata_doubles_mips1.c │ │ ├── test2.c │ │ ├── ascii.objdump │ │ ├── line-continuation.objdump │ │ ├── o2.objdump │ │ ├── pascal.p │ │ ├── o0.objdump │ │ ├── kpic-o2.c │ │ ├── kpic-o1.c │ │ ├── force.objdump │ │ ├── test1.c │ │ ├── test3.c │ │ ├── kpic-o1.objdump │ │ ├── kpic-o2.objdump │ │ ├── test1.objdump │ │ ├── late_rodata_align.objdump │ │ ├── late_rodata_doubles_mips1.objdump │ │ ├── static.objdump │ │ ├── static-global.objdump │ │ ├── late_rodata_doubles.objdump │ │ ├── late_rodata_misaligned_doubles.objdump │ │ ├── late_rodata_jtbl.c │ │ ├── late_rodata_jtbl_mips1.c │ │ ├── test3.objdump │ │ ├── large.objdump │ │ ├── test2.objdump │ │ └── large.c │ ├── add-test.sh │ ├── run-tests.sh │ ├── compile-test.sh │ ├── prelude.inc │ ├── LICENSE │ └── build.py ├── ido_recomp │ ├── linux │ │ ├── 5.3 │ │ │ ├── cc │ │ │ ├── ld │ │ │ ├── acpp │ │ │ ├── as0 │ │ │ ├── as1 │ │ │ ├── cfe │ │ │ ├── copt │ │ │ ├── strip │ │ │ ├── ugen │ │ │ ├── ujoin │ │ │ ├── uld │ │ │ ├── uopt │ │ │ ├── upas │ │ │ ├── c++filt │ │ │ ├── libc.so │ │ │ ├── libm.so │ │ │ ├── umerge │ │ │ ├── usplit │ │ │ ├── libc.so.1 │ │ │ ├── libexc.so │ │ │ └── libgen.so │ │ └── 7.1 │ │ │ ├── cc │ │ │ ├── as0 │ │ │ ├── as1 │ │ │ ├── cfe │ │ │ ├── ugen │ │ │ ├── ujoin │ │ │ ├── uld │ │ │ ├── uopt │ │ │ ├── umerge │ │ │ └── usplit │ └── macos │ │ ├── 5.3 │ │ ├── cc │ │ ├── ld │ │ ├── acpp │ │ ├── as0 │ │ ├── as1 │ │ ├── cfe │ │ ├── copt │ │ ├── strip │ │ ├── ugen │ │ ├── ujoin │ │ ├── uld │ │ ├── uopt │ │ ├── umerge │ │ └── usplit │ │ └── 7.1 │ │ ├── cc │ │ ├── acpp │ │ ├── as0 │ │ ├── as1 │ │ ├── cfe │ │ ├── ugen │ │ ├── ujoin │ │ ├── uld │ │ ├── uopt │ │ ├── upas │ │ ├── umerge │ │ └── usplit ├── Makefile └── m2ctx ├── checksum.md5 ├── .gitmodules ├── include ├── variables.h ├── macro.inc ├── sections.h ├── macros.h ├── functions.h ├── PR │ ├── os_version.h │ ├── os_internal_flash.h │ ├── rmon.h │ ├── os_internal_thread.h │ ├── os_internal_host.h │ ├── os_internal_debug.h │ ├── os_internal_gio.h │ ├── os_internal_error.h │ ├── os_internal_si.h │ ├── os_internal_tlb.h │ ├── os_internal_rsp.h │ ├── os_internal.h │ ├── os_internal_reg.h │ ├── os_motor.h │ ├── os_internal_exception.h │ ├── os_si.h │ ├── os_gio.h │ ├── os_rsp.h │ ├── os_error.h │ ├── ultralog.h │ ├── os_reg.h │ ├── os_flash.h │ ├── os_ai.h │ ├── os_rdp.h │ ├── os_gbpak.h │ ├── os_cache.h │ ├── os_libc.h │ ├── os_exception.h │ ├── rdb.h │ ├── os_voice.h │ ├── os_tlb.h │ ├── os.h │ ├── os_eeprom.h │ ├── ultratypes.h │ ├── os_time.h │ ├── mbi.h │ ├── os_system.h │ ├── os_convert.h │ ├── os_debug.h │ ├── region.h │ ├── ramrom.h │ └── sched.h └── ultra64.h ├── requirements.txt ├── src ├── 40000.c ├── set_zero_tlb.c ├── 13F0.c ├── 10D0.c └── 40300.c ├── .gitignore └── README.md /tools/.gitignore: -------------------------------------------------------------------------------- 1 | n64crc 2 | -------------------------------------------------------------------------------- /tools/asmproc/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.py[cod] 3 | -------------------------------------------------------------------------------- /checksum.md5: -------------------------------------------------------------------------------- 1 | 093058ece14c8cc1a887b2087eb5cfe9 build/bm64.z64 2 | -------------------------------------------------------------------------------- /tools/asmproc/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | files = asm_processor.py, build.py 3 | 4 | -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/cc -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/ld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/ld -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/cc -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/cc -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/ld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/ld -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/cc -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/acpp -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/as0 -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/as1 -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/cfe -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/copt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/copt -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/strip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/strip -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/ugen -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/ujoin -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/uld -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/uopt -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/upas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/upas -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/as0 -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/as1 -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/cfe -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/ugen -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/ujoin -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/uld -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/uopt -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/acpp -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/as0 -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/as1 -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/cfe -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/copt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/copt -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/strip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/strip -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/ugen -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/ujoin -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/uld -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/uopt -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/acpp -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/as0 -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/as1 -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/cfe -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/ugen -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/ujoin -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/uld -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/uopt -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/upas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/upas -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tools/n64splat"] 2 | path = tools/n64splat 3 | url = https://github.com/ethteck/n64splat.git 4 | -------------------------------------------------------------------------------- /tools/asmproc/tests/line-continuation-separate-file.s: -------------------------------------------------------------------------------- 1 | .rdata 2 | label: .asciiz "1\n\ 3 | 2", \ 4 | "34", "56" 5 | -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/c++filt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/c++filt -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/libc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/libc.so -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/libm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/libm.so -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/umerge -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/usplit -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/umerge -------------------------------------------------------------------------------- /tools/ido_recomp/linux/7.1/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/7.1/usplit -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/umerge -------------------------------------------------------------------------------- /tools/ido_recomp/macos/5.3/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/5.3/usplit -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/umerge -------------------------------------------------------------------------------- /tools/ido_recomp/macos/7.1/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/macos/7.1/usplit -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/libc.so.1 -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/libexc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/libexc.so -------------------------------------------------------------------------------- /tools/ido_recomp/linux/5.3/libgen.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bomberhackers/bm64/HEAD/tools/ido_recomp/linux/5.3/libgen.so -------------------------------------------------------------------------------- /include/variables.h: -------------------------------------------------------------------------------- 1 | #ifndef _VARIABLES_H_ 2 | #define _VARIABLES_H_ 3 | 4 | #include "ultra64.h" 5 | 6 | #endif // _VARIABLES_H_ 7 | -------------------------------------------------------------------------------- /tools/asmproc/tests/label-sameline.c: -------------------------------------------------------------------------------- 1 | GLOBAL_ASM( 2 | .rdata 3 | .word 0x12345678 4 | glabel blah 5 | .word blah2 6 | /*a*/ blah2: /*b*/ .word blah /*c*/ 7 | ) 8 | -------------------------------------------------------------------------------- /tools/asmproc/tests/line-continuation.asmproc.d: -------------------------------------------------------------------------------- 1 | tests/line-continuation.o: tests/line-continuation-separate-file.s 2 | 3 | tests/line-continuation-separate-file.s: 4 | -------------------------------------------------------------------------------- /include/macro.inc: -------------------------------------------------------------------------------- 1 | .macro glabel label 2 | .global \label 3 | \label: 4 | .endm 5 | 6 | .macro jlabel label 7 | .global \label 8 | \label: 9 | .endm 10 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Requirements 2 | PyYAML 3 | pylibyaml 4 | pypng 5 | colorama 6 | spimdisasm>=1.18.0 7 | rabbitizer>=1.2.0 8 | pygfxd 9 | tqdm 10 | intervaltree 11 | n64img 12 | -------------------------------------------------------------------------------- /tools/asmproc/add-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | for A in "$@"; do 3 | OBJDUMPFLAGS="-srt" 4 | ./compile-test.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.*}.o" > "${A%.*}.objdump" 5 | done 6 | -------------------------------------------------------------------------------- /tools/asmproc/tests/comments.c: -------------------------------------------------------------------------------- 1 | const char before[] = "^"; 2 | GLOBAL_ASM( 3 | .rdata 4 | .asciz "aaaa /* bbbb */ # cccc", /**//**//**//**/ /*/ "xxxx" /*/ /* dddd " eeee */ "# ffff" # gggg "hhhh" /* iiii */ 5 | ) 6 | const char after[] = "$"; 7 | -------------------------------------------------------------------------------- /src/40000.c: -------------------------------------------------------------------------------- 1 | #include "ultra64.h" 2 | 3 | void func_80225840(s32); /* extern */ 4 | 5 | void func_80225800(s32 arg0) { 6 | void (*sp1C)(s32); 7 | 8 | sp1C = func_80225840; 9 | sp1C(arg0); 10 | } 11 | -------------------------------------------------------------------------------- /tools/asmproc/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | for A in tests/*.c tests/*.p; do 3 | OBJDUMPFLAGS=-srt 4 | echo $A 5 | ./compile-test.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.*}.o" | diff - "${A%.*}.objdump" || echo FAIL "$A" 6 | done 7 | -------------------------------------------------------------------------------- /include/sections.h: -------------------------------------------------------------------------------- 1 | #ifndef _SECTIONS_H_ 2 | #define _SECTIONS_H_ 3 | 4 | #include "ultra64.h" 5 | 6 | // zerojump area 7 | extern u8 zerojump_ROM_START[]; 8 | extern u8 zerojump_ROM_END[]; 9 | 10 | extern u32 boot_code_TEXT_END; 11 | extern u32 boot_code_RODATA_START; 12 | 13 | #endif // _SECTIONS_H_ 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by splat 2 | asm/ 3 | bin/ 4 | assets/ 5 | 6 | # Build directory 7 | build/ 8 | 9 | .vscode/ 10 | __pycache__/ 11 | 12 | *.o 13 | *.z64 14 | *.n64 15 | *.ld 16 | *.csv 17 | 18 | undefined_funcs_auto.txt 19 | undefined_syms_auto.txt 20 | 21 | # qemu-irix compilers 22 | tools/ido5.3_compiler/ 23 | tools/ido7.1_compiler/ 24 | 25 | # diffing directory 26 | expected/ 27 | 28 | # misc 29 | .DS_Store 30 | -------------------------------------------------------------------------------- /include/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef __MACROS_H__ 2 | #define __MACROS_H__ 3 | 4 | #ifdef __GNUC__ 5 | #define GLOBAL_ASM(...) 6 | #endif 7 | 8 | #define ALIGNED(x) __attribute__((aligned(x))) 9 | 10 | #define ARRLEN(x) ((s32)(sizeof(x) / sizeof(x[0]))) 11 | 12 | #define STUBBED_PRINTF(x) ((void)(x)) 13 | 14 | #define UNUSED __attribute__((unused)) 15 | 16 | #ifndef __GNUC__ 17 | #define __attribute__(x) 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /tools/asmproc/tests/ascii.c: -------------------------------------------------------------------------------- 1 | void foo(void) { "abcdef"; } 2 | 3 | GLOBAL_ASM( 4 | .rdata 5 | .ascii "AB" 6 | .ascii "CD", "EF" 7 | .ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK" 8 | ) 9 | 10 | void bar(void) { "hello"; } 11 | 12 | GLOBAL_ASM( 13 | .rdata 14 | .asciiz "12" 15 | .asciiz "34", "56" 16 | .asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A" 17 | ) 18 | 19 | void baz(void) { "ghijkl"; } 20 | -------------------------------------------------------------------------------- /tools/asmproc/tests/force.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | // ASMP-FLAGS: --convert-statics=global-with-filename --force 3 | static int xtext(int a, int b, int c); 4 | const int rodata1[] = {1}; 5 | static const int rodata2[] = {2}; 6 | int data1[] = {3}; 7 | static int data2[] = {4}; 8 | int bss1; 9 | static int bss2; 10 | 11 | static int xtext(int a, int b, int c) { 12 | return 1; 13 | } 14 | 15 | void baz(void) { 16 | xtext(bss2, rodata2[0], data2[0]); 17 | } 18 | -------------------------------------------------------------------------------- /tools/asmproc/tests/line-continuation.c: -------------------------------------------------------------------------------- 1 | void foo(void) { "abcdef"; } 2 | 3 | GLOBAL_ASM( 4 | .rdata 5 | .ascii "AB" \ 6 | "CD", "EF" 7 | .ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK" 8 | ) 9 | 10 | void bar(void) { "hello"; } 11 | 12 | GLOBAL_ASM( 13 | .rdata 14 | .asciiz "1\ 15 | 2" 16 | .asciiz "34", "56" 17 | .asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A" 18 | ) 19 | 20 | void baz(void) { "ghijkl"; } 21 | 22 | GLOBAL_ASM("tests/line-continuation-separate-file.s") 23 | -------------------------------------------------------------------------------- /tools/asmproc/tests/o2.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | 3 | int a(void) { return 1; } 4 | GLOBAL_ASM( 5 | glabel foo 6 | addiu $a0, $a0, 1 7 | addiu $a0, $a0, 2 8 | addiu $a0, $a0, 3 9 | jr $ra 10 | addiu $a0, $a0, 4 11 | ) 12 | float b(void) { return 1.2f; } 13 | GLOBAL_ASM( 14 | .late_rodata 15 | glabel float1 16 | .float 12.34 17 | 18 | .text 19 | glabel bar 20 | addiu $a0, $a0, 5 21 | addiu $a0, $a0, 6 22 | lui $v0, %hi(float1 + 1) 23 | jr $ra 24 | addiu $v0, $v0, %lo(float1 + 1) 25 | ) 26 | float c(void) { return 1.3f; } 27 | -------------------------------------------------------------------------------- /tools/asmproc/tests/o0.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O0 2 | 3 | int a(void) { return 1; } 4 | GLOBAL_ASM( 5 | glabel foo 6 | addiu $a0, $a0, 1 7 | addiu $a0, $a0, 2 8 | addiu $a0, $a0, 3 9 | jr $ra 10 | addiu $a0, $a0, 4 11 | ) 12 | float b(void) { return 1.2f; } 13 | GLOBAL_ASM( 14 | .late_rodata 15 | glabel float1 16 | .float 12.34 17 | 18 | .text 19 | glabel bar 20 | addiu $a0, $a0, 5 21 | addiu $a0, $a0, 6 22 | addiu $a0, $a0, 7 23 | addiu $a0, $a0, 8 24 | lui $v0, %hi(float1 + 1) 25 | jr $ra 26 | addiu $v0, $v0, %lo(float1 + 1) 27 | ) 28 | float c(void) { return 1.3f; } 29 | -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | CC := gcc 2 | CXX := g++ 3 | CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O2 -s 4 | CXXFLAGS := -I . -Wall -Wextra -std=c++17 5 | LDFLAGS := -lm 6 | PROGRAMS := n64crc 7 | 8 | default: all 9 | 10 | n64crc_SOURCES := n64crc.c 11 | 12 | all: $(PROGRAMS) 13 | 14 | clean: 15 | rm -Rf $(PROGRAMS) $(BUILD_DIR) 16 | 17 | distclean: clean 18 | 19 | n64crc: n64crc.c 20 | $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) 21 | 22 | $(BUILD_DIR)/%.o: %.c 23 | $(CC) -c $^ -o $@ $(CFLAGS) 24 | $(BUILD_DIR)/%.o: %.cpp 25 | $(CXX) -c $< -o $@ $(CXXFLAGS) 26 | 27 | .PHONY: all clean distclean default 28 | -------------------------------------------------------------------------------- /tools/asmproc/tests/static.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | static int xtext(int a, int b, int c); 3 | const int rodata1[] = {1}; 4 | static const int rodata2[] = {2}; 5 | int data1[] = {3}; 6 | static int data2[] = {4}; 7 | int bss1; 8 | static int bss2; 9 | 10 | GLOBAL_ASM( 11 | glabel bar 12 | lui $a0, %hi(rodata2) 13 | lw $a0, %lo(rodata2)($a0) 14 | lui $a1, %hi(data2) 15 | lw $a1, %lo(data2)($a0) 16 | lui $a2, %hi(bss2) 17 | lw $a2, %lo(bss2)($a0) 18 | jal xtext 19 | nop 20 | jr $ra 21 | nop 22 | nop 23 | nop 24 | ) 25 | 26 | static int xtext(int a, int b, int c) { 27 | return 1; 28 | } 29 | 30 | void baz(void) { 31 | xtext(bss2, rodata2[0], data2[0]); 32 | } 33 | -------------------------------------------------------------------------------- /include/functions.h: -------------------------------------------------------------------------------- 1 | #ifndef _FUNCTIONS_H_ 2 | #define _FUNCTIONS_H_ 3 | 4 | #include "ultra64.h" 5 | 6 | // set_zero_tlb.c 7 | void set_zero_vaddr_tlb(void); 8 | 9 | // 2630.s 10 | void func_80001A30(u32 *table, u32* func); 11 | 12 | // 2990.s 13 | s32 func_80001D90(s32*, s32*, s32); 14 | 15 | //40300.c (hudson libc?) 16 | s32 func_80225B00(s32 arg0); 17 | u8 *Libc_Strcat(u8 *str, u8 *str1); 18 | s32 Libc_Strlen(u8 *str); 19 | size_t func_80225BB8(u32 arg0, u32 arg1, u8 *arg2); 20 | void *Libc_memcpy(u8 *dest, u8 *source, s32 c); 21 | void* Libc_memmove(void* dest, void* src, size_t len); 22 | u8 *Libc_memset(u8 *arg0, u8 *arg1, s32 arg2); 23 | 24 | #endif // _FUNCTIONS_H_ 25 | -------------------------------------------------------------------------------- /tools/asmproc/tests/static-global.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | // ASMP-FLAGS: --convert-statics=global 3 | static int xtext(int a, int b, int c); 4 | const int rodata1[] = {1}; 5 | static const int rodata2[] = {2}; 6 | int data1[] = {3}; 7 | static int data2[] = {4}; 8 | int bss1; 9 | static int bss2; 10 | 11 | GLOBAL_ASM( 12 | glabel bar 13 | lui $a0, %hi(rodata2) 14 | lw $a0, %lo(rodata2)($a0) 15 | lui $a1, %hi(data2) 16 | lw $a1, %lo(data2)($a0) 17 | lui $a2, %hi(bss2) 18 | lw $a2, %lo(bss2)($a0) 19 | jal xtext 20 | nop 21 | jr $ra 22 | nop 23 | nop 24 | nop 25 | ) 26 | 27 | static int xtext(int a, int b, int c) { 28 | return 1; 29 | } 30 | 31 | void baz(void) { 32 | xtext(bss2, rodata2[0], data2[0]); 33 | } 34 | -------------------------------------------------------------------------------- /include/PR/os_version.h: -------------------------------------------------------------------------------- 1 | 2 | /*---------------------------------------------------------------------* 3 | Copyright (C) 1998 Nintendo. 4 | 5 | $RCSfile: os_version.h,v $ 6 | $Revision: 1.2 $ 7 | $Date: 1999/06/17 01:33:01 $ 8 | *---------------------------------------------------------------------*/ 9 | 10 | #ifndef _OS_VERSION_H_ 11 | #define _OS_VERSION_H_ 12 | 13 | #define VERSION_D 1 14 | #define VERSION_E 2 15 | #define VERSION_F 3 16 | #define VERSION_G 4 17 | #define VERSION_H 5 18 | #define VERSION_I 6 19 | #define VERSION_J 7 20 | #define VERSION_K 8 21 | #define VERSION_L 9 22 | 23 | #define OS_MAJOR_VERSION BUILD_VERSION_STRING /* major version */ 24 | #define OS_MINOR_VERSION 0 /* patch level */ 25 | 26 | #endif /* !_OS_VERSION_H_ */ 27 | -------------------------------------------------------------------------------- /src/set_zero_tlb.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern u32 D_80042000[]; 4 | 5 | // todo, move to header 6 | extern void load_from_rom_to_addr(void* arg0, s32 arg1, u32 arg2); 7 | 8 | void set_zero_vaddr_tlb(void) { 9 | load_from_rom_to_addr((u32)&D_80042000, (u32)&zerojump_ROM_END - (u32)&zerojump_ROM_START, (u32)&zerojump_ROM_START); 10 | // weird if statements needed to consume registers to match. 11 | if (boot_code_TEXT_END == 0 || boot_code_TEXT_END == 0) { 12 | 13 | } 14 | if (boot_code_RODATA_START == 0 || boot_code_RODATA_START == 0) { 15 | 16 | } 17 | if (boot_code_TEXT_END == 0 || boot_code_TEXT_END == 0) { 18 | 19 | } 20 | osMapTLB(0, 0, NULL, (u32) (((u32) (&D_80042000)) - 0x80000000), -1, -1); 21 | boot_code_RODATA_START = &boot_code_TEXT_END; // this should probably be boot_code_DATA_START, but that wont match yet 22 | } 23 | -------------------------------------------------------------------------------- /tools/asmproc/tests/comments.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/comments.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .rodata 00000030 .rodata 6 | 00000000 g O .rodata 00000002 before 7 | 00000024 g O .rodata 00000002 after 8 | 9 | 10 | Contents of section .rodata: 11 | 0000 5e000000 61616161 202f2a20 62626262 ^...aaaa /* bbbb 12 | 0010 202a2f20 23206363 63630023 20666666 */ # cccc.# fff 13 | 0020 66000000 24000000 00000000 00000000 f...$........... 14 | Contents of section .options: 15 | 0000 01200000 00000000 00000000 00000000 . .............. 16 | 0010 00000000 00000000 00000000 00007ff0 ................ 17 | 0020 07100000 00000000 00000000 00000000 ................ 18 | 0030 08100000 00000000 00000000 00000000 ................ 19 | Contents of section .reginfo: 20 | 0000 00000000 00000000 00000000 00000000 ................ 21 | 0010 00000000 00007ff0 ........ 22 | -------------------------------------------------------------------------------- /src/13F0.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void load_from_rom_to_addr(void* arg0, s32 arg1, u32 arg2); 4 | 5 | extern s32 D_80019F90; 6 | extern u8 D_80024820[]; 7 | 8 | void func_800007F0(s32 arg0, void* arg1); 9 | 10 | void func_80000870(void) { 11 | func_80001A30(3, &D_80019F90); 12 | load_from_rom_to_addr(&D_80024820, 0x100, 0x30000); 13 | } 14 | 15 | void func_8000083C(s32 arg0, void *arg1, s32 arg2) { 16 | void (*volatile localarg)(int); 17 | // its also possible to match without fake code by omitting arg1 passed to func_800007F0. which would be UB 18 | func_800007F0(arg0, arg1); 19 | (localarg = arg1)(arg2); 20 | if(!arg1) {} // fake check to bump regalloc. see above note 21 | } 22 | 23 | void func_800007F0(s32 arg0, void* arg1) { 24 | s32 temp_t6 = (D_80024820[arg0] << 0xB); 25 | 26 | if (temp_t6 == 0) { 27 | temp_t6 = 0x80000; 28 | } 29 | load_from_rom_to_addr(arg1, temp_t6, arg0 << 0x11); 30 | } 31 | -------------------------------------------------------------------------------- /tools/asmproc/compile-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o pipefail 3 | INPUT="$1" 4 | OUTPUT="${INPUT%.*}.o" 5 | 6 | rm -f "$OUTPUT" 7 | 8 | CC="$MIPS_CC" # ido 7.1 via recomp or qemu-irix 9 | AS="mips-linux-gnu-as" 10 | ASFLAGS="-march=vr4300 -mabi=32" 11 | OPTFLAGS=$(grep 'COMPILE-FLAGS: ' $INPUT | sed 's#^.*COMPILE-FLAGS: ##' | sed 's#}$##') 12 | ASMPFLAGS=$(grep 'ASMP-FLAGS: ' $INPUT | sed 's#^.*ASMP-FLAGS: ##' | sed 's#}$##') 13 | ISET=$(grep 'COMPILE-ISET: ' $INPUT | sed 's#^.*COMPILE-ISET: ##' | sed 's#}$##') 14 | if [[ -z "$OPTFLAGS" ]]; then 15 | OPTFLAGS="-g" 16 | fi 17 | CFLAGS="-Wab,-r4300_mul -G 0 -Xcpluscomm -fullwarn -wlint -woff 819,820,852,821 -signed -c" 18 | if [[ -z "$ISET" ]]; then 19 | CFLAGS="$CFLAGS -mips2" 20 | fi 21 | if [[ "$OPTFLAGS" != *-KPIC* ]]; then 22 | CFLAGS="$CFLAGS -non_shared" 23 | fi 24 | 25 | set -e 26 | python3 build.py --drop-mdebug-gptab $ASMPFLAGS $CC -- $AS $ASFLAGS -- $CFLAGS $OPTFLAGS $ISET -o "$OUTPUT" "$INPUT" 27 | -------------------------------------------------------------------------------- /tools/asmproc/tests/label-sameline.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/label-sameline.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .rodata 00000010 .rodata 6 | 00000000 l d .rodata 00000000 7 | 00000004 g .rodata 00000000 blah 8 | 9 | 10 | RELOCATION RECORDS FOR [.rodata]: 11 | OFFSET TYPE VALUE 12 | 00000004 R_MIPS_32 13 | 00000008 R_MIPS_32 blah 14 | 15 | 16 | Contents of section .rodata: 17 | 0000 12345678 00000008 00000000 00000000 .4Vx............ 18 | Contents of section .options: 19 | 0000 01200000 00000000 00000000 00000000 . .............. 20 | 0010 00000000 00000000 00000000 00007ff0 ................ 21 | 0020 07100000 00000000 00000000 00000000 ................ 22 | 0030 08100000 00000000 00000000 00000000 ................ 23 | Contents of section .reginfo: 24 | 0000 00000000 00000000 00000000 00000000 ................ 25 | 0010 00000000 00007ff0 ........ 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bomberman 64 (USA) 2 | A WIP decomp of Bomberman 64 (USA). 3 | 4 | It builds the following ROM(s): 5 | 6 | * bm64.z64: `md5: 093058ece14c8cc1a887b2087eb5cfe9` 7 | 8 | Note: To use this repository, you must already have a rom for the game. 9 | 10 | # Prerequisites 11 | 12 | Under Debian / Ubuntu (which we recommend using), you can install them with the following commands: 13 | 14 | ```bash 15 | sudo apt update 16 | sudo apt install make git build-essential binutils-mips-linux-gnu python3 python3-pip 17 | ``` 18 | 19 | **Please also ensure that the Python version installed is >3.7.** 20 | 21 | The build process has a few python packages required that are located in `requirements.txt`. 22 | 23 | To install them simply run in a terminal: 24 | 25 | ```bash 26 | python3 -m pip install -r requirements.txt 27 | ``` 28 | 29 | # To use 30 | 1. Place the USA Bomberman 64 rom into the root of the repository as "baserom.z64". 31 | 2. Set up tools and extract the rom: `make setup` 32 | 3. Re-assemble the rom: `make` 33 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_misaligned_doubles.c: -------------------------------------------------------------------------------- 1 | GLOBAL_ASM( 2 | .late_rodata 3 | .float 4.01 4 | .word 0 5 | .double 4.02 6 | .text 7 | glabel a 8 | nop 9 | nop 10 | nop 11 | nop 12 | nop 13 | nop 14 | nop 15 | nop 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | nop 23 | nop 24 | ) 25 | 26 | double foo(void) { return 4.03; } 27 | 28 | GLOBAL_ASM( 29 | .late_rodata 30 | .float 4.04 31 | .double 4.05 32 | .text 33 | glabel b 34 | nop 35 | nop 36 | nop 37 | nop 38 | nop 39 | nop 40 | nop 41 | nop 42 | nop 43 | nop 44 | nop 45 | nop 46 | nop 47 | nop 48 | nop 49 | nop 50 | ) 51 | 52 | double bar(void) { return 4.06; } 53 | float baz(void) { return 4.07f; } 54 | 55 | GLOBAL_ASM( 56 | .late_rodata 57 | .double 4.08 58 | .text 59 | glabel c 60 | nop 61 | nop 62 | nop 63 | nop 64 | nop 65 | nop 66 | nop 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | nop 76 | ) 77 | 78 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_doubles.c: -------------------------------------------------------------------------------- 1 | GLOBAL_ASM( 2 | .late_rodata 3 | .float 4.1 4 | .text 5 | glabel a 6 | nop 7 | nop 8 | nop 9 | nop 10 | nop 11 | nop 12 | nop 13 | nop 14 | nop 15 | nop 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | ) 23 | 24 | float foo(void) { 25 | return 4.15f; 26 | } 27 | 28 | GLOBAL_ASM( 29 | .late_rodata 30 | .float 4.2 31 | .word 0 32 | .double 4.3 33 | .text 34 | glabel b 35 | nop 36 | nop 37 | nop 38 | nop 39 | nop 40 | nop 41 | nop 42 | nop 43 | nop 44 | nop 45 | nop 46 | nop 47 | nop 48 | nop 49 | nop 50 | nop 51 | ) 52 | 53 | float bar(void) { 54 | return 4.4f; 55 | } 56 | 57 | GLOBAL_ASM( 58 | .late_rodata 59 | .float 4.55 60 | .double 4.6 61 | .text 62 | glabel c 63 | nop 64 | nop 65 | nop 66 | nop 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | nop 76 | nop 77 | nop 78 | nop 79 | ) 80 | 81 | float baz(void) { 82 | return 4.6f; 83 | } 84 | -------------------------------------------------------------------------------- /include/PR/os_internal_flash.h: -------------------------------------------------------------------------------- 1 | #ifndef _OS_INTERNAL_FLASH_H_ 2 | #define _OS_INTERNAL_FLASH_H_ 3 | 4 | #include "os_message.h" 5 | #include "os_flash.h" 6 | 7 | #define FLASH_BLOCK_SIZE 128 8 | 9 | /** 10 | * Flash commands 11 | */ 12 | #define FLASH_CMD_REG 0x10000 13 | 14 | /* set whole chip erase mode */ 15 | #define FLASH_CMD_CHIP_ERASE 0x3C000000 16 | /* set sector erase mode */ 17 | #define FLASH_CMD_SECTOR_ERASE 0x4B000000 18 | /* do erasure */ 19 | #define FLASH_CMD_EXECUTE_ERASE 0x78000000 20 | /* program selected page */ 21 | #define FLASH_CMD_PROGRAM_PAGE 0xA5000000 22 | /* set page program mode */ 23 | #define FLASH_CMD_PAGE_PROGRAM 0xB4000000 24 | /* set status mode */ 25 | #define FLASH_CMD_STATUS 0xD2000000 26 | /* set silicon id mode */ 27 | #define FLASH_CMD_ID 0xE1000000 28 | /* set read mode */ 29 | #define FLASH_CMD_READ_ARRAY 0xF0000000 30 | 31 | extern OSIoMesg __osFlashMsg; 32 | extern OSMesgQueue __osFlashMessageQ; 33 | extern OSPiHandle __osFlashHandler; 34 | extern OSMesg __osFlashMsgBuf[1]; 35 | extern s32 __osFlashVersion; 36 | extern u32 __osFlashID[4]; 37 | 38 | u32 __osFlashGetAddr(u32 page_num); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_align.c: -------------------------------------------------------------------------------- 1 | GLOBAL_ASM( 2 | .late_rodata 3 | .float 4.1 4 | .float 4.2 5 | .float 4.3 6 | .float 4.4 7 | .text 8 | glabel a 9 | nop 10 | nop 11 | nop 12 | nop 13 | nop 14 | nop 15 | nop 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | nop 23 | nop 24 | nop 25 | ) 26 | 27 | float foo(void) { "foo"; return 1.1f; } 28 | 29 | GLOBAL_ASM( 30 | .late_rodata 31 | .late_rodata_alignment 4 32 | .float 5.1 33 | .float 5.2 34 | .float 5.3 35 | .float 5.4 36 | .text 37 | glabel b 38 | nop 39 | nop 40 | nop 41 | nop 42 | nop 43 | nop 44 | nop 45 | nop 46 | nop 47 | nop 48 | nop 49 | nop 50 | nop 51 | ) 52 | 53 | float bar(void) { "bar"; return 1.2f; } 54 | 55 | GLOBAL_ASM( 56 | .late_rodata 57 | .late_rodata_alignment 8 58 | .float 6.1 59 | .float 6.2 60 | .float 6.3 61 | .float 6.4 62 | .float 6.5 63 | .text 64 | glabel c 65 | nop 66 | nop 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | nop 76 | nop 77 | nop 78 | nop 79 | ) 80 | 81 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_doubles_mips1.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | // COMPILE-ISET: -mips1 3 | // exact copy of late_rodata_doubles.c except for the -mips1 -O2 additions 4 | GLOBAL_ASM( 5 | .late_rodata 6 | .float 4.1 7 | .text 8 | glabel a 9 | nop 10 | nop 11 | nop 12 | nop 13 | nop 14 | nop 15 | nop 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | nop 23 | nop 24 | nop 25 | ) 26 | 27 | float foo(void) { 28 | return 4.15f; 29 | } 30 | 31 | GLOBAL_ASM( 32 | .late_rodata 33 | .float 4.2 34 | .word 0 35 | .double 4.3 36 | .text 37 | glabel b 38 | nop 39 | nop 40 | nop 41 | nop 42 | nop 43 | nop 44 | nop 45 | nop 46 | nop 47 | nop 48 | nop 49 | nop 50 | nop 51 | nop 52 | nop 53 | nop 54 | ) 55 | 56 | float bar(void) { 57 | return 4.4f; 58 | } 59 | 60 | GLOBAL_ASM( 61 | .late_rodata 62 | .float 4.55 63 | .double 4.6 64 | .text 65 | glabel c 66 | nop 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | nop 76 | nop 77 | nop 78 | nop 79 | nop 80 | nop 81 | nop 82 | ) 83 | 84 | float baz(void) { 85 | return 4.6f; 86 | } 87 | -------------------------------------------------------------------------------- /tools/asmproc/prelude.inc: -------------------------------------------------------------------------------- 1 | .set noat 2 | .set noreorder 3 | .set gp=64 4 | 5 | .macro glabel label 6 | .global \label 7 | \label: 8 | .endm 9 | 10 | .macro dlabel label 11 | .global \label 12 | \label: 13 | .endm 14 | 15 | .macro jlabel label 16 | \label: 17 | .endm 18 | 19 | 20 | # Float register aliases (o32 ABI, odd ones are rarely used) 21 | 22 | .set $fv0, $f0 23 | .set $fv0f, $f1 24 | .set $fv1, $f2 25 | .set $fv1f, $f3 26 | .set $ft0, $f4 27 | .set $ft0f, $f5 28 | .set $ft1, $f6 29 | .set $ft1f, $f7 30 | .set $ft2, $f8 31 | .set $ft2f, $f9 32 | .set $ft3, $f10 33 | .set $ft3f, $f11 34 | .set $fa0, $f12 35 | .set $fa0f, $f13 36 | .set $fa1, $f14 37 | .set $fa1f, $f15 38 | .set $ft4, $f16 39 | .set $ft4f, $f17 40 | .set $ft5, $f18 41 | .set $ft5f, $f19 42 | .set $fs0, $f20 43 | .set $fs0f, $f21 44 | .set $fs1, $f22 45 | .set $fs1f, $f23 46 | .set $fs2, $f24 47 | .set $fs2f, $f25 48 | .set $fs3, $f26 49 | .set $fs3f, $f27 50 | .set $fs4, $f28 51 | .set $fs4f, $f29 52 | .set $fs5, $f30 53 | .set $fs5f, $f31 54 | -------------------------------------------------------------------------------- /tools/asmproc/LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /tools/asmproc/tests/test2.c: -------------------------------------------------------------------------------- 1 | const char buf1[1] = {1}; 2 | float func1(void) { 3 | "func1"; 4 | return 0.1f; 5 | } 6 | const char buf2[1] = {2}; 7 | void func2(void) { 8 | *(volatile float*)0 = -3.5792360305786133f; 9 | *(volatile float*)0 = -3.5792362689971924f; 10 | // "func2"; 11 | // return 0.2f; 12 | } 13 | const char buf3[1] = {3}; 14 | int func3(int x) { 15 | switch(x) { 16 | case 0: 17 | return 1; 18 | case 1: 19 | return 2; 20 | case 2: 21 | return 3; 22 | case 3: 23 | return 4; 24 | case 4: 25 | return 5; 26 | case 5: 27 | return 4; 28 | case 6: 29 | return 4; 30 | case 7: 31 | return 4; 32 | default: 33 | return 3; 34 | } 35 | } 36 | 37 | #if 1 38 | GLOBAL_ASM( 39 | .rdata 40 | .word 0x66756e63 # func 41 | .word 0x34000000 # 4\0\0\0 42 | .word jumptarget + 4 43 | 44 | .late_rodata 45 | glabel rv 46 | .word 0x3e4ccccd # 0.2f 47 | .word jumptarget + 8 48 | 49 | .text 50 | glabel func4 51 | lui $at, %hi(rv) 52 | glabel jumptarget 53 | jr $ra 54 | lwc1 $f0, %lo(rv)($at) 55 | jr $ra 56 | nop 57 | jr $ra 58 | nop 59 | jr $ra 60 | nop 61 | jr $ra 62 | nop 63 | ) 64 | #else 65 | float func4(void) { 66 | "func4"; 67 | return 0.2f; 68 | } 69 | #endif 70 | -------------------------------------------------------------------------------- /tools/asmproc/tests/ascii.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/ascii.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000030 .text 6 | 00000000 l d .rodata 00000050 .rodata 7 | 00000000 g F .text 00000010 foo 8 | 00000010 g F .text 00000010 bar 9 | 00000020 g F .text 00000010 baz 10 | 11 | 12 | Contents of section .text: 13 | 0000 03e00008 00000000 03e00008 00000000 ................ 14 | 0010 03e00008 00000000 03e00008 00000000 ................ 15 | 0020 03e00008 00000000 03e00008 00000000 ................ 16 | Contents of section .rodata: 17 | 0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH 18 | 0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ 19 | 0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3 20 | 0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$ 21 | 0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl.. 22 | Contents of section .options: 23 | 0000 01200000 00000000 80000000 00000000 . .............. 24 | 0010 00000000 00000000 00000000 00007ff0 ................ 25 | 0020 07100000 00000000 00000000 00000000 ................ 26 | 0030 08100000 00000000 00000000 00000000 ................ 27 | Contents of section .reginfo: 28 | 0000 80000000 00000000 00000000 00000000 ................ 29 | 0010 00000000 00007ff0 ........ 30 | -------------------------------------------------------------------------------- /include/PR/rmon.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /************************************************************************** 14 | * 15 | * $Revision: 1.6 $ 16 | * $Date: 1997/02/11 08:30:08 $ 17 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rmon.h,v $ 18 | * 19 | **************************************************************************/ 20 | 21 | #ifndef _RMON_H_ 22 | #define _RMON_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | #define RMON_DBG_BUF_SIZE 2048 30 | #define RMON_STACKSIZE 0x1000 31 | 32 | extern void rmonMain( void * ); 33 | extern void rmonPrintf( const char *, ... ); 34 | 35 | #ifdef _LANGUAGE_C_PLUS_PLUS 36 | } 37 | #endif 38 | 39 | #endif /* !_OS_H */ 40 | -------------------------------------------------------------------------------- /tools/asmproc/tests/line-continuation.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/line-continuation.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000030 .text 6 | 00000000 l d .rodata 00000060 .rodata 7 | 00000000 g F .text 00000010 foo 8 | 00000010 g F .text 00000010 bar 9 | 00000020 g F .text 00000010 baz 10 | 11 | 12 | Contents of section .text: 13 | 0000 03e00008 00000000 03e00008 00000000 ................ 14 | 0010 03e00008 00000000 03e00008 00000000 ................ 15 | 0020 03e00008 00000000 03e00008 00000000 ................ 16 | Contents of section .rodata: 17 | 0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH 18 | 0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ 19 | 0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3 20 | 0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$ 21 | 0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl.. 22 | 0050 310a3200 33340035 36000000 00000000 1.2.34.56....... 23 | Contents of section .options: 24 | 0000 01200000 00000000 80000000 00000000 . .............. 25 | 0010 00000000 00000000 00000000 00007ff0 ................ 26 | 0020 07100000 00000000 00000000 00000000 ................ 27 | 0030 08100000 00000000 00000000 00000000 ................ 28 | Contents of section .reginfo: 29 | 0000 80000000 00000000 00000000 00000000 ................ 30 | 0010 00000000 00007ff0 ........ 31 | -------------------------------------------------------------------------------- /include/PR/os_internal_thread.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_thread.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:13 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_THREAD_H_ 22 | #define _OS_INTERNAL_THREAD_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* For debugger use */ 33 | 34 | extern OSThread * __osGetActiveQueue(void); 35 | 36 | 37 | #endif /* _LANGUAGE_C */ 38 | 39 | #ifdef _LANGUAGE_C_PLUS_PLUS 40 | } 41 | #endif 42 | 43 | #endif /* !_OS_INTERNAL_THREAD_H */ 44 | -------------------------------------------------------------------------------- /include/PR/os_internal_host.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_host.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:11 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_HOST_H_ 22 | #define _OS_INTERNAL_HOST_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* routine for rdb port */ 33 | extern u32 __osRdbSend(u8 *buf, u32 size, u32 type); 34 | 35 | 36 | #endif /* _LANGUAGE_C */ 37 | 38 | #ifdef _LANGUAGE_C_PLUS_PLUS 39 | } 40 | #endif 41 | 42 | #endif /* !_OS_INTERNAL_HOST_H */ 43 | -------------------------------------------------------------------------------- /include/PR/os_internal_debug.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_debug.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:09 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_DEBUG_H_ 22 | #define _OS_INTERNAL_DEBUG_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Debug port */ 33 | extern void __osSyncPutChars(int, int, const char *); 34 | extern int __osAtomicDec(unsigned int *p); 35 | 36 | 37 | #endif /* _LANGUAGE_C */ 38 | 39 | #ifdef _LANGUAGE_C_PLUS_PLUS 40 | } 41 | #endif 42 | 43 | #endif /* !_OS_INTERNAL_DEBUG_H */ 44 | -------------------------------------------------------------------------------- /include/PR/os_internal_gio.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_gio.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:11 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_GIO_H_ 22 | #define _OS_INTERNAL_GIO_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Development board functions */ 33 | 34 | extern void __osGIOInit(s32); 35 | extern void __osGIOInterrupt(s32); 36 | extern void __osGIORawInterrupt(s32); 37 | 38 | 39 | #endif /* _LANGUAGE_C */ 40 | 41 | #ifdef _LANGUAGE_C_PLUS_PLUS 42 | } 43 | #endif 44 | 45 | #endif /* !_OS_INTERNAL_GIO_H */ 46 | -------------------------------------------------------------------------------- /include/PR/os_internal_error.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_error.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:10 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_ERROR_H_ 22 | #define _OS_INTERNAL_ERROR_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Error handling */ 33 | 34 | extern void __osError(s16, s16, ...); 35 | extern OSThread * __osGetCurrFaultedThread(void); 36 | extern OSThread * __osGetNextFaultedThread(OSThread *); 37 | 38 | 39 | #endif /* _LANGUAGE_C */ 40 | 41 | #ifdef _LANGUAGE_C_PLUS_PLUS 42 | } 43 | #endif 44 | 45 | #endif /* !_OS_INTERNAL_ERROR_H */ 46 | -------------------------------------------------------------------------------- /include/PR/os_internal_si.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_si.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:13 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_SI_H_ 22 | #define _OS_INTERNAL_SI_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Serial interface (Si) */ 33 | 34 | extern u32 __osSiGetStatus(void); 35 | extern s32 __osSiRawWriteIo(u32, u32); 36 | extern s32 __osSiRawReadIo(u32, u32 *); 37 | extern s32 __osSiRawStartDma(s32, void *); 38 | 39 | 40 | #endif /* _LANGUAGE_C */ 41 | 42 | #ifdef _LANGUAGE_C_PLUS_PLUS 43 | } 44 | #endif 45 | 46 | #endif /* !_OS_INTERNAL_SI_H */ 47 | -------------------------------------------------------------------------------- /include/PR/os_internal_tlb.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_tlb.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:14 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_TLB_H_ 22 | #define _OS_INTERNAL_TLB_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Routines for fetch TLB info */ 33 | 34 | extern u32 __osGetTLBASID(void); 35 | extern u32 __osGetTLBPageMask(s32); 36 | extern u32 __osGetTLBHi(s32); 37 | extern u32 __osGetTLBLo0(s32); 38 | extern u32 __osGetTLBLo1(s32); 39 | 40 | 41 | #endif /* _LANGUAGE_C */ 42 | 43 | #ifdef _LANGUAGE_C_PLUS_PLUS 44 | } 45 | #endif 46 | 47 | #endif /* !_OS_INTERNAL_TLB_H */ 48 | -------------------------------------------------------------------------------- /tools/asmproc/tests/o2.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/o2.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000050 .text 6 | 00000000 l d .rodata 00000010 .rodata 7 | 00000000 g F .text 00000008 a 8 | 0000001c g F .text 0000000c b 9 | 0000003c g F .text 0000000c c 10 | 00000008 g F .text 00000014 foo 11 | 00000028 g F .text 00000014 bar 12 | 00000004 g .rodata 00000000 float1 13 | 14 | 15 | RELOCATION RECORDS FOR [.text]: 16 | OFFSET TYPE VALUE 17 | 0000001c R_MIPS_HI16 .rodata 18 | 00000024 R_MIPS_LO16 .rodata 19 | 0000003c R_MIPS_HI16 .rodata 20 | 00000044 R_MIPS_LO16 .rodata 21 | 00000030 R_MIPS_HI16 float1 22 | 00000038 R_MIPS_LO16 float1 23 | 24 | 25 | Contents of section .text: 26 | 0000 03e00008 24020001 24840001 24840002 ....$...$...$... 27 | 0010 24840003 03e00008 24840004 3c010000 $.......$...<... 28 | 0020 03e00008 c4200000 24840005 24840006 ..... ..$...$... 29 | 0030 3c020000 03e00008 24420001 3c010000 <.......$B..<... 30 | 0040 03e00008 c4200008 00000000 00000000 ..... .......... 31 | Contents of section .rodata: 32 | 0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff.... 33 | Contents of section .options: 34 | 0000 01200000 00000000 80000006 00000000 . .............. 35 | 0010 00000011 00000000 00000000 00007ff0 ................ 36 | 0020 07100000 00000000 00000000 00000000 ................ 37 | 0030 08100000 00000000 00000000 00000000 ................ 38 | Contents of section .reginfo: 39 | 0000 80000016 00000000 00000011 00000000 ................ 40 | 0010 00000000 00007ff0 ........ 41 | -------------------------------------------------------------------------------- /include/PR/os_internal_rsp.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_rsp.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:12 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_RSP_H_ 22 | #define _OS_INTERNAL_RSP_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Signal processor interface (Sp) */ 33 | 34 | extern u32 __osSpGetStatus(void); 35 | extern void __osSpSetStatus(u32); 36 | extern s32 __osSpSetPc(u32); 37 | extern s32 __osSpRawWriteIo(u32, u32); 38 | extern s32 __osSpRawReadIo(u32, u32 *); 39 | extern s32 __osSpRawStartDma(s32, u32, void *, u32); 40 | 41 | 42 | #endif /* _LANGUAGE_C */ 43 | 44 | #ifdef _LANGUAGE_C_PLUS_PLUS 45 | } 46 | #endif 47 | 48 | #endif /* !_OS_INTERNAL_RSP_H */ 49 | -------------------------------------------------------------------------------- /include/PR/os_internal.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal.h,v $ 17 | $Revision: 1.20 $ 18 | $Date: 1998/10/09 08:01:09 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_H_ 22 | #define _OS_INTERNAL_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | #include "os_internal_reg.h" 33 | #include "os_internal_exception.h" 34 | #include "os_internal_tlb.h" 35 | #include "os_internal_si.h" 36 | #include "os_internal_rsp.h" 37 | #include "os_internal_error.h" 38 | #include "os_internal_gio.h" 39 | #include "os_internal_thread.h" 40 | #include "os_internal_debug.h" 41 | #include "os_internal_host.h" 42 | 43 | #endif /* _LANGUAGE_C */ 44 | 45 | #ifdef _LANGUAGE_C_PLUS_PLUS 46 | } 47 | #endif 48 | 49 | #endif /* !_OS_INTERNAL_H */ 50 | -------------------------------------------------------------------------------- /include/ultra64.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************** 3 | * * 4 | * Copyright (C) 1994, Silicon Graphics, Inc. * 5 | * * 6 | * These coded instructions, statements, and computer programs contain * 7 | * unpublished proprietary information of Silicon Graphics, Inc., and * 8 | * are protected by Federal copyright law. They may not be disclosed * 9 | * to third parties or copied or duplicated in any form, in whole or * 10 | * in part, without the prior written consent of Silicon Graphics, Inc. * 11 | * * 12 | *************************************************************************/ 13 | 14 | /************************************************************************** 15 | * 16 | * $Revision: 1.10 $ 17 | * $Date: 1997/02/11 08:37:33 $ 18 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultra64.h,v $ 19 | * 20 | **************************************************************************/ 21 | 22 | #ifndef _ULTRA64_H_ 23 | #define _ULTRA64_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "macros.h" 41 | #include "variables.h" 42 | #include "functions.h" 43 | 44 | #include "sections.h" 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /tools/asmproc/tests/pascal.p: -------------------------------------------------------------------------------- 1 | { COMPILE-FLAGS: -O2 } 2 | 3 | function foo(x: integer): integer; 4 | begin 5 | foo := x * 3 6 | end; 7 | 8 | GLOBAL_ASM( 9 | .section .data 10 | .word 0x2323 11 | 12 | .late_rodata 13 | .word 0x123123 14 | .word 0x456456 15 | .word 0x789789 16 | .text 17 | glabel test 18 | /* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 19 | /* 000094 00400094 18A00009 */ blez $a1, .L004000BC 20 | /* 000098 00400098 AFA00004 */ sw $zero, 4($sp) 21 | .L0040009C: 22 | /* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) 23 | /* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 24 | /* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) 25 | /* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) 26 | /* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 27 | /* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 28 | /* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C 29 | /* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) 30 | .L004000BC: 31 | /* 0000BC 004000BC 10000001 */ b .L004000C4 32 | /* 0000C0 004000C0 00000000 */ nop 33 | .L004000C4: 34 | /* 0000C4 004000C4 03E00008 */ jr $ra 35 | /* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 36 | ) 37 | 38 | GLOBAL_ASM( 39 | .section .data 40 | .word 0x3434 41 | 42 | .late_rodata 43 | .word 0x1 44 | .double 1.1 45 | .word 0x2, 0x3 46 | .text 47 | glabel test2 48 | nop 49 | nop 50 | nop 51 | nop 52 | nop 53 | nop 54 | nop 55 | nop 56 | nop 57 | nop 58 | nop 59 | nop 60 | nop 61 | nop 62 | nop 63 | nop 64 | nop 65 | ) 66 | 67 | GLOBAL_ASM( 68 | .late_rodata 69 | .double 2.1 70 | .text 71 | glabel test3 72 | nop 73 | nop 74 | nop 75 | nop 76 | nop 77 | nop 78 | nop 79 | nop 80 | nop 81 | nop 82 | nop 83 | nop 84 | nop 85 | nop 86 | nop 87 | nop 88 | nop 89 | ) 90 | 91 | function bar(x: integer): integer; 92 | begin 93 | return x * 3 94 | end; 95 | 96 | -------------------------------------------------------------------------------- /tools/asmproc/tests/o0.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/o0.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000090 .text 6 | 00000000 l d .rodata 00000010 .rodata 7 | 00000000 g F .text 0000001c a 8 | 00000030 g F .text 00000020 b 9 | 0000006c g F .text 00000020 c 10 | 0000001c g F .text 00000014 foo 11 | 00000050 g F .text 0000001c bar 12 | 00000004 g .rodata 00000000 float1 13 | 14 | 15 | RELOCATION RECORDS FOR [.text]: 16 | OFFSET TYPE VALUE 17 | 00000030 R_MIPS_HI16 .rodata 18 | 00000034 R_MIPS_LO16 .rodata 19 | 0000006c R_MIPS_HI16 .rodata 20 | 00000070 R_MIPS_LO16 .rodata 21 | 00000060 R_MIPS_HI16 float1 22 | 00000068 R_MIPS_LO16 float1 23 | 24 | 25 | Contents of section .text: 26 | 0000 24020001 03e00008 00000000 03e00008 $............... 27 | 0010 00000000 03e00008 00000000 24840001 ............$... 28 | 0020 24840002 24840003 03e00008 24840004 $...$.......$... 29 | 0030 3c010000 c4200000 03e00008 00000000 <.... .......... 30 | 0040 03e00008 00000000 03e00008 00000000 ................ 31 | 0050 24840005 24840006 24840007 24840008 $...$...$...$... 32 | 0060 3c020000 03e00008 24420001 3c010000 <.......$B..<... 33 | 0070 c4200008 03e00008 00000000 03e00008 . .............. 34 | 0080 00000000 03e00008 00000000 00000000 ................ 35 | Contents of section .rodata: 36 | 0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff.... 37 | Contents of section .options: 38 | 0000 01200000 00000000 80000006 00000000 . .............. 39 | 0010 00000011 00000000 00000000 00007ff0 ................ 40 | 0020 07100000 00000000 00000000 00000000 ................ 41 | 0030 08100000 00000000 00000000 00000000 ................ 42 | Contents of section .reginfo: 43 | 0000 80000016 00000000 00000011 00000000 ................ 44 | 0010 00000000 00007ff0 ........ 45 | -------------------------------------------------------------------------------- /src/10D0.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // compiled with -O3. huh? 4 | 5 | extern void* D_8001C3C0; 6 | extern OSMesgQueue D_8001C3E0; 7 | extern s32 D_8001C3F8; 8 | extern OSIoMesg D_8001C400; 9 | extern OSMesgQueue D_8001C418; 10 | extern s32 D_8001C430; 11 | 12 | void func_80000794(void) { 13 | D_8001C3F8 = 0; 14 | osCreatePiManager(0x96, &D_8001C3E0, &D_8001C3C0, 8); 15 | func_80001D90(&D_8001C418, &D_8001C430, 1); 16 | } 17 | 18 | void func_80000768(void) { 19 | osRecvMesg(&D_8001C418, NULL, 0); 20 | } 21 | 22 | void load_from_rom_to_addr(void* arg0, s32 arg1, u32 arg2) { 23 | if (D_8001C3F8 != 0) { 24 | do { 25 | osYieldThread(); 26 | } while (D_8001C3F8 != 0); 27 | } 28 | D_8001C3F8 = 1; 29 | osWritebackDCache(arg0, arg1); 30 | osInvalDCache(arg0, arg1); 31 | osInvalICache(arg0, arg1); 32 | osPiStartDma(&D_8001C400, 0, 0, arg2, arg0, (u32) arg1, &D_8001C418); 33 | osRecvMesg(&D_8001C418, NULL, 1); 34 | D_8001C3F8 = 0; 35 | } 36 | 37 | void func_8000064C(void* arg0, u32 arg1, u32 arg2) { 38 | osPiStartDma(&D_8001C400, 0, 0, arg2, arg0, arg1, &D_8001C418); 39 | } 40 | 41 | void func_8000059C(s32 arg0, u32 arg1, void* arg2) { 42 | if (D_8001C3F8 != 0) { 43 | do { 44 | osYieldThread(); 45 | } while (D_8001C3F8 != 0); 46 | } 47 | D_8001C3F8 = 1; 48 | osWritebackDCache(arg2, arg0); 49 | osPiStartDma(&D_8001C400, 0, 1, (u32) arg0, arg2, arg1, &D_8001C418); 50 | osRecvMesg(&D_8001C418, NULL, 1); 51 | D_8001C3F8 = 0; 52 | } 53 | 54 | void func_80000570(void) { 55 | osRecvMesg(&D_8001C418, NULL, 1); 56 | } 57 | 58 | void func_80000524(u32 arg0, u32 arg1, void* arg2) { 59 | osPiStartDma(&D_8001C400, 0, 1, arg0, arg2, arg1, &D_8001C418); 60 | } 61 | 62 | void func_800004D0(void* arg0, u32 arg1, u32 arg2, s32 arg3) { 63 | osPiStartDma(&D_8001C400, 0, arg3, arg2, arg0, arg1, &D_8001C418); 64 | } 65 | -------------------------------------------------------------------------------- /tools/asmproc/tests/kpic-o2.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 -KPIC 2 | GLOBAL_ASM( 3 | glabel foo 4 | addiu $a0, $a0, 1 5 | addiu $a0, $a0, 2 6 | addiu $a0, $a0, 3 7 | addiu $a0, $a0, 4 8 | addiu $a0, $a0, 5 9 | addiu $a0, $a0, 6 10 | addiu $a0, $a0, 7 11 | addiu $a0, $a0, 8 12 | addiu $a0, $a0, 9 13 | addiu $a0, $a0, 10 14 | addiu $a0, $a0, 11 15 | addiu $a0, $a0, 12 16 | ) 17 | GLOBAL_ASM( 18 | .late_rodata 19 | .float 1 20 | .text 21 | glabel float_fn 22 | addiu $a0, $a0, 13 23 | addiu $a0, $a0, 14 24 | addiu $a0, $a0, 15 25 | addiu $a0, $a0, 16 26 | addiu $a0, $a0, 17 27 | addiu $a0, $a0, 18 28 | addiu $a0, $a0, 19 29 | addiu $a0, $a0, 20 30 | addiu $a0, $a0, 21 31 | addiu $a0, $a0, 22 32 | addiu $a0, $a0, 23 33 | addiu $a0, $a0, 24 34 | addiu $a0, $a0, 25 35 | addiu $a0, $a0, 26 36 | addiu $a0, $a0, 27 37 | addiu $a0, $a0, 28 38 | addiu $a0, $a0, 29 39 | addiu $a0, $a0, 30 40 | ) 41 | GLOBAL_ASM( 42 | .late_rodata 43 | .float 2 44 | .double 1 45 | .double 2 46 | .double 3 47 | .double 4 48 | .double 5 49 | .double 6 50 | .double 7 51 | .double 8 52 | .text 53 | glabel doubles 54 | addiu $a0, $a0, 31 55 | addiu $a0, $a0, 32 56 | addiu $a0, $a0, 33 57 | addiu $a0, $a0, 34 58 | addiu $a0, $a0, 35 59 | addiu $a0, $a0, 36 60 | addiu $a0, $a0, 37 61 | addiu $a0, $a0, 38 62 | addiu $a0, $a0, 39 63 | addiu $a0, $a0, 40 64 | addiu $a0, $a0, 41 65 | addiu $a0, $a0, 42 66 | addiu $a0, $a0, 43 67 | addiu $a0, $a0, 44 68 | addiu $a0, $a0, 45 69 | addiu $a0, $a0, 46 70 | addiu $a0, $a0, 47 71 | addiu $a0, $a0, 48 72 | addiu $a0, $a0, 49 73 | addiu $a0, $a0, 50 74 | addiu $a0, $a0, 51 75 | addiu $a0, $a0, 52 76 | addiu $a0, $a0, 53 77 | addiu $a0, $a0, 54 78 | addiu $a0, $a0, 55 79 | addiu $a0, $a0, 56 80 | addiu $a0, $a0, 57 81 | addiu $a0, $a0, 58 82 | addiu $a0, $a0, 59 83 | addiu $a0, $a0, 60 84 | addiu $a0, $a0, 61 85 | addiu $a0, $a0, 62 86 | addiu $a0, $a0, 63 87 | addiu $a0, $a0, 64 88 | addiu $a0, $a0, 65 89 | addiu $a0, $a0, 66 90 | addiu $a0, $a0, 67 91 | addiu $a0, $a0, 68 92 | ) 93 | -------------------------------------------------------------------------------- /tools/asmproc/tests/kpic-o1.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O1 -KPIC 2 | GLOBAL_ASM( 3 | glabel foo 4 | addiu $a0, $a0, 1 5 | addiu $a0, $a0, 2 6 | addiu $a0, $a0, 3 7 | addiu $a0, $a0, 4 8 | addiu $a0, $a0, 5 9 | addiu $a0, $a0, 6 10 | addiu $a0, $a0, 7 11 | addiu $a0, $a0, 8 12 | addiu $a0, $a0, 9 13 | addiu $a0, $a0, 10 14 | addiu $a0, $a0, 11 15 | addiu $a0, $a0, 12 16 | ) 17 | GLOBAL_ASM( 18 | .late_rodata 19 | .float 1 20 | .text 21 | glabel float_fn 22 | addiu $a0, $a0, 13 23 | addiu $a0, $a0, 14 24 | addiu $a0, $a0, 15 25 | addiu $a0, $a0, 16 26 | addiu $a0, $a0, 17 27 | addiu $a0, $a0, 18 28 | addiu $a0, $a0, 19 29 | addiu $a0, $a0, 20 30 | addiu $a0, $a0, 21 31 | addiu $a0, $a0, 22 32 | addiu $a0, $a0, 23 33 | addiu $a0, $a0, 24 34 | addiu $a0, $a0, 25 35 | addiu $a0, $a0, 26 36 | addiu $a0, $a0, 27 37 | addiu $a0, $a0, 28 38 | addiu $a0, $a0, 29 39 | addiu $a0, $a0, 30 40 | ) 41 | GLOBAL_ASM( 42 | .late_rodata 43 | .late_rodata_alignment 4 44 | .float 2 45 | .double 1 46 | .double 2 47 | .double 3 48 | .double 4 49 | .double 5 50 | .double 6 51 | .double 7 52 | .double 8 53 | .text 54 | glabel doubles 55 | addiu $a0, $a0, 31 56 | addiu $a0, $a0, 32 57 | addiu $a0, $a0, 33 58 | addiu $a0, $a0, 34 59 | addiu $a0, $a0, 35 60 | addiu $a0, $a0, 36 61 | addiu $a0, $a0, 37 62 | addiu $a0, $a0, 38 63 | addiu $a0, $a0, 39 64 | addiu $a0, $a0, 40 65 | addiu $a0, $a0, 41 66 | addiu $a0, $a0, 42 67 | addiu $a0, $a0, 43 68 | addiu $a0, $a0, 44 69 | addiu $a0, $a0, 45 70 | addiu $a0, $a0, 46 71 | addiu $a0, $a0, 47 72 | addiu $a0, $a0, 48 73 | addiu $a0, $a0, 49 74 | addiu $a0, $a0, 50 75 | addiu $a0, $a0, 51 76 | addiu $a0, $a0, 52 77 | addiu $a0, $a0, 53 78 | addiu $a0, $a0, 54 79 | addiu $a0, $a0, 55 80 | addiu $a0, $a0, 56 81 | addiu $a0, $a0, 57 82 | addiu $a0, $a0, 58 83 | addiu $a0, $a0, 59 84 | addiu $a0, $a0, 60 85 | addiu $a0, $a0, 61 86 | addiu $a0, $a0, 62 87 | addiu $a0, $a0, 63 88 | addiu $a0, $a0, 64 89 | addiu $a0, $a0, 65 90 | addiu $a0, $a0, 66 91 | addiu $a0, $a0, 67 92 | addiu $a0, $a0, 68 93 | ) 94 | -------------------------------------------------------------------------------- /tools/asmproc/tests/force.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/force.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000050 .text 6 | 00000000 l d .rodata 00000010 .rodata 7 | 00000000 l d .data 00000010 .data 8 | 00000000 l d .bss 00000010 .bss 9 | 00000000 g O .rodata 00000004 rodata1 10 | 00000000 g O .data 00000004 data1 11 | 00000000 g O .bss 00000004 bss1 12 | 00000014 g F .text 00000034 baz 13 | 00000004 g O .rodata 00000000 tests/force.o:rodata2 14 | 00000004 g O .data 00000000 tests/force.o:data2 15 | 00000004 g O .bss 00000000 tests/force.o:bss2 16 | 00000000 g F .text 00000000 tests/force.o:xtext 17 | 18 | 19 | RELOCATION RECORDS FOR [.text]: 20 | OFFSET TYPE VALUE 21 | 0000001c R_MIPS_HI16 .bss 22 | 00000034 R_MIPS_LO16 .bss 23 | 00000020 R_MIPS_HI16 .rodata 24 | 0000002c R_MIPS_LO16 .rodata 25 | 00000024 R_MIPS_HI16 .data 26 | 00000028 R_MIPS_LO16 .data 27 | 00000030 R_MIPS_26 .text 28 | 29 | 30 | Contents of section .text: 31 | 0000 afa40000 afa50004 afa60008 03e00008 ................ 32 | 0010 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... 33 | 0020 3c050000 3c060000 8cc60004 8ca50004 <...<........... 34 | 0030 0c000000 8c840004 8fbf0014 27bd0018 ............'... 35 | 0040 03e00008 00000000 00000000 00000000 ................ 36 | Contents of section .rodata: 37 | 0000 00000001 00000002 00000000 00000000 ................ 38 | Contents of section .data: 39 | 0000 00000003 00000004 00000000 00000000 ................ 40 | Contents of section .options: 41 | 0000 01200000 00000000 a0000074 00000000 . .........t.... 42 | 0010 00000000 00000000 00000000 00007ff0 ................ 43 | 0020 07100000 00000000 00000000 00000000 ................ 44 | 0030 08100000 00000000 00000000 00000000 ................ 45 | Contents of section .reginfo: 46 | 0000 a0000074 00000000 00000000 00000000 ...t............ 47 | 0010 00000000 00007ff0 ........ 48 | -------------------------------------------------------------------------------- /src/40300.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern s32 D_8029F5A0; 4 | extern s32 D_80300000; 5 | extern s32 D_802B36A4; 6 | 7 | s32 func_80225B00(s32 arg0) 8 | { 9 | s32 ret = D_8029F5A0; 10 | D_8029F5A0 += arg0; 11 | if ((D_8029F5A0 - (s32)&D_80300000) >= 0x100000) 12 | { 13 | return -1; 14 | } 15 | return ret; 16 | } 17 | 18 | UNUSED u8 *Libc_Strcat(u8 *str, u8 *str1) 19 | { 20 | u8 *ret; 21 | 22 | ret = str; 23 | 24 | while (*str != 0) 25 | { 26 | str++; 27 | } 28 | 29 | while (*(str++) = *(str1++)) 30 | ; 31 | 32 | return ret; 33 | } 34 | 35 | s32 Libc_Strlen(u8 *str) 36 | { 37 | s32 len = 0; 38 | u8 *sc = str; 39 | 40 | while (*sc != 0) 41 | { 42 | len++, 43 | sc++; 44 | } 45 | 46 | return len; 47 | } 48 | 49 | void *Libc_Memmove(void *dest, void *src, size_t len) 50 | { 51 | u8 *destp = dest; 52 | u8 *srcp = src; 53 | 54 | if ((len != 0) && (dest != src)) 55 | { 56 | if ((srcp < destp) && (destp < srcp + len)) 57 | { 58 | while (len--) 59 | { 60 | *(len + destp) = *(len + srcp); 61 | } 62 | } 63 | else 64 | { 65 | while (len--) 66 | { 67 | *destp++ = *srcp++; 68 | } 69 | } 70 | } 71 | 72 | return dest; 73 | } 74 | 75 | void *Libc_Memcpy(u8 *dest, u8 *source, s32 c) 76 | { 77 | u8 *d; 78 | u8 *s; 79 | 80 | d = dest; 81 | s = source; 82 | 83 | while (c--) 84 | { 85 | *(d++) = *(s)++; 86 | } 87 | 88 | return dest; 89 | } 90 | 91 | u8 *Libc_Memset(u8 *arg0, u8 *arg1, s32 arg2) 92 | { 93 | u8 *var_v0 = arg0; 94 | 95 | while (arg2--) 96 | { 97 | *(var_v0++) = arg1; 98 | } 99 | 100 | return arg0; 101 | } 102 | 103 | void func_80225CA8(void) 104 | { 105 | D_802B36A4 = 0; 106 | } 107 | -------------------------------------------------------------------------------- /include/PR/os_internal_reg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_reg.h,v $ 17 | $Revision: 1.2 $ 18 | $Date: 1999/03/10 12:19:14 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_REG_H_ 22 | #define _OS_INTERNAL_REG_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include "os.h" 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Routines to get/fetch coprocessor 0 registers */ 33 | extern u32 __osGetCause(void); 34 | extern void __osSetCause(u32); 35 | extern u32 __osGetCompare(void); 36 | extern void __osSetCompare(u32); 37 | extern u32 __osGetConfig(void); 38 | extern void __osSetConfig(u32); 39 | extern void __osSetCount(u32); 40 | extern u32 __osGetSR(void); 41 | extern void __osSetSR(u32); 42 | extern u32 __osDisableInt(void); 43 | extern void __osRestoreInt(u32); 44 | extern u32 __osGetWatchLo(void); 45 | extern void __osSetWatchLo(u32); 46 | 47 | /* Routines to get/set floating-point control and status register */ 48 | extern u32 __osSetFpcCsr(u32); 49 | extern u32 __osGetFpcCsr(void); 50 | 51 | #endif /* _LANGUAGE_C */ 52 | 53 | #ifdef _LANGUAGE_C_PLUS_PLUS 54 | } 55 | #endif 56 | 57 | #endif /* !_OS_INTERNAL_REG_H */ 58 | -------------------------------------------------------------------------------- /include/PR/os_motor.h: -------------------------------------------------------------------------------- 1 | 2 | /*---------------------------------------------------------------------* 3 | Copyright (C) 1998 Nintendo. 4 | 5 | $RCSfile: os_motor.h,v $ 6 | $Revision: 1.1 $ 7 | $Date: 1998/10/09 08:01:15 $ 8 | *---------------------------------------------------------------------*/ 9 | 10 | #ifndef _OS_MOTOR_H_ 11 | #define _OS_MOTOR_H_ 12 | 13 | #ifdef _LANGUAGE_C_PLUS_PLUS 14 | extern "C" { 15 | #endif 16 | 17 | #include 18 | #include "os_message.h" 19 | #include "os_pfs.h" 20 | #include "os_version.h" 21 | 22 | 23 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 24 | 25 | /************************************************************************** 26 | * 27 | * Type definitions 28 | * 29 | */ 30 | 31 | 32 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 33 | 34 | /************************************************************************** 35 | * 36 | * Global definitions 37 | * 38 | */ 39 | 40 | 41 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 42 | 43 | /************************************************************************** 44 | * 45 | * Macro definitions 46 | * 47 | */ 48 | 49 | 50 | /************************************************************************** 51 | * 52 | * Extern variables 53 | * 54 | */ 55 | 56 | 57 | /************************************************************************** 58 | * 59 | * Function prototypes 60 | * 61 | */ 62 | 63 | /* Rumble PAK interface */ 64 | 65 | extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int); 66 | #if BUILD_VERSION >= VERSION_J 67 | #define MOTOR_START 1 68 | #define MOTOR_STOP 0 69 | #define osMotorStart(x) __osMotorAccess((x), MOTOR_START) 70 | #define osMotorStop(x) __osMotorAccess((x), MOTOR_STOP) 71 | extern s32 __osMotorAccess(OSPfs *, s32); 72 | #else 73 | extern s32 osMotorStop(OSPfs *); 74 | extern s32 osMotorStart(OSPfs *); 75 | #endif 76 | 77 | 78 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 79 | 80 | #ifdef _LANGUAGE_C_PLUS_PLUS 81 | } 82 | #endif 83 | 84 | #endif /* !_OS_MOTOR_H_ */ 85 | -------------------------------------------------------------------------------- /include/PR/os_internal_exception.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /*---------------------------------------------------------------------* 14 | Copyright (C) 1998 Nintendo. (Originated by SGI) 15 | 16 | $RCSfile: os_internal_exception.h,v $ 17 | $Revision: 1.1 $ 18 | $Date: 1998/10/09 08:01:10 $ 19 | *---------------------------------------------------------------------*/ 20 | 21 | #ifndef _OS_INTERNAL_EXCEPTION_H_ 22 | #define _OS_INTERNAL_EXCEPTION_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include "os.h" 29 | #include "os_version.h" 30 | 31 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 32 | 33 | /* Routine for HW interrupt "handler" */ 34 | #if BUILD_VERSION >= VERSION_J 35 | extern void __osSetHWIntrRoutine(OSHWIntr interrupt, 36 | s32 (*handler)(void), void *stackEnd); 37 | extern void __osGetHWIntrRoutine(OSHWIntr interrupt, 38 | s32 (**handler)(void), void **stackEnd); 39 | #else 40 | extern void __osSetHWIntrRoutine(OSHWIntr interrupt, 41 | s32 (*handler)(void)); 42 | extern void __osGetHWIntrRoutine(OSHWIntr interrupt, 43 | s32 (**handler)(void)); 44 | #endif 45 | 46 | /* Routine for global interrupt mask */ 47 | extern void __osSetGlobalIntMask(OSHWIntr); 48 | extern void __osResetGlobalIntMask(OSHWIntr); 49 | 50 | 51 | #endif /* _LANGUAGE_C */ 52 | 53 | #ifdef _LANGUAGE_C_PLUS_PLUS 54 | } 55 | #endif 56 | 57 | #endif /* !_OS_INTERNAL_EXCEPTION_H */ 58 | -------------------------------------------------------------------------------- /tools/asmproc/tests/test1.c: -------------------------------------------------------------------------------- 1 | 2 | GLOBAL_ASM( 3 | .rdata 4 | .word 0x1212 5 | ) 6 | 7 | GLOBAL_ASM( 8 | .late_rodata 9 | .word 0x123123 10 | .text 11 | glabel test 12 | /* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 13 | /* 000094 00400094 18A00009 */ blez $a1, .L004000BC 14 | /* 000098 00400098 AFA00004 */ sw $zero, 4($sp) 15 | .L0040009C: 16 | /* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) 17 | /* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 18 | /* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) 19 | /* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) 20 | /* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 21 | /* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 22 | /* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C 23 | /* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) 24 | .L004000BC: 25 | /* 0000BC 004000BC 10000001 */ b .L004000C4 26 | /* 0000C0 004000C0 00000000 */ nop 27 | .L004000C4: 28 | /* 0000C4 004000C4 03E00008 */ jr $ra 29 | /* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 30 | ) 31 | 32 | char bss1[3]; 33 | GLOBAL_ASM( 34 | .bss 35 | bss2: 36 | .space 3 37 | ) 38 | char bss3[3]; 39 | char bss4[3]; 40 | const int rodata1[2] = {1}; 41 | extern int some_rodata; 42 | 43 | unsigned g(float, int); 44 | unsigned f(void) { 45 | return g(1.1f, some_rodata); 46 | } 47 | 48 | GLOBAL_ASM( 49 | .rdata 50 | glabel some_rodata 51 | .word 0x1313 52 | .text 53 | .late_rodata 54 | .word 0x321321 55 | .text 56 | glabel g 57 | /* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18 58 | /* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp) 59 | /* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4 60 | /* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100) 61 | /* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at) 62 | /* 0000D4 004000D4 0C10002C */ jal func_004000B0 63 | /* 0000D8 004000D8 00000000 */ nop 64 | /* 0000DC 004000DC 10000001 */ b .L004000E4 65 | /* 0000E0 004000E0 00000000 */ nop 66 | .L004000E4: 67 | /* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp) 68 | /* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18 69 | /* 0000EC 004000EC 03E00008 */ jr $ra 70 | /* 0000F0 004000F0 00000000 */ nop 71 | ) 72 | -------------------------------------------------------------------------------- /tools/asmproc/tests/test3.c: -------------------------------------------------------------------------------- 1 | 2 | GLOBAL_ASM( 3 | .rdata 4 | .word 321321 5 | .text 6 | glabel test 7 | /* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 8 | /* 000094 00400094 18A00009 */ blez $a1, .L004000BC 9 | /* 000098 00400098 AFA00004 */ sw $zero, 4($sp) 10 | .L0040009C: 11 | /* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) 12 | /* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 13 | /* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) 14 | /* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) 15 | /* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 16 | /* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 17 | /* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C 18 | /* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) 19 | .L004000BC: 20 | /* 0000BC 004000BC 10000001 */ b .L004000C4 21 | /* 0000C0 004000C0 00000000 */ nop 22 | .L004000C4: 23 | /* 0000C4 004000C4 03E00008 */ jr $ra 24 | /* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 25 | ) 26 | 27 | // static -> no symbols 28 | // bss 29 | char globalBuf[4]; 30 | const char constBuf[4]; 31 | 32 | // data 33 | char globalBufInit[4] = {1}; 34 | 35 | // rodata 36 | const char constBufInit[4] = {1}; 37 | const char constBufInit2[1] = {2}; 38 | const char constBufInit3[1] = {3}; 39 | 40 | unsigned g(void); 41 | unsigned f(void) { 42 | // aligns to 4 or 8 byte boundary (char -> 4, double -> 8) 43 | double x = 5.1; 44 | float y = 5.2f; 45 | float z = 5.3f; 46 | "Hello "; 47 | "World"; 48 | return g(); 49 | } 50 | 51 | GLOBAL_ASM( 52 | .rdata 53 | .word 123123 54 | .text 55 | glabel g 56 | /* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18 57 | /* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp) 58 | /* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4 59 | /* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100) 60 | /* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at) 61 | /* 0000D4 004000D4 0C10002C */ jal func_004000B0 62 | /* 0000D8 004000D8 00000000 */ nop 63 | /* 0000DC 004000DC 10000001 */ b .L004000E4 64 | /* 0000E0 004000E0 00000000 */ nop 65 | .L004000E4: 66 | /* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp) 67 | /* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18 68 | /* 0000EC 004000EC 03E00008 */ jr $ra 69 | /* 0000F0 004000F0 00000000 */ nop 70 | ) 71 | -------------------------------------------------------------------------------- /tools/asmproc/tests/kpic-o1.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/kpic-o1.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000110 .text 6 | 00000000 l d .rodata 00000050 .rodata 7 | 00000000 g F .text 00000030 foo 8 | 00000030 g F .text 00000048 float_fn 9 | 00000078 g F .text 00000098 doubles 10 | 00000000 O *UND* 00000000 _gp_disp 11 | 12 | 13 | RELOCATION RECORDS FOR [.text]: (none) 14 | 15 | Contents of section .text: 16 | 0000 24840001 24840002 24840003 24840004 $...$...$...$... 17 | 0010 24840005 24840006 24840007 24840008 $...$...$...$... 18 | 0020 24840009 2484000a 2484000b 2484000c $...$...$...$... 19 | 0030 2484000d 2484000e 2484000f 24840010 $...$...$...$... 20 | 0040 24840011 24840012 24840013 24840014 $...$...$...$... 21 | 0050 24840015 24840016 24840017 24840018 $...$...$...$... 22 | 0060 24840019 2484001a 2484001b 2484001c $...$...$...$... 23 | 0070 2484001d 2484001e 2484001f 24840020 $...$...$...$.. 24 | 0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$ 25 | 0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..( 26 | 00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$.., 27 | 00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0 28 | 00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4 29 | 00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8 30 | 00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..< 31 | 00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@ 32 | 0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D 33 | Contents of section .rodata: 34 | 0000 3f800000 40000000 3ff00000 00000000 ?...@...?....... 35 | 0010 40000000 00000000 40080000 00000000 @.......@....... 36 | 0020 40100000 00000000 40140000 00000000 @.......@....... 37 | 0030 40180000 00000000 401c0000 00000000 @.......@....... 38 | 0040 40200000 00000000 00000000 00000000 @ .............. 39 | Contents of section .options: 40 | 0000 01200000 00000000 92000002 00000000 . .............. 41 | 0010 000f0ff0 00000000 00000000 00000000 ................ 42 | 0020 07100000 00000000 00000000 00000000 ................ 43 | 0030 08100000 00000000 00000000 00000000 ................ 44 | Contents of section .reginfo: 45 | 0000 92000012 00000000 000f0ff0 00000000 ................ 46 | 0010 00000000 00000000 ........ 47 | -------------------------------------------------------------------------------- /tools/asmproc/tests/kpic-o2.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/kpic-o2.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000110 .text 6 | 00000000 l d .rodata 00000050 .rodata 7 | 00000000 g F .text 00000030 foo 8 | 00000030 g F .text 00000048 float_fn 9 | 00000078 g F .text 00000098 doubles 10 | 00000000 O *UND* 00000000 _gp_disp 11 | 12 | 13 | RELOCATION RECORDS FOR [.text]: (none) 14 | 15 | Contents of section .text: 16 | 0000 24840001 24840002 24840003 24840004 $...$...$...$... 17 | 0010 24840005 24840006 24840007 24840008 $...$...$...$... 18 | 0020 24840009 2484000a 2484000b 2484000c $...$...$...$... 19 | 0030 2484000d 2484000e 2484000f 24840010 $...$...$...$... 20 | 0040 24840011 24840012 24840013 24840014 $...$...$...$... 21 | 0050 24840015 24840016 24840017 24840018 $...$...$...$... 22 | 0060 24840019 2484001a 2484001b 2484001c $...$...$...$... 23 | 0070 2484001d 2484001e 2484001f 24840020 $...$...$...$.. 24 | 0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$ 25 | 0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..( 26 | 00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$.., 27 | 00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0 28 | 00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4 29 | 00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8 30 | 00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..< 31 | 00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@ 32 | 0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D 33 | Contents of section .rodata: 34 | 0000 3f800000 40000000 3ff00000 00000000 ?...@...?....... 35 | 0010 40000000 00000000 40080000 00000000 @.......@....... 36 | 0020 40100000 00000000 40140000 00000000 @.......@....... 37 | 0030 40180000 00000000 401c0000 00000000 @.......@....... 38 | 0040 40200000 00000000 00000000 00000000 @ .............. 39 | Contents of section .options: 40 | 0000 01200000 00000000 92000002 00000000 . .............. 41 | 0010 000f0ff0 00000000 00000000 00000000 ................ 42 | 0020 07100000 00000000 00000000 00000000 ................ 43 | 0030 08100000 00000000 00000000 00000000 ................ 44 | Contents of section .reginfo: 45 | 0000 92000012 00000000 000f0ff0 00000000 ................ 46 | 0010 00000000 00000000 ........ 47 | -------------------------------------------------------------------------------- /tools/asmproc/tests/test1.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/test1.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 000000b0 .text 6 | 00000000 l d .rodata 00000020 .rodata 7 | 00000000 l d .bss 00000010 .bss 8 | 00000000 g O .bss 00000003 bss1 9 | 00000008 g O .bss 00000003 bss3 10 | 0000000c g O .bss 00000003 bss4 11 | 00000004 g O .rodata 00000008 rodata1 12 | 0000003c g F .text 0000003c f 13 | 00000000 g F .text 0000003c test 14 | 0000000c g .rodata 00000000 some_rodata 15 | 00000078 g F .text 00000004 g 16 | 00000000 *UND* 00000000 D_410100 17 | 00000000 *UND* 00000000 func_004000B0 18 | 19 | 20 | RELOCATION RECORDS FOR [.text]: 21 | OFFSET TYPE VALUE 22 | 00000044 R_MIPS_HI16 .rodata 23 | 00000054 R_MIPS_LO16 .rodata 24 | 00000048 R_MIPS_HI16 some_rodata 25 | 0000004c R_MIPS_LO16 some_rodata 26 | 00000050 R_MIPS_26 g 27 | 00000084 R_MIPS_HI16 D_410100 28 | 00000088 R_MIPS_LO16 D_410100 29 | 0000008c R_MIPS_26 func_004000B0 30 | 31 | 32 | Contents of section .text: 33 | 0000 27bdffe8 18a00009 afa00004 8fae0004 '............... 34 | 0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'... 35 | 0020 0325082a 1420fff9 afb90004 10000001 .%.*. .......... 36 | 0030 00000000 03e00008 27bd0018 27bdffe8 ........'...'... 37 | 0040 afbf0014 3c010000 3c050000 8ca50000 ....<...<....... 38 | 0050 0c000000 c42c0014 10000003 00000000 .....,.......... 39 | 0060 10000001 00000000 8fbf0014 27bd0018 ............'... 40 | 0070 03e00008 00000000 27bdffe8 afbf0014 ........'....... 41 | 0080 240e0004 3c010000 ac2e0000 0c000000 $...<........... 42 | 0090 00000000 10000001 00000000 8fbf0014 ................ 43 | 00a0 27bd0018 03e00008 00000000 00000000 '............... 44 | Contents of section .rodata: 45 | 0000 00001212 00000001 00000000 00001313 ................ 46 | 0010 00123123 3f8ccccd 00321321 00000000 ..1#?....2.!.... 47 | Contents of section .options: 48 | 0000 01200000 00000000 a0000022 00000000 . .........".... 49 | 0010 00001010 00000000 00000000 00007ff0 ................ 50 | 0020 07100000 00000000 00000000 00000000 ................ 51 | 0030 08100000 00000000 00000000 00000000 ................ 52 | Contents of section .reginfo: 53 | 0000 a300c032 00000000 00001010 00000000 ...2............ 54 | 0010 00000000 00007ff0 ........ 55 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_align.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/late_rodata_align.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 000000f0 .text 6 | 00000000 l d .rodata 00000050 .rodata 7 | 00000040 g F .text 0000001c foo 8 | 00000090 g F .text 0000001c bar 9 | 00000000 g F .text 00000040 a 10 | 0000005c g F .text 00000034 b 11 | 000000ac g F .text 00000038 c 12 | 13 | 14 | RELOCATION RECORDS FOR [.text]: 15 | OFFSET TYPE VALUE 16 | 00000040 R_MIPS_HI16 .rodata 17 | 00000048 R_MIPS_LO16 .rodata 18 | 00000090 R_MIPS_HI16 .rodata 19 | 00000098 R_MIPS_LO16 .rodata 20 | 21 | 22 | Contents of section .text: 23 | 0000 00000000 00000000 00000000 00000000 ................ 24 | 0010 00000000 00000000 00000000 00000000 ................ 25 | 0020 00000000 00000000 00000000 00000000 ................ 26 | 0030 00000000 00000000 00000000 00000000 ................ 27 | 0040 3c010000 03e00008 c4200018 03e00008 <........ ...... 28 | 0050 00000000 03e00008 00000000 00000000 ................ 29 | 0060 00000000 00000000 00000000 00000000 ................ 30 | 0070 00000000 00000000 00000000 00000000 ................ 31 | 0080 00000000 00000000 00000000 00000000 ................ 32 | 0090 3c010000 03e00008 c420002c 03e00008 <........ .,.... 33 | 00a0 00000000 03e00008 00000000 00000000 ................ 34 | 00b0 00000000 00000000 00000000 00000000 ................ 35 | 00c0 00000000 00000000 00000000 00000000 ................ 36 | 00d0 00000000 00000000 00000000 00000000 ................ 37 | 00e0 00000000 00000000 00000000 00000000 ................ 38 | Contents of section .rodata: 39 | 0000 666f6f00 62617200 40833333 40866666 foo.bar.@.33@.ff 40 | 0010 4089999a 408ccccd 3f8ccccd 40a33333 @...@...?...@.33 41 | 0020 40a66666 40a9999a 40accccd 3f99999a @.ff@...@...?... 42 | 0030 40c33333 40c66666 40c9999a 40cccccd @.33@.ff@...@... 43 | 0040 40d00000 00000000 00000000 00000000 @............... 44 | Contents of section .options: 45 | 0000 01200000 00000000 80000002 00000000 . .............. 46 | 0010 000005f1 00000000 00000000 00007ff0 ................ 47 | 0020 07100000 00000000 00000000 00000000 ................ 48 | 0030 08100000 00000000 00000000 00000000 ................ 49 | Contents of section .reginfo: 50 | 0000 80000002 00000000 000005f1 00000000 ................ 51 | 0010 00000000 00007ff0 ........ 52 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_doubles_mips1.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/late_rodata_doubles_mips1.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 000000f0 .text 6 | 00000000 l d .rodata 00000030 .rodata 7 | 00000040 g F .text 00000010 foo 8 | 00000090 g F .text 00000010 bar 9 | 000000e0 g F .text 00000010 baz 10 | 00000000 g F .text 00000040 a 11 | 00000050 g F .text 00000040 b 12 | 000000a0 g F .text 00000040 c 13 | 14 | 15 | RELOCATION RECORDS FOR [.text]: 16 | OFFSET TYPE VALUE 17 | 00000040 R_MIPS_HI16 .rodata 18 | 00000044 R_MIPS_LO16 .rodata 19 | 00000090 R_MIPS_HI16 .rodata 20 | 00000094 R_MIPS_LO16 .rodata 21 | 000000e0 R_MIPS_HI16 .rodata 22 | 000000e4 R_MIPS_LO16 .rodata 23 | 24 | 25 | Contents of section .text: 26 | 0000 00000000 00000000 00000000 00000000 ................ 27 | 0010 00000000 00000000 00000000 00000000 ................ 28 | 0020 00000000 00000000 00000000 00000000 ................ 29 | 0030 00000000 00000000 00000000 00000000 ................ 30 | 0040 3c010000 c4200004 03e00008 00000000 <.... .......... 31 | 0050 00000000 00000000 00000000 00000000 ................ 32 | 0060 00000000 00000000 00000000 00000000 ................ 33 | 0070 00000000 00000000 00000000 00000000 ................ 34 | 0080 00000000 00000000 00000000 00000000 ................ 35 | 0090 3c010000 c4200018 03e00008 00000000 <.... .......... 36 | 00a0 00000000 00000000 00000000 00000000 ................ 37 | 00b0 00000000 00000000 00000000 00000000 ................ 38 | 00c0 00000000 00000000 00000000 00000000 ................ 39 | 00d0 00000000 00000000 00000000 00000000 ................ 40 | 00e0 3c010000 c4200028 03e00008 00000000 <.... .(........ 41 | Contents of section .rodata: 42 | 0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff.... 43 | 0010 40113333 33333333 408ccccd 4091999a @.333333@...@... 44 | 0020 40126666 66666666 40933333 00000000 @.ffffff@.33.... 45 | Contents of section .options: 46 | 0000 01200000 00000000 80000002 00000000 . .............. 47 | 0010 000c0011 00000000 00000000 00007ff0 ................ 48 | 0020 07100000 00000000 00000000 00000000 ................ 49 | 0030 08100000 00000000 00000000 00000000 ................ 50 | Contents of section .reginfo: 51 | 0000 80000002 00000000 000c0011 00000000 ................ 52 | 0010 00000000 00007ff0 ........ 53 | -------------------------------------------------------------------------------- /tools/asmproc/tests/static.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/static.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000080 .text 6 | 00000000 l d .rodata 00000010 .rodata 7 | 00000000 l d .data 00000010 .data 8 | 00000000 l d .bss 00000010 .bss 9 | 00000004 l O .rodata 00000000 rodata2 10 | 00000004 l O .data 00000000 data2 11 | 00000004 l O .bss 00000000 bss2 12 | 00000030 l F .text 00000000 xtext 13 | 00000000 g O .rodata 00000004 rodata1 14 | 00000000 g O .data 00000004 data1 15 | 00000000 g O .bss 00000004 bss1 16 | 00000044 g F .text 00000034 baz 17 | 00000000 g F .text 00000030 bar 18 | 19 | 20 | RELOCATION RECORDS FOR [.text]: 21 | OFFSET TYPE VALUE 22 | 0000004c R_MIPS_HI16 .bss 23 | 00000064 R_MIPS_LO16 .bss 24 | 00000050 R_MIPS_HI16 .rodata 25 | 0000005c R_MIPS_LO16 .rodata 26 | 00000054 R_MIPS_HI16 .data 27 | 00000058 R_MIPS_LO16 .data 28 | 00000060 R_MIPS_26 .text 29 | 00000000 R_MIPS_HI16 rodata2 30 | 00000004 R_MIPS_LO16 rodata2 31 | 00000008 R_MIPS_HI16 data2 32 | 0000000c R_MIPS_LO16 data2 33 | 00000010 R_MIPS_HI16 bss2 34 | 00000014 R_MIPS_LO16 bss2 35 | 00000018 R_MIPS_26 xtext 36 | 37 | 38 | Contents of section .text: 39 | 0000 3c040000 8c840000 3c050000 8c850000 <.......<....... 40 | 0010 3c060000 8c860000 0c000000 00000000 <............... 41 | 0020 03e00008 00000000 00000000 00000000 ................ 42 | 0030 afa40000 afa50004 afa60008 03e00008 ................ 43 | 0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... 44 | 0050 3c050000 3c060000 8cc60004 8ca50004 <...<........... 45 | 0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'... 46 | 0070 03e00008 00000000 00000000 00000000 ................ 47 | Contents of section .rodata: 48 | 0000 00000001 00000002 00000000 00000000 ................ 49 | Contents of section .data: 50 | 0000 00000003 00000004 00000000 00000000 ................ 51 | Contents of section .options: 52 | 0000 01200000 00000000 a0000074 00000000 . .........t.... 53 | 0010 00000000 00000000 00000000 00007ff0 ................ 54 | 0020 07100000 00000000 00000000 00000000 ................ 55 | 0030 08100000 00000000 00000000 00000000 ................ 56 | Contents of section .reginfo: 57 | 0000 a0000074 00000000 00000000 00000000 ...t............ 58 | 0010 00000000 00007ff0 ........ 59 | -------------------------------------------------------------------------------- /tools/asmproc/tests/static-global.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/static-global.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000080 .text 6 | 00000000 l d .rodata 00000010 .rodata 7 | 00000000 l d .data 00000010 .data 8 | 00000000 l d .bss 00000010 .bss 9 | 00000000 g O .rodata 00000004 rodata1 10 | 00000000 g O .data 00000004 data1 11 | 00000000 g O .bss 00000004 bss1 12 | 00000044 g F .text 00000034 baz 13 | 00000000 g F .text 00000030 bar 14 | 00000004 g O .rodata 00000000 rodata2 15 | 00000004 g O .data 00000000 data2 16 | 00000004 g O .bss 00000000 bss2 17 | 00000030 g F .text 00000000 xtext 18 | 19 | 20 | RELOCATION RECORDS FOR [.text]: 21 | OFFSET TYPE VALUE 22 | 0000004c R_MIPS_HI16 .bss 23 | 00000064 R_MIPS_LO16 .bss 24 | 00000050 R_MIPS_HI16 .rodata 25 | 0000005c R_MIPS_LO16 .rodata 26 | 00000054 R_MIPS_HI16 .data 27 | 00000058 R_MIPS_LO16 .data 28 | 00000060 R_MIPS_26 .text 29 | 00000000 R_MIPS_HI16 rodata2 30 | 00000004 R_MIPS_LO16 rodata2 31 | 00000008 R_MIPS_HI16 data2 32 | 0000000c R_MIPS_LO16 data2 33 | 00000010 R_MIPS_HI16 bss2 34 | 00000014 R_MIPS_LO16 bss2 35 | 00000018 R_MIPS_26 xtext 36 | 37 | 38 | Contents of section .text: 39 | 0000 3c040000 8c840000 3c050000 8c850000 <.......<....... 40 | 0010 3c060000 8c860000 0c000000 00000000 <............... 41 | 0020 03e00008 00000000 00000000 00000000 ................ 42 | 0030 afa40000 afa50004 afa60008 03e00008 ................ 43 | 0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... 44 | 0050 3c050000 3c060000 8cc60004 8ca50004 <...<........... 45 | 0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'... 46 | 0070 03e00008 00000000 00000000 00000000 ................ 47 | Contents of section .rodata: 48 | 0000 00000001 00000002 00000000 00000000 ................ 49 | Contents of section .data: 50 | 0000 00000003 00000004 00000000 00000000 ................ 51 | Contents of section .options: 52 | 0000 01200000 00000000 a0000074 00000000 . .........t.... 53 | 0010 00000000 00000000 00000000 00007ff0 ................ 54 | 0020 07100000 00000000 00000000 00000000 ................ 55 | 0030 08100000 00000000 00000000 00000000 ................ 56 | Contents of section .reginfo: 57 | 0000 a0000074 00000000 00000000 00000000 ...t............ 58 | 0010 00000000 00007ff0 ........ 59 | -------------------------------------------------------------------------------- /tools/m2ctx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | import os 5 | import shutil 6 | import sys 7 | import subprocess 8 | from pathlib import Path 9 | 10 | # assuming that this util is in tools/ 11 | script_dir = os.path.dirname(os.path.realpath(__file__)) 12 | root_dir = os.path.abspath(os.path.join(script_dir, "..")) 13 | print(root_dir) 14 | 15 | # Project-specific 16 | CPP_FLAGS = [ 17 | "-undef", 18 | "-D__sgi", 19 | "-DVERSION_US", 20 | "-DTARGET_N64", 21 | "-D_LANGUAGE_C", 22 | "-DF3DEX_GBI", 23 | "-D_MIPS_SZLONG=32", 24 | "-ffreestanding", 25 | "-nostdinc", 26 | "-Iinclude/ido", 27 | "-Iinclude", 28 | "-Ibuild", 29 | "-Iinclude/PR", 30 | "-Isrc", 31 | "-I.", 32 | ] 33 | 34 | import os 35 | import subprocess 36 | import shutil 37 | 38 | def import_c_file(in_file) -> str: 39 | 40 | Message = '/**** Context file for Bomberman 64 ****/\n' 41 | 42 | in_file = os.path.relpath(in_file, root_dir) 43 | # Prefer clang as C preprocessor if installed on the system 44 | if shutil.which('clang') is not None: 45 | cpp = ['clang', '-E', '-P', '-x', 'c', '-Wno-trigraphs'] 46 | else: 47 | cpp = ['gcc', '-E', '-P'] 48 | 49 | cpp_getdefines = [*cpp, "-dM", *CPP_FLAGS, in_file] 50 | cpp_procfile = [*cpp, *CPP_FLAGS, in_file] 51 | 52 | out_text = "" 53 | try: 54 | out_text += subprocess.check_output(cpp_getdefines, cwd=root_dir, encoding="utf-8") 55 | out_text += subprocess.check_output(cpp_procfile, cwd=root_dir, encoding="utf-8") 56 | except subprocess.CalledProcessError: 57 | print( 58 | "Failed to preprocess input file, when running command:\n", 59 | cpp_getdefines, 60 | file=sys.stderr, 61 | ) 62 | sys.exit(1) 63 | 64 | if not out_text: 65 | print("Output is empty - aborting") 66 | sys.exit(1) 67 | return Message + out_text 68 | 69 | def main(): 70 | parser = argparse.ArgumentParser( 71 | description="""Create a context file which can be used for mips_to_c""" 72 | ) 73 | parser.add_argument( 74 | "c_file", 75 | help="""File from which to create context""", 76 | ) 77 | args = parser.parse_args() 78 | 79 | output = import_c_file(args.c_file) 80 | 81 | with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f: 82 | f.write(output) 83 | 84 | 85 | if __name__ == "__main__": 86 | main() 87 | -------------------------------------------------------------------------------- /include/PR/os_si.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_si.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_si.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:18 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_SI_H_ 31 | #define _OS_SI_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | 80 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 81 | 82 | #ifdef _LANGUAGE_C_PLUS_PLUS 83 | } 84 | #endif 85 | 86 | #endif /* !_OS_SI_H_ */ 87 | -------------------------------------------------------------------------------- /include/PR/os_gio.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_gio.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_gio.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:08 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_GIO_H_ 31 | #define _OS_GIO_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | 80 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 81 | 82 | #ifdef _LANGUAGE_C_PLUS_PLUS 83 | } 84 | #endif 85 | 86 | #endif /* !_OS_GIO_H_ */ 87 | -------------------------------------------------------------------------------- /include/PR/os_rsp.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_rsp.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_rsp.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:17 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_RSP_H_ 31 | #define _OS_RSP_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | 80 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 81 | 82 | #ifdef _LANGUAGE_C_PLUS_PLUS 83 | } 84 | #endif 85 | 86 | #endif /* !_OS_RSP_H_ */ 87 | -------------------------------------------------------------------------------- /include/PR/os_error.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_error.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_error.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:06 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_ERROR_H_ 31 | #define _OS_ERROR_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | 80 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 81 | 82 | #ifdef _LANGUAGE_C_PLUS_PLUS 83 | } 84 | #endif 85 | 86 | #endif /* !_OS_ERROR_H_ */ 87 | -------------------------------------------------------------------------------- /include/PR/ultralog.h: -------------------------------------------------------------------------------- 1 | /*==================================================================== 2 | * ultralog.h 3 | * 4 | * Copyright 1995, Silicon Graphics, Inc. 5 | * All Rights Reserved. 6 | * 7 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 8 | * Inc.; the contents of this file may not be disclosed to third 9 | * parties, copied or duplicated in any form, in whole or in part, 10 | * without the prior written permission of Silicon Graphics, Inc. 11 | * 12 | * RESTRICTED RIGHTS LEGEND: 13 | * Use, duplication or disclosure by the Government is subject to 14 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 15 | * in Technical Data and Computer Software clause at DFARS 16 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 17 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 18 | * Copyright Laws of the United States. 19 | *====================================================================*/ 20 | 21 | /************************************************************************** 22 | * 23 | * $Revision: 1.6 $ 24 | * $Date: 1997/02/11 08:39:05 $ 25 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultralog.h,v $ 26 | * 27 | **************************************************************************/ 28 | 29 | #ifndef __log__ 30 | #define __log__ 31 | 32 | #ifdef _LANGUAGE_C_PLUS_PLUS 33 | extern "C" { 34 | #endif 35 | 36 | #include 37 | 38 | #define OS_LOG_MAX_ARGS 16 39 | #define OS_LOG_MAGIC 0x20736a73 40 | #define OS_LOG_FLOAT(x) (*(int *) &(x)) 41 | #define OS_LOG_VERSION 1 42 | 43 | typedef struct { 44 | u32 magic; /* log identifier */ 45 | u32 len; /* length of log data + log structure */ 46 | u32 *base; /* starting addr array */ 47 | s32 startCount; /* read offset from dataBase */ 48 | s32 writeOffset; /* write offset from dataBase */ 49 | } OSLog; 50 | 51 | typedef struct { 52 | u32 magic; 53 | u32 timeStamp; 54 | u16 argCount; 55 | u16 eventID; 56 | } OSLogItem; 57 | 58 | typedef struct { 59 | u32 magic; /* log identifier */ 60 | u32 version; /* 1 */ 61 | } OSLogFileHdr; 62 | 63 | void osCreateLog(OSLog *log, u32 *base, s32 len); 64 | void osLogEvent(OSLog *log, s16 code, s16 numArgs, ...); 65 | void osFlushLog(OSLog *log); 66 | u32 osLogFloat(f32); 67 | 68 | extern void osDelay(int count); 69 | 70 | #ifdef _LANGUAGE_C_PLUS_PLUS 71 | } 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_doubles.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/late_rodata_doubles.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000120 .text 6 | 00000000 l d .rodata 00000030 .rodata 7 | 00000040 g F .text 0000001c foo 8 | 0000009c g F .text 0000001c bar 9 | 000000f8 g F .text 0000001c baz 10 | 00000000 g F .text 00000040 a 11 | 0000005c g F .text 00000040 b 12 | 000000b8 g F .text 00000040 c 13 | 14 | 15 | RELOCATION RECORDS FOR [.text]: 16 | OFFSET TYPE VALUE 17 | 00000040 R_MIPS_HI16 .rodata 18 | 00000048 R_MIPS_LO16 .rodata 19 | 0000009c R_MIPS_HI16 .rodata 20 | 000000a4 R_MIPS_LO16 .rodata 21 | 000000f8 R_MIPS_HI16 .rodata 22 | 00000100 R_MIPS_LO16 .rodata 23 | 24 | 25 | Contents of section .text: 26 | 0000 00000000 00000000 00000000 00000000 ................ 27 | 0010 00000000 00000000 00000000 00000000 ................ 28 | 0020 00000000 00000000 00000000 00000000 ................ 29 | 0030 00000000 00000000 00000000 00000000 ................ 30 | 0040 3c010000 03e00008 c4200004 03e00008 <........ ...... 31 | 0050 00000000 03e00008 00000000 00000000 ................ 32 | 0060 00000000 00000000 00000000 00000000 ................ 33 | 0070 00000000 00000000 00000000 00000000 ................ 34 | 0080 00000000 00000000 00000000 00000000 ................ 35 | 0090 00000000 00000000 00000000 3c010000 ............<... 36 | 00a0 03e00008 c4200018 03e00008 00000000 ..... .......... 37 | 00b0 03e00008 00000000 00000000 00000000 ................ 38 | 00c0 00000000 00000000 00000000 00000000 ................ 39 | 00d0 00000000 00000000 00000000 00000000 ................ 40 | 00e0 00000000 00000000 00000000 00000000 ................ 41 | 00f0 00000000 00000000 3c010000 03e00008 ........<....... 42 | 0100 c4200028 03e00008 00000000 03e00008 . .(............ 43 | 0110 00000000 00000000 00000000 00000000 ................ 44 | Contents of section .rodata: 45 | 0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff.... 46 | 0010 40113333 33333333 408ccccd 4091999a @.333333@...@... 47 | 0020 40126666 66666666 40933333 00000000 @.ffffff@.33.... 48 | Contents of section .options: 49 | 0000 01200000 00000000 80000002 00000000 . .............. 50 | 0010 000000f1 00000000 00000000 00007ff0 ................ 51 | 0020 07100000 00000000 00000000 00000000 ................ 52 | 0030 08100000 00000000 00000000 00000000 ................ 53 | Contents of section .reginfo: 54 | 0000 80000002 00000000 000000f1 00000000 ................ 55 | 0010 00000000 00007ff0 ........ 56 | -------------------------------------------------------------------------------- /include/PR/os_reg.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_reg.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_reg.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:17 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_REG_H_ 31 | #define _OS_REG_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | /* Miscellaneous operations */ 80 | 81 | extern u32 osGetCount(void); 82 | 83 | 84 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 85 | 86 | #ifdef _LANGUAGE_C_PLUS_PLUS 87 | } 88 | #endif 89 | 90 | #endif /* !_OS_REG_H_ */ 91 | -------------------------------------------------------------------------------- /include/PR/os_flash.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------* 2 | Copyright (C) 1998 Nintendo. 3 | 4 | $RCSfile: os_flash.h,v $ 5 | $Revision: 1.1 $ 6 | $Date: 2000/06/15 06:24:55 $ 7 | *---------------------------------------------------------------------*/ 8 | 9 | #ifndef _OS_FLASH_H_ 10 | #define _OS_FLASH_H_ 11 | 12 | #ifdef _LANGUAGE_C_PLUS_PLUS 13 | extern "C" { 14 | #endif 15 | 16 | #include "ultratypes.h" 17 | #include "os_pi.h" 18 | 19 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 20 | 21 | /* 22 | * defines for FLASH 23 | */ 24 | #define FLASH_START_ADDR 0x08000000 25 | 26 | #define FLASH_SIZE 0x20000 27 | 28 | #define FLASH_LATENCY 0x5 29 | #define FLASH_PULSE 0x0c 30 | #define FLASH_PAGE_SIZE 0xf 31 | #define FLASH_REL_DURATION 0x2 32 | #define DEVICE_TYPE_FLASH 8 33 | 34 | #define FLASH_VERSION_MX_PROTO_A 0x00c20000 35 | #define FLASH_VERSION_MX_A 0x00c20001 36 | #define FLASH_VERSION_MX_C 0x00c2001e 37 | #define FLASH_VERSION_MX_B_AND_D 0x00c2001d 38 | #define FLASH_VERSION_MEI 0x003200f1 39 | 40 | /* OLD_FLASH is MX_PROTO_A, MX_A and MX_C */ 41 | #define OLD_FLASH 0 42 | /* NEW_FLASH is MX_B_AND_D and MATSUSHITA flash */ 43 | #define NEW_FLASH 1 44 | 45 | #define FLASH_STATUS_ERASE_BUSY 2 46 | #define FLASH_STATUS_ERASE_OK 0 47 | #define FLASH_STATUS_ERASE_ERROR -1 48 | 49 | #define FLASH_STATUS_WRITE_BUSY 1 50 | #define FLASH_STATUS_WRITE_OK 0 51 | #define FLASH_STATUS_WRITE_ERROR -1 52 | 53 | extern OSPiHandle *osFlashReInit(u8 latency, u8 pulse, 54 | u8 page_size, u8 rel_duration, u32 start); 55 | extern OSPiHandle *osFlashInit(void); 56 | extern void osFlashReadStatus(u8 *flash_status); 57 | extern void osFlashReadId(u32 *flash_type, u32 *flash_maker); 58 | extern void osFlashClearStatus(void); 59 | extern s32 osFlashAllErase(void); 60 | extern s32 osFlashSectorErase(u32 page_num); 61 | extern s32 osFlashWriteBuffer(OSIoMesg *mb, s32 priority, 62 | void *dramAddr, OSMesgQueue *mq); 63 | extern s32 osFlashWriteArray(u32 page_num); 64 | extern s32 osFlashReadArray(OSIoMesg *mb, s32 priority, u32 page_num, 65 | void *dramAddr, u32 n_pages, OSMesgQueue *mq); 66 | extern void osFlashChange(u32 flash_num); 67 | extern void osFlashAllEraseThrough(void); 68 | extern void osFlashSectorEraseThrough(u32 page_num); 69 | extern s32 osFlashCheckEraseEnd(void); 70 | 71 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 72 | 73 | #ifdef _LANGUAGE_C_PLUS_PLUS 74 | } 75 | #endif 76 | 77 | #endif /* !_OS_FLASH_H_ */ 78 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_misaligned_doubles.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/late_rodata_misaligned_doubles.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000120 .text 6 | 00000000 l d .rodata 00000040 .rodata 7 | 00000040 g F .text 0000001c foo 8 | 0000009c g F .text 0000001c bar 9 | 000000b8 g F .text 0000001c baz 10 | 00000000 g F .text 00000040 a 11 | 0000005c g F .text 00000040 b 12 | 000000d4 g F .text 00000040 c 13 | 14 | 15 | RELOCATION RECORDS FOR [.text]: 16 | OFFSET TYPE VALUE 17 | 00000040 R_MIPS_HI16 .rodata 18 | 00000048 R_MIPS_LO16 .rodata 19 | 0000009c R_MIPS_HI16 .rodata 20 | 000000a4 R_MIPS_LO16 .rodata 21 | 000000b8 R_MIPS_HI16 .rodata 22 | 000000c0 R_MIPS_LO16 .rodata 23 | 24 | 25 | Contents of section .text: 26 | 0000 00000000 00000000 00000000 00000000 ................ 27 | 0010 00000000 00000000 00000000 00000000 ................ 28 | 0020 00000000 00000000 00000000 00000000 ................ 29 | 0030 00000000 00000000 00000000 00000000 ................ 30 | 0040 3c010000 03e00008 d4200010 03e00008 <........ ...... 31 | 0050 00000000 03e00008 00000000 00000000 ................ 32 | 0060 00000000 00000000 00000000 00000000 ................ 33 | 0070 00000000 00000000 00000000 00000000 ................ 34 | 0080 00000000 00000000 00000000 00000000 ................ 35 | 0090 00000000 00000000 00000000 3c010000 ............<... 36 | 00a0 03e00008 d4200028 03e00008 00000000 ..... .(........ 37 | 00b0 03e00008 00000000 3c010000 03e00008 ........<....... 38 | 00c0 c4200030 03e00008 00000000 03e00008 . .0............ 39 | 00d0 00000000 00000000 00000000 00000000 ................ 40 | 00e0 00000000 00000000 00000000 00000000 ................ 41 | 00f0 00000000 00000000 00000000 00000000 ................ 42 | 0100 00000000 00000000 00000000 00000000 ................ 43 | 0110 00000000 00000000 00000000 00000000 ................ 44 | Contents of section .rodata: 45 | 0000 408051ec 00000000 4010147a e147ae14 @.Q.....@..z.G.. 46 | 0010 40101eb8 51eb851f 00000000 408147ae @...Q.......@.G. 47 | 0020 40103333 33333333 40103d70 a3d70a3d @.333333@.=p...= 48 | 0030 40823d71 00000000 401051eb 851eb852 @.=q....@.Q....R 49 | Contents of section .options: 50 | 0000 01200000 00000000 80000002 00000000 . .............. 51 | 0010 000000f3 00000000 00000000 00007ff0 ................ 52 | 0020 07100000 00000000 00000000 00000000 ................ 53 | 0030 08100000 00000000 00000000 00000000 ................ 54 | Contents of section .reginfo: 55 | 0000 80000002 00000000 000000f3 00000000 ................ 56 | 0010 00000000 00007ff0 ........ 57 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_jtbl.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | GLOBAL_ASM( 3 | .late_rodata 4 | .double 1 5 | .double 2 6 | .double 3 7 | .double 4 8 | .double 5 9 | .double 6 10 | .double 7 11 | .double 8 12 | .text 13 | glabel doubles1 14 | nop 15 | nop 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | nop 23 | nop 24 | nop 25 | nop 26 | nop 27 | nop 28 | nop 29 | nop 30 | nop 31 | nop 32 | nop 33 | nop 34 | nop 35 | nop 36 | nop 37 | ) 38 | 39 | float a(void) { return 1.1f; } 40 | 41 | GLOBAL_ASM( 42 | .late_rodata 43 | .float 1 44 | .double 2 45 | .double 3 46 | .double 4 47 | .double 5 48 | .double 6 49 | .double 7 50 | .double 8 51 | .double 9 52 | .float 10 53 | .text 54 | glabel doubles2 55 | nop 56 | nop 57 | nop 58 | nop 59 | nop 60 | nop 61 | nop 62 | nop 63 | nop 64 | nop 65 | nop 66 | nop 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | nop 76 | nop 77 | nop 78 | ) 79 | 80 | GLOBAL_ASM( 81 | glabel a2 82 | move $a0, $a0 83 | nop 84 | nop 85 | nop 86 | jr $ra 87 | move $a0, $a0 88 | ) 89 | 90 | GLOBAL_ASM( 91 | .late_rodata 92 | 93 | glabel jtbl 94 | .word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10 95 | .word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20 96 | .word case21, case22, case23, case24, case25, case26 97 | 98 | .text 99 | glabel foo 100 | sltiu $at, $a0, 0xa 101 | beqz $at, .L756E659B 102 | sll $t7, $a0, 2 103 | lui $at, %hi(jtbl) 104 | addu $at, $at, $t7 105 | lw $t7, %lo(jtbl)($at) 106 | jr $t7 107 | nop 108 | case0: addiu $a0, $a0, 1 109 | case1: addiu $a0, $a0, 1 110 | case2: addiu $a0, $a0, 1 111 | case3: addiu $a0, $a0, 1 112 | case4: addiu $a0, $a0, 1 113 | case5: addiu $a0, $a0, 1 114 | case6: addiu $a0, $a0, 1 115 | case7: addiu $a0, $a0, 1 116 | case8: addiu $a0, $a0, 1 117 | case9: addiu $a0, $a0, 1 118 | case10: addiu $a0, $a0, 1 119 | case11: addiu $a0, $a0, 1 120 | case12: addiu $a0, $a0, 1 121 | case13: addiu $a0, $a0, 1 122 | case14: addiu $a0, $a0, 1 123 | case15: addiu $a0, $a0, 1 124 | case16: addiu $a0, $a0, 1 125 | case17: addiu $a0, $a0, 1 126 | case18: addiu $a0, $a0, 1 127 | case19: addiu $a0, $a0, 1 128 | case20: addiu $a0, $a0, 1 129 | case21: addiu $a0, $a0, 1 130 | case22: addiu $a0, $a0, 1 131 | case23: addiu $a0, $a0, 1 132 | case24: addiu $a0, $a0, 1 133 | case25: addiu $a0, $a0, 1 134 | case26: 135 | jr $ra 136 | addiu $v0, $a0, 1 137 | 138 | .L756E659B: 139 | addiu $v0, $zero, 2 140 | jr $ra 141 | nop 142 | ) 143 | 144 | GLOBAL_ASM( 145 | glabel b2 146 | move $a0, $a0 147 | nop 148 | nop 149 | jr $ra 150 | move $a0, $a0 151 | ) 152 | 153 | float b(void) { return 1.2f; } 154 | -------------------------------------------------------------------------------- /include/PR/os_ai.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_ai.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_ai.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:04 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_AI_H_ 31 | #define _OS_AI_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | /* Audio interface (Ai) */ 80 | extern u32 osAiGetStatus(void); 81 | extern u32 osAiGetLength(void); 82 | extern s32 osAiSetFrequency(u32); 83 | extern s32 osAiSetNextBuffer(void *, u32); 84 | 85 | 86 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 87 | 88 | #ifdef _LANGUAGE_C_PLUS_PLUS 89 | } 90 | #endif 91 | 92 | #endif /* !_OS_AI_H_ */ 93 | -------------------------------------------------------------------------------- /include/PR/os_rdp.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_rdp.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_rdp.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:16 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_RDP_H_ 31 | #define _OS_RDP_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | 66 | /************************************************************************** 67 | * 68 | * Extern variables 69 | * 70 | */ 71 | 72 | 73 | /************************************************************************** 74 | * 75 | * Function prototypes 76 | * 77 | */ 78 | 79 | /* Display processor interface (Dp) */ 80 | extern u32 osDpGetStatus(void); 81 | extern void osDpSetStatus(u32); 82 | extern void osDpGetCounters(u32 *); 83 | extern s32 osDpSetNextBuffer(void *, u64); 84 | 85 | 86 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 87 | 88 | #ifdef _LANGUAGE_C_PLUS_PLUS 89 | } 90 | #endif 91 | 92 | #endif /* !_OS_RDP_H_ */ 93 | -------------------------------------------------------------------------------- /tools/asmproc/tests/late_rodata_jtbl_mips1.c: -------------------------------------------------------------------------------- 1 | // COMPILE-FLAGS: -O2 2 | // COMPILE-ISET: -mips1 3 | // exact copy of late_rodata_jtbl.c except for the -mips1 addition 4 | GLOBAL_ASM( 5 | .late_rodata 6 | .double 1 7 | .double 2 8 | .double 3 9 | .double 4 10 | .double 5 11 | .double 6 12 | .double 7 13 | .double 8 14 | .text 15 | glabel doubles1 16 | nop 17 | nop 18 | nop 19 | nop 20 | nop 21 | nop 22 | nop 23 | nop 24 | nop 25 | nop 26 | nop 27 | nop 28 | nop 29 | nop 30 | nop 31 | nop 32 | nop 33 | nop 34 | nop 35 | nop 36 | nop 37 | nop 38 | nop 39 | ) 40 | 41 | float a(void) { return 1.1f; } 42 | 43 | GLOBAL_ASM( 44 | .late_rodata 45 | .float 1 46 | .double 2 47 | .double 3 48 | .double 4 49 | .double 5 50 | .double 6 51 | .double 7 52 | .double 8 53 | .double 9 54 | .float 10 55 | .text 56 | glabel doubles2 57 | nop 58 | nop 59 | nop 60 | nop 61 | nop 62 | nop 63 | nop 64 | nop 65 | nop 66 | nop 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | nop 76 | nop 77 | nop 78 | nop 79 | nop 80 | ) 81 | 82 | GLOBAL_ASM( 83 | glabel a2 84 | move $a0, $a0 85 | nop 86 | nop 87 | nop 88 | jr $ra 89 | move $a0, $a0 90 | ) 91 | 92 | GLOBAL_ASM( 93 | .late_rodata 94 | 95 | glabel jtbl 96 | .word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10 97 | .word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20 98 | .word case21, case22, case23, case24, case25, case26 99 | 100 | .text 101 | glabel foo 102 | sltiu $at, $a0, 0xa 103 | beqz $at, .L756E659B 104 | sll $t7, $a0, 2 105 | lui $at, %hi(jtbl) 106 | addu $at, $at, $t7 107 | lw $t7, %lo(jtbl)($at) 108 | jr $t7 109 | nop 110 | case0: addiu $a0, $a0, 1 111 | case1: addiu $a0, $a0, 1 112 | case2: addiu $a0, $a0, 1 113 | case3: addiu $a0, $a0, 1 114 | case4: addiu $a0, $a0, 1 115 | case5: addiu $a0, $a0, 1 116 | case6: addiu $a0, $a0, 1 117 | case7: addiu $a0, $a0, 1 118 | case8: addiu $a0, $a0, 1 119 | case9: addiu $a0, $a0, 1 120 | case10: addiu $a0, $a0, 1 121 | case11: addiu $a0, $a0, 1 122 | case12: addiu $a0, $a0, 1 123 | case13: addiu $a0, $a0, 1 124 | case14: addiu $a0, $a0, 1 125 | case15: addiu $a0, $a0, 1 126 | case16: addiu $a0, $a0, 1 127 | case17: addiu $a0, $a0, 1 128 | case18: addiu $a0, $a0, 1 129 | case19: addiu $a0, $a0, 1 130 | case20: addiu $a0, $a0, 1 131 | case21: addiu $a0, $a0, 1 132 | case22: addiu $a0, $a0, 1 133 | case23: addiu $a0, $a0, 1 134 | case24: addiu $a0, $a0, 1 135 | case25: addiu $a0, $a0, 1 136 | case26: 137 | jr $ra 138 | addiu $v0, $a0, 1 139 | 140 | .L756E659B: 141 | addiu $v0, $zero, 2 142 | jr $ra 143 | nop 144 | ) 145 | 146 | GLOBAL_ASM( 147 | glabel b2 148 | move $a0, $a0 149 | nop 150 | nop 151 | jr $ra 152 | move $a0, $a0 153 | ) 154 | 155 | float b(void) { return 1.2f; } 156 | -------------------------------------------------------------------------------- /include/PR/os_gbpak.h: -------------------------------------------------------------------------------- 1 | 2 | /*---------------------------------------------------------------------* 3 | Copyright (C) 1998 Nintendo. 4 | 5 | $RCSfile: os_gbpak.h,v $ 6 | $Revision: 1.1 $ 7 | $Date: 1998/10/09 08:01:07 $ 8 | *---------------------------------------------------------------------*/ 9 | 10 | #ifndef _OS_GBPAK_H_ 11 | #define _OS_GBPAK_H_ 12 | 13 | #ifdef _LANGUAGE_C_PLUS_PLUS 14 | extern "C" { 15 | #endif 16 | 17 | #include 18 | #include "os_message.h" 19 | #include "os_pfs.h" 20 | 21 | 22 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 23 | 24 | /************************************************************************** 25 | * 26 | * Type definitions 27 | * 28 | */ 29 | 30 | typedef struct { 31 | u16 fixed1; 32 | u16 start_address; 33 | u8 nintendo_chr[0x30]; 34 | u8 game_title[16]; 35 | u16 company_code; 36 | u8 body_code; 37 | u8 cart_type; 38 | u8 rom_size; 39 | u8 ram_size; 40 | u8 country_code; 41 | u8 fixed2; 42 | u8 version; 43 | u8 isum; 44 | u16 sum; 45 | } OSGbpakId; 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | /* definition for 64GB-PAK */ 57 | 58 | #define OS_GBPAK_POWER 0x01 59 | #define OS_GBPAK_RSTB_DETECTION 0x04 60 | #define OS_GBPAK_RSTB_STATUS 0x08 61 | #define OS_GBPAK_GBCART_PULL 0x40 62 | #define OS_GBPAK_GBCART_ON 0x80 63 | 64 | #define OS_GBPAK_POWER_OFF 0x00 /* power of 64GB-PAK */ 65 | #define OS_GBPAK_POWER_ON 0x01 66 | 67 | #define OS_GBPAK_ROM_ID_SIZE 0x50 /* ID size of GB cartridge */ 68 | 69 | 70 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 71 | 72 | /************************************************************************** 73 | * 74 | * Macro definitions 75 | * 76 | */ 77 | 78 | 79 | /************************************************************************** 80 | * 81 | * Extern variables 82 | * 83 | */ 84 | 85 | 86 | /************************************************************************** 87 | * 88 | * Function prototypes 89 | * 90 | */ 91 | 92 | /* 64GB-PAK */ 93 | extern s32 osGbpakInit(OSMesgQueue *, OSPfs *, int); 94 | extern s32 osGbpakPower(OSPfs *, s32); 95 | extern s32 osGbpakGetStatus(OSPfs *, u8 *); 96 | extern s32 osGbpakReadWrite(OSPfs *, u16, u16, u8 *, u16); 97 | extern s32 osGbpakReadId(OSPfs *, OSGbpakId *, u8 *); 98 | extern s32 osGbpakCheckConnector(OSPfs *, u8 *); 99 | 100 | 101 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 102 | 103 | #ifdef _LANGUAGE_C_PLUS_PLUS 104 | } 105 | #endif 106 | 107 | #endif /* !_OS_GBPAK_H_ */ 108 | -------------------------------------------------------------------------------- /tools/asmproc/tests/test3.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/test3.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 000000d0 .text 6 | 00000000 l d .rodata 00000040 .rodata 7 | 00000000 l d .data 00000010 .data 8 | 00000000 l d .bss 00000010 .bss 9 | 00000000 g O .bss 00000004 globalBuf 10 | 00000004 g O .bss 00000004 constBuf 11 | 00000000 g O .data 00000004 globalBufInit 12 | 00000004 g O .rodata 00000004 constBufInit 13 | 00000008 g O .rodata 00000001 constBufInit2 14 | 0000000c g O .rodata 00000001 constBufInit3 15 | 0000003c g F .text 00000054 f 16 | 00000000 g F .text 00000004 test 17 | 00000090 g F .text 00000004 g 18 | 00000000 *UND* 00000000 D_410100 19 | 00000000 *UND* 00000000 func_004000B0 20 | 21 | 22 | RELOCATION RECORDS FOR [.text]: 23 | OFFSET TYPE VALUE 24 | 00000044 R_MIPS_HI16 .rodata 25 | 00000048 R_MIPS_LO16 .rodata 26 | 00000050 R_MIPS_HI16 .rodata 27 | 00000054 R_MIPS_LO16 .rodata 28 | 0000005c R_MIPS_HI16 .rodata 29 | 00000060 R_MIPS_LO16 .rodata 30 | 00000068 R_MIPS_26 g 31 | 0000009c R_MIPS_HI16 D_410100 32 | 000000a0 R_MIPS_LO16 D_410100 33 | 000000a4 R_MIPS_26 func_004000B0 34 | 35 | 36 | Contents of section .text: 37 | 0000 27bdffe8 18a00009 afa00004 8fae0004 '............... 38 | 0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'... 39 | 0020 0325082a 1420fff9 afb90004 10000001 .%.*. .......... 40 | 0030 00000000 03e00008 27bd0018 27bdffd8 ........'...'... 41 | 0040 afbf0014 3c010000 d4240028 f7a40020 ....<....$.(... 42 | 0050 3c010000 c4260030 e7a6001c 3c010000 <....&.0....<... 43 | 0060 c4280034 e7a80018 0c000000 00000000 .(.4............ 44 | 0070 10000003 00000000 10000001 00000000 ................ 45 | 0080 8fbf0014 27bd0028 03e00008 00000000 ....'..(........ 46 | 0090 27bdffe8 afbf0014 240e0004 3c010000 '.......$...<... 47 | 00a0 ac2e0000 0c000000 00000000 10000001 ................ 48 | 00b0 00000000 8fbf0014 27bd0018 03e00008 ........'....... 49 | 00c0 00000000 00000000 00000000 00000000 ................ 50 | Contents of section .rodata: 51 | 0000 0004e729 01000000 02000000 03000000 ...)............ 52 | 0010 48656c6c 6f202000 576f726c 64000000 Hello .World... 53 | 0020 0001e0f3 00000000 40146666 66666666 ........@.ffffff 54 | 0030 40a66666 40a9999a 00000000 00000000 @.ff@........... 55 | Contents of section .data: 56 | 0000 01000000 00000000 00000000 00000000 ................ 57 | Contents of section .options: 58 | 0000 01200000 00000000 a0000002 00000000 . .............. 59 | 0010 00000170 00000000 00000000 00007ff0 ...p............ 60 | 0020 07100000 00000000 00000000 00000000 ................ 61 | 0030 08100000 00000000 00000000 00000000 ................ 62 | Contents of section .reginfo: 63 | 0000 a300c032 00000000 00000170 00000000 ...2.......p.... 64 | 0010 00000000 00007ff0 ........ 65 | -------------------------------------------------------------------------------- /include/PR/os_cache.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_cache.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_cache.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:04 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_CACHE_H_ 31 | #define _OS_CACHE_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | 57 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 58 | 59 | /************************************************************************** 60 | * 61 | * Macro definitions 62 | * 63 | */ 64 | 65 | #define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10)) 66 | #define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10)) 67 | 68 | 69 | /************************************************************************** 70 | * 71 | * Extern variables 72 | * 73 | */ 74 | 75 | 76 | /************************************************************************** 77 | * 78 | * Function prototypes 79 | * 80 | */ 81 | 82 | /* Cache operations and macros */ 83 | 84 | extern void osInvalDCache(void *, s32); 85 | extern void osInvalICache(void *, s32); 86 | extern void osWritebackDCache(void *, s32); 87 | extern void osWritebackDCacheAll(void); 88 | 89 | 90 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 91 | 92 | #ifdef _LANGUAGE_C_PLUS_PLUS 93 | } 94 | #endif 95 | 96 | #endif /* !_OS_CACHE_H_ */ 97 | -------------------------------------------------------------------------------- /include/PR/os_libc.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_libc.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_libc.h,v $ 26 | $Revision: 1.3 $ 27 | $Date: 1999/07/13 01:43:47 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_LIBC_H_ 31 | #define _OS_LIBC_H_ 32 | 33 | #include "os_pfs.h" 34 | 35 | #ifdef _LANGUAGE_C_PLUS_PLUS 36 | extern "C" { 37 | #endif 38 | 39 | #include 40 | 41 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 42 | 43 | /************************************************************************** 44 | * 45 | * Type definitions 46 | * 47 | */ 48 | 49 | 50 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 51 | 52 | /************************************************************************** 53 | * 54 | * Global definitions 55 | * 56 | */ 57 | 58 | 59 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 60 | 61 | /************************************************************************** 62 | * 63 | * Macro definitions 64 | * 65 | */ 66 | 67 | 68 | /************************************************************************** 69 | * 70 | * Extern variables 71 | * 72 | */ 73 | 74 | 75 | /************************************************************************** 76 | * 77 | * Function prototypes 78 | * 79 | */ 80 | 81 | /* byte string operations */ 82 | 83 | 84 | extern void bcopy(const void *, void *, int); 85 | extern int bcmp(const void *, const void *, int); 86 | extern void bzero(void *, int); 87 | 88 | /* Printf */ 89 | 90 | extern int sprintf(char *s, const char *fmt, ...); 91 | extern void osSyncPrintf(const char *fmt, ...); 92 | 93 | 94 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 95 | 96 | #ifdef _LANGUAGE_C_PLUS_PLUS 97 | } 98 | #endif 99 | 100 | #endif /* !_OS_LIBC_H_ */ 101 | -------------------------------------------------------------------------------- /include/PR/os_exception.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_exception.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_exception.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:07 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_EXCEPTION_H_ 31 | #define _OS_EXCEPTION_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include "ultratypes.h" 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | typedef u32 OSIntMask; 42 | typedef u32 OSHWIntr; 43 | 44 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 45 | 46 | /* Flags for debugging purpose */ 47 | 48 | #define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */ 49 | #define OS_FLAG_FAULT 2 /* CPU fault has occurred */ 50 | 51 | /* Interrupt masks */ 52 | 53 | #define OS_IM_NONE 0x00000001 54 | #define OS_IM_RCP 0x00000401 55 | #define OS_IM_SW1 0x00000501 56 | #define OS_IM_SW2 0x00000601 57 | #define OS_IM_CART 0x00000c01 58 | #define OS_IM_PRENMI 0x00001401 59 | #define OS_IM_RDBWRITE 0x00002401 60 | #define OS_IM_RDBREAD 0x00004401 61 | #define OS_IM_COUNTER 0x00008401 62 | #define OS_IM_CPU 0x0000ff01 63 | #define OS_IM_SP 0x00010401 64 | #define OS_IM_SI 0x00020401 65 | #define OS_IM_AI 0x00040401 66 | #define OS_IM_VI 0x00080401 67 | #define OS_IM_PI 0x00100401 68 | #define OS_IM_DP 0x00200401 69 | #define OS_IM_ALL 0x003fff01 70 | #define RCP_IMASK 0x003f0000 71 | #define RCP_IMASKSHIFT 16 72 | 73 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 74 | 75 | /* Interrupt operations */ 76 | 77 | extern OSIntMask osGetIntMask(void); 78 | extern OSIntMask osSetIntMask(OSIntMask); 79 | 80 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 81 | 82 | #ifdef _LANGUAGE_C_PLUS_PLUS 83 | } 84 | #endif 85 | 86 | #endif /* !_OS_EXCEPTION_H_ */ 87 | -------------------------------------------------------------------------------- /include/PR/rdb.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************** 3 | * 4 | * $Revision: 1.6 $ 5 | * $Date: 1997/02/11 08:29:31 $ 6 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rdb.h,v $ 7 | * 8 | **************************************************************************/ 9 | 10 | #ifndef _RDB_H 11 | #define _RDB_H 12 | 13 | /* U64 side address */ 14 | #define RDB_BASE_REG 0xc0000000 15 | #define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8) 16 | #define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc) 17 | #define RDB_BASE_VIRTUAL_ADDR 0x80000000 18 | 19 | /* packet type Have six bits, so can have up to 63 types */ 20 | #define RDB_TYPE_INVALID 0 21 | #define RDB_TYPE_GtoH_PRINT 1 22 | #define RDB_TYPE_GtoH_FAULT 2 23 | #define RDB_TYPE_GtoH_LOG_CT 3 24 | #define RDB_TYPE_GtoH_LOG 4 25 | #define RDB_TYPE_GtoH_READY_FOR_DATA 5 26 | #define RDB_TYPE_GtoH_DATA_CT 6 27 | #define RDB_TYPE_GtoH_DATA 7 28 | #define RDB_TYPE_GtoH_DEBUG 8 29 | #define RDB_TYPE_GtoH_RAMROM 9 30 | #define RDB_TYPE_GtoH_DEBUG_DONE 10 31 | #define RDB_TYPE_GtoH_DEBUG_READY 11 32 | #define RDB_TYPE_GtoH_KDEBUG 12 33 | #define RDB_TYPE_GtoH_PROF_DATA 22 34 | 35 | 36 | #define RDB_TYPE_HtoG_LOG_DONE 13 37 | #define RDB_TYPE_HtoG_DEBUG 14 38 | #define RDB_TYPE_HtoG_DEBUG_CT 15 39 | #define RDB_TYPE_HtoG_DATA 16 40 | #define RDB_TYPE_HtoG_DATA_DONE 17 41 | #define RDB_TYPE_HtoG_REQ_RAMROM 18 42 | #define RDB_TYPE_HtoG_FREE_RAMROM 19 43 | #define RDB_TYPE_HtoG_KDEBUG 20 44 | #define RDB_TYPE_HtoG_PROF_SIGNAL 21 45 | 46 | 47 | #define RDB_PROF_ACK_SIG 1 48 | #define RDB_PROF_FLUSH_SIG 2 49 | #define PROF_BLOCK_SIZE 2048 50 | 51 | #define RDB_LOG_MAX_BLOCK_SIZE 0x8000 52 | #define RDB_DATA_MAX_BLOCK_SIZE 0x8000 53 | 54 | 55 | /* GIO side address */ 56 | #define GIO_RDB_BASE_REG 0xbf480000 57 | #define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8) 58 | #define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc) 59 | 60 | /* minor device number */ 61 | #define GIO_RDB_PRINT_MINOR 1 62 | #define GIO_RDB_DEBUG_MINOR 2 63 | 64 | /* interrupt bit */ 65 | #define GIO_RDB_WRITE_INTR_BIT 0x80000000 66 | #define GIO_RDB_READ_INTR_BIT 0x40000000 67 | 68 | /* debug command */ 69 | #define DEBUG_COMMAND_NULL 0 70 | #define DEBUG_COMMAND_MEMORY 1 71 | #define DEBUG_COMMAND_REGISTER 2 72 | #define DEBUG_COMMAND_INVALID 255 73 | 74 | /* debug state */ 75 | #define DEBUG_STATE_NULL 0 76 | #define DEBUG_STATE_RECEIVE 1 77 | #define DEBUG_STATE_INVALID 255 78 | 79 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 80 | 81 | /* Structure for debug port */ 82 | typedef struct { 83 | unsigned type : 6; /* 0: invalid, 1: print, 2: debug */ 84 | unsigned length : 2; /* 1, 2, or 3 */ 85 | char buf[3]; /* character buffer */ 86 | } rdbPacket; 87 | 88 | extern unsigned int __osRdbWriteOK; 89 | extern unsigned int __osRdbSendMessage; 90 | 91 | #endif /* _LANGUAGE_C */ 92 | 93 | #endif /* !_RDB_H */ 94 | -------------------------------------------------------------------------------- /include/PR/os_voice.h: -------------------------------------------------------------------------------- 1 | 2 | /*---------------------------------------------------------------------* 3 | Copyright (C) 1998 Nintendo. 4 | 5 | $RCSfile: os_voice.h,v $ 6 | $Revision: 1.2 $ 7 | $Date: 1999/07/13 08:36:42 $ 8 | *---------------------------------------------------------------------*/ 9 | 10 | #ifndef _OS_VOICE_H_ 11 | #define _OS_VOICE_H_ 12 | 13 | #ifdef _LANGUAGE_C_PLUS_PLUS 14 | extern "C" { 15 | #endif 16 | 17 | #include 18 | 19 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 20 | 21 | /************************************************************************** 22 | * 23 | * Type definitions 24 | * 25 | */ 26 | 27 | typedef struct { /* Voice Recognition System */ 28 | OSMesgQueue *__mq; /* SI Message Queue */ 29 | int __channel; /* Controller Port # */ 30 | s32 __mode; 31 | u8 cmd_status; /* Command Status */ 32 | } OSVoiceHandle; 33 | 34 | typedef struct { /* Voice Recognition System */ 35 | u16 warning; 36 | u16 answer_num; /* 0...5 */ 37 | u16 voice_level; 38 | u16 voice_sn; 39 | u16 voice_time; 40 | u16 answer[5]; 41 | u16 distance[5]; 42 | } OSVoiceData; 43 | 44 | 45 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 46 | 47 | /************************************************************************** 48 | * 49 | * Global definitions 50 | * 51 | */ 52 | 53 | /* definition for Voice Recognition System */ 54 | 55 | #define VOICE_WARN_TOO_SMALL 0x0400 56 | #define VOICE_WARN_TOO_LARGE 0x0800 57 | #define VOICE_WARN_NOT_FIT 0x4000 58 | #define VOICE_WARN_TOO_NOISY 0x8000 59 | 60 | #define VOICE_STATUS_READY 0 61 | #define VOICE_STATUS_START 1 62 | #define VOICE_STATUS_CANCEL 3 63 | #define VOICE_STATUS_BUSY 5 64 | #define VOICE_STATUS_END 7 65 | 66 | 67 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 68 | 69 | /************************************************************************** 70 | * 71 | * Macro definitions 72 | * 73 | */ 74 | 75 | 76 | /************************************************************************** 77 | * 78 | * Extern variables 79 | * 80 | */ 81 | 82 | 83 | /************************************************************************** 84 | * 85 | * Function prototypes 86 | * 87 | */ 88 | 89 | /* Voice Recognition System */ 90 | extern s32 osVoiceInit(OSMesgQueue *, OSVoiceHandle *, int); 91 | extern s32 osVoiceCheckWord(u8 *data); 92 | extern s32 osVoiceClearDictionary(OSVoiceHandle *, u8); 93 | extern s32 osVoiceControlGain(OSVoiceHandle *, s32, s32); 94 | extern s32 osVoiceSetWord(OSVoiceHandle *, u8 *); 95 | extern s32 osVoiceStartReadData(OSVoiceHandle *); 96 | extern s32 osVoiceStopReadData(OSVoiceHandle *); 97 | extern s32 osVoiceGetReadData(OSVoiceHandle *, OSVoiceData *); 98 | extern s32 osVoiceMaskDictionary(OSVoiceHandle *, u8 *, int); 99 | extern void osVoiceCountSyllables(u8 *, u32 *); 100 | 101 | 102 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 103 | 104 | #ifdef _LANGUAGE_C_PLUS_PLUS 105 | } 106 | #endif 107 | 108 | #endif /* !_OS_VOICE_H_ */ 109 | -------------------------------------------------------------------------------- /include/PR/os_tlb.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_tlb.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_tlb.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:20 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_TLB_H_ 31 | #define _OS_TLB_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | typedef u32 OSPageMask; 48 | 49 | 50 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 51 | 52 | /************************************************************************** 53 | * 54 | * Global definitions 55 | * 56 | */ 57 | 58 | /* 59 | * Page size argument for TLB routines 60 | */ 61 | #define OS_PM_4K 0x0000000 62 | #define OS_PM_16K 0x0006000 63 | #define OS_PM_64K 0x001e000 64 | #define OS_PM_256K 0x007e000 65 | #define OS_PM_1M 0x01fe000 66 | #define OS_PM_4M 0x07fe000 67 | #define OS_PM_16M 0x1ffe000 68 | 69 | 70 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 71 | 72 | /************************************************************************** 73 | * 74 | * Macro definitions 75 | * 76 | */ 77 | 78 | 79 | /************************************************************************** 80 | * 81 | * Extern variables 82 | * 83 | */ 84 | 85 | 86 | /************************************************************************** 87 | * 88 | * Function prototypes 89 | * 90 | */ 91 | 92 | /* TLB management routines */ 93 | 94 | extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32); 95 | extern void osMapTLBRdb(void); 96 | extern void osUnmapTLB(s32); 97 | extern void osUnmapTLBAll(void); 98 | extern void osSetTLBASID(s32); 99 | 100 | 101 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 102 | 103 | #ifdef _LANGUAGE_C_PLUS_PLUS 104 | } 105 | #endif 106 | 107 | #endif /* !_OS_TLB_H_ */ 108 | -------------------------------------------------------------------------------- /include/PR/os.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os.h,v $ 26 | $Revision: 1.168 $ 27 | $Date: 2000/06/15 06:24:52 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_H_ 31 | #define _OS_H_ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #ifdef _LANGUAGE_C_PLUS_PLUS 63 | extern "C" { 64 | #endif 65 | 66 | #include 67 | 68 | /************************************************************************** 69 | * 70 | * Global definitions 71 | * 72 | */ 73 | 74 | /* 75 | * Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager), 76 | * SIM (SI Manager) 77 | * 78 | */ 79 | #define OS_PIM_STACKSIZE 4096 80 | #define OS_VIM_STACKSIZE 4096 81 | #define OS_SIM_STACKSIZE 4096 82 | 83 | #define OS_MIN_STACKSIZE 72 84 | 85 | /* 86 | * Leo Disk 87 | */ 88 | 89 | /* transfer mode */ 90 | 91 | #define LEO_BLOCK_MODE 1 92 | #define LEO_TRACK_MODE 2 93 | #define LEO_SECTOR_MODE 3 94 | 95 | /* 96 | * Boot addresses 97 | */ 98 | #define BOOT_ADDRESS_ULTRA 0x80000400 99 | #define BOOT_ADDRESS_COSIM 0x80002000 100 | #define BOOT_ADDRESS_EMU 0x20010000 101 | #define BOOT_ADDRESS_INDY 0x88100000 102 | 103 | 104 | #ifdef _LANGUAGE_C_PLUS_PLUS 105 | } 106 | #endif 107 | 108 | #endif /* !_OS_H */ 109 | -------------------------------------------------------------------------------- /tools/asmproc/tests/large.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/large.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 00000280 .text 6 | 00000270 g F .text 00000010 foo 7 | 00000000 g F .text 00000270 test 8 | 9 | 10 | Contents of section .text: 11 | 0000 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 12 | 0010 a1e00000 8fb80004 27190001 0325082a ........'....%.* 13 | 0020 afb90004 00000000 03e00008 27bd0018 ............'... 14 | 0030 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 15 | 0040 a1e00000 8fb80004 27190001 0325082a ........'....%.* 16 | 0050 afb90004 00000000 03e00008 27bd0018 ............'... 17 | 0060 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 18 | 0070 a1e00000 8fb80004 27190001 0325082a ........'....%.* 19 | 0080 afb90004 00000000 03e00008 27bd0018 ............'... 20 | 0090 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 21 | 00a0 a1e00000 8fb80004 27190001 0325082a ........'....%.* 22 | 00b0 afb90004 00000000 03e00008 27bd0018 ............'... 23 | 00c0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 24 | 00d0 a1e00000 8fb80004 27190001 0325082a ........'....%.* 25 | 00e0 afb90004 00000000 03e00008 27bd0018 ............'... 26 | 00f0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 27 | 0100 a1e00000 8fb80004 27190001 0325082a ........'....%.* 28 | 0110 afb90004 00000000 03e00008 27bd0018 ............'... 29 | 0120 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 30 | 0130 a1e00000 8fb80004 27190001 0325082a ........'....%.* 31 | 0140 afb90004 00000000 03e00008 27bd0018 ............'... 32 | 0150 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 33 | 0160 a1e00000 8fb80004 27190001 0325082a ........'....%.* 34 | 0170 afb90004 00000000 03e00008 27bd0018 ............'... 35 | 0180 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 36 | 0190 a1e00000 8fb80004 27190001 0325082a ........'....%.* 37 | 01a0 afb90004 00000000 03e00008 27bd0018 ............'... 38 | 01b0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 39 | 01c0 a1e00000 8fb80004 27190001 0325082a ........'....%.* 40 | 01d0 afb90004 00000000 03e00008 27bd0018 ............'... 41 | 01e0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 42 | 01f0 a1e00000 8fb80004 27190001 0325082a ........'....%.* 43 | 0200 afb90004 00000000 03e00008 27bd0018 ............'... 44 | 0210 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 45 | 0220 a1e00000 8fb80004 27190001 0325082a ........'....%.* 46 | 0230 afb90004 00000000 03e00008 27bd0018 ............'... 47 | 0240 27bdffe8 afa00004 8fae0004 008e7821 '.............x! 48 | 0250 a1e00000 8fb80004 27190001 0325082a ........'....%.* 49 | 0260 afb90004 00000000 03e00008 27bd0018 ............'... 50 | 0270 03e00008 00000000 03e00008 00000000 ................ 51 | Contents of section .options: 52 | 0000 01200000 00000000 80000000 00000000 . .............. 53 | 0010 00000000 00000000 00000000 00007ff0 ................ 54 | 0020 07100000 00000000 00000000 00000000 ................ 55 | 0030 08100000 00000000 00000000 00000000 ................ 56 | Contents of section .reginfo: 57 | 0000 a300c032 00000000 00000000 00000000 ...2............ 58 | 0010 00000000 00007ff0 ........ 59 | -------------------------------------------------------------------------------- /include/PR/os_eeprom.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_eeprom.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_eeprom.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:06 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_EEPROM_H_ 31 | #define _OS_EEPROM_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | #include "os_message.h" 39 | 40 | 41 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 42 | 43 | /************************************************************************** 44 | * 45 | * Type definitions 46 | * 47 | */ 48 | 49 | 50 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 51 | 52 | /************************************************************************** 53 | * 54 | * Global definitions 55 | * 56 | */ 57 | 58 | /* EEPROM TYPE */ 59 | 60 | #define EEPROM_TYPE_4K 0x01 61 | #define EEPROM_TYPE_16K 0x02 62 | 63 | /* definition for EEPROM */ 64 | 65 | #define EEPROM_MAXBLOCKS 64 66 | #define EEP16K_MAXBLOCKS 256 67 | #define EEPROM_BLOCK_SIZE 8 68 | 69 | 70 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 71 | 72 | /************************************************************************** 73 | * 74 | * Macro definitions 75 | * 76 | */ 77 | 78 | 79 | /************************************************************************** 80 | * 81 | * Extern variables 82 | * 83 | */ 84 | 85 | 86 | /************************************************************************** 87 | * 88 | * Function prototypes 89 | * 90 | */ 91 | 92 | /* EEPROM interface */ 93 | 94 | extern s32 osEepromProbe(OSMesgQueue *); 95 | extern s32 osEepromRead(OSMesgQueue *, u8, u8 *); 96 | extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *); 97 | extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int); 98 | extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int); 99 | 100 | 101 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 102 | 103 | #ifdef _LANGUAGE_C_PLUS_PLUS 104 | } 105 | #endif 106 | 107 | #endif /* !_OS_EEPROM_H_ */ 108 | -------------------------------------------------------------------------------- /include/PR/ultratypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRATYPES_H_ 2 | #define _ULTRATYPES_H_ 3 | 4 | 5 | /************************************************************************** 6 | * * 7 | * Copyright (C) 1995, Silicon Graphics, Inc. * 8 | * * 9 | * These coded instructions, statements, and computer programs contain * 10 | * unpublished proprietary information of Silicon Graphics, Inc., and * 11 | * are protected by Federal copyright law. They may not be disclosed * 12 | * to third parties or copied or duplicated in any form, in whole or * 13 | * in part, without the prior written consent of Silicon Graphics, Inc. * 14 | * * 15 | **************************************************************************/ 16 | 17 | 18 | /************************************************************************* 19 | * 20 | * File: ultratypes.h 21 | * 22 | * This file contains various types used in Ultra64 interfaces. 23 | * 24 | * $Revision: 1.6 $ 25 | * $Date: 1997/12/17 04:02:06 $ 26 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultratypes.h,v $ 27 | * 28 | **************************************************************************/ 29 | 30 | 31 | 32 | /********************************************************************** 33 | * General data types for R4300 34 | */ 35 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 36 | 37 | typedef unsigned char u8; /* unsigned 8-bit */ 38 | typedef unsigned short u16; /* unsigned 16-bit */ 39 | typedef unsigned long u32; /* unsigned 32-bit */ 40 | typedef unsigned long long u64; /* unsigned 64-bit */ 41 | 42 | typedef signed char s8; /* signed 8-bit */ 43 | typedef short s16; /* signed 16-bit */ 44 | typedef long s32; /* signed 32-bit */ 45 | typedef long long s64; /* signed 64-bit */ 46 | 47 | typedef volatile unsigned char vu8; /* unsigned 8-bit */ 48 | typedef volatile unsigned short vu16; /* unsigned 16-bit */ 49 | typedef volatile unsigned long vu32; /* unsigned 32-bit */ 50 | typedef volatile unsigned long long vu64; /* unsigned 64-bit */ 51 | 52 | typedef volatile signed char vs8; /* signed 8-bit */ 53 | typedef volatile short vs16; /* signed 16-bit */ 54 | typedef volatile long vs32; /* signed 32-bit */ 55 | typedef volatile long long vs64; /* signed 64-bit */ 56 | 57 | typedef float f32; /* single prec floating point */ 58 | typedef double f64; /* double prec floating point */ 59 | 60 | #if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEF) 61 | #define _SIZE_T 62 | #define _SIZE_T_DEF /* exeGCC size_t define label */ 63 | #if (_MIPS_SZLONG == 32) 64 | typedef unsigned int size_t; 65 | #endif 66 | #if (_MIPS_SZLONG == 64) 67 | typedef unsigned long size_t; 68 | #endif 69 | #endif 70 | 71 | #endif /* _LANGUAGE_C */ 72 | 73 | #ifndef TRUE 74 | #define TRUE 1 75 | #endif 76 | 77 | #ifndef FALSE 78 | #define FALSE 0 79 | #endif 80 | 81 | #ifndef NULL 82 | #define NULL 0 83 | #endif 84 | 85 | #endif /* _ULTRATYPES_H_ */ 86 | -------------------------------------------------------------------------------- /tools/asmproc/tests/test2.objdump: -------------------------------------------------------------------------------- 1 | 2 | tests/test2.o: file format elf32-tradbigmips 3 | 4 | SYMBOL TABLE: 5 | 00000000 l d .text 000000f0 .text 6 | 00000000 l d .rodata 00000060 .rodata 7 | 00000000 g O .rodata 00000001 buf1 8 | 00000000 g F .text 0000001c func1 9 | 0000000c g O .rodata 00000001 buf2 10 | 0000001c g F .text 00000028 func2 11 | 00000010 g O .rodata 00000001 buf3 12 | 00000044 g F .text 0000007c func3 13 | 000000c4 g F .text 00000000 jumptarget 14 | 000000c0 g F .text 0000000c func4 15 | 0000004c g .rodata 00000000 rv 16 | 17 | 18 | RELOCATION RECORDS FOR [.text]: 19 | OFFSET TYPE VALUE 20 | 00000000 R_MIPS_HI16 .rodata 21 | 00000008 R_MIPS_LO16 .rodata 22 | 0000001c R_MIPS_HI16 .rodata 23 | 00000020 R_MIPS_LO16 .rodata 24 | 00000028 R_MIPS_HI16 .rodata 25 | 0000002c R_MIPS_LO16 .rodata 26 | 00000054 R_MIPS_HI16 .rodata 27 | 0000005c R_MIPS_LO16 .rodata 28 | 000000c0 R_MIPS_HI16 rv 29 | 000000c8 R_MIPS_LO16 rv 30 | 31 | 32 | RELOCATION RECORDS FOR [.rodata]: 33 | OFFSET TYPE VALUE 34 | 0000002c R_MIPS_32 .text 35 | 00000030 R_MIPS_32 .text 36 | 00000034 R_MIPS_32 .text 37 | 00000038 R_MIPS_32 .text 38 | 0000003c R_MIPS_32 .text 39 | 00000040 R_MIPS_32 .text 40 | 00000044 R_MIPS_32 .text 41 | 00000048 R_MIPS_32 .text 42 | 0000001c R_MIPS_32 jumptarget 43 | 00000050 R_MIPS_32 jumptarget 44 | 45 | 46 | Contents of section .text: 47 | 0000 3c010000 03e00008 c4200020 03e00008 <........ . .... 48 | 0010 00000000 03e00008 00000000 3c010000 ............<... 49 | 0020 c4240024 e4040000 3c010000 c4260028 .$.$....<....&.( 50 | 0030 e4060000 03e00008 00000000 03e00008 ................ 51 | 0040 00000000 2c810008 10200017 00000000 ....,.... ...... 52 | 0050 00047080 3c010000 002e0821 8c2e002c ..p.<......!..., 53 | 0060 01c00008 00000000 03e00008 24020001 ............$... 54 | 0070 03e00008 24020002 03e00008 24020003 ....$.......$... 55 | 0080 03e00008 24020004 03e00008 24020005 ....$.......$... 56 | 0090 03e00008 24020004 03e00008 24020004 ....$.......$... 57 | 00a0 03e00008 24020004 03e00008 24020003 ....$.......$... 58 | 00b0 03e00008 00000000 03e00008 00000000 ................ 59 | 00c0 3c010000 03e00008 c4200000 03e00008 <........ ...... 60 | 00d0 00000000 03e00008 00000000 03e00008 ................ 61 | 00e0 00000000 03e00008 00000000 00000000 ................ 62 | Contents of section .rodata: 63 | 0000 01000000 66756e63 31000000 02000000 ....func1....... 64 | 0010 03000000 66756e63 34000000 00000004 ....func4....... 65 | 0020 3dcccccd c0651234 c0651235 00000068 =....e.4.e.5...h 66 | 0030 00000070 00000078 00000080 00000088 ...p...x........ 67 | 0040 00000090 00000098 000000a0 3e4ccccd ............>L.. 68 | 0050 00000008 00000000 00000000 00000000 ................ 69 | Contents of section .options: 70 | 0000 01200000 00000000 80004016 00000000 . ........@..... 71 | 0010 00000051 00000000 00000000 00007ff0 ...Q............ 72 | 0020 07100000 00000000 00000000 00000000 ................ 73 | 0030 08100000 00000000 00000000 00000000 ................ 74 | Contents of section .reginfo: 75 | 0000 80004016 00000000 00000051 00000000 ..@........Q.... 76 | 0010 00000000 00007ff0 ........ 77 | -------------------------------------------------------------------------------- /include/PR/os_time.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_time.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_time.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:19 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_TIME_H_ 31 | #define _OS_TIME_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | #include "os_message.h" 39 | 40 | 41 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 42 | 43 | /************************************************************************** 44 | * 45 | * Type definitions 46 | * 47 | */ 48 | 49 | /* 50 | * Structure for time value 51 | */ 52 | typedef u64 OSTime; 53 | 54 | /* 55 | * Structure for interval timer 56 | */ 57 | typedef struct OSTimer_s { 58 | struct OSTimer_s *next; /* point to next timer in list */ 59 | struct OSTimer_s *prev; /* point to previous timer in list */ 60 | OSTime interval; /* duration set by user */ 61 | OSTime value; /* time remaining before */ 62 | /* timer fires */ 63 | OSMesgQueue *mq; /* Message Queue */ 64 | OSMesg msg; /* Message to send */ 65 | } OSTimer; 66 | 67 | 68 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 69 | 70 | /************************************************************************** 71 | * 72 | * Global definitions 73 | * 74 | */ 75 | 76 | 77 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 78 | 79 | /************************************************************************** 80 | * 81 | * Macro definitions 82 | * 83 | */ 84 | 85 | 86 | /************************************************************************** 87 | * 88 | * Extern variables 89 | * 90 | */ 91 | 92 | 93 | /************************************************************************** 94 | * 95 | * Function prototypes 96 | * 97 | */ 98 | 99 | /* Timer interface */ 100 | 101 | extern OSTime osGetTime(void); 102 | extern void osSetTime(OSTime); 103 | extern int osSetTimer(OSTimer *, OSTime, OSTime, 104 | OSMesgQueue *, OSMesg); 105 | extern int osStopTimer(OSTimer *); 106 | 107 | 108 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 109 | 110 | #ifdef _LANGUAGE_C_PLUS_PLUS 111 | } 112 | #endif 113 | 114 | #endif /* !_OS_TIME_H_ */ 115 | -------------------------------------------------------------------------------- /include/PR/mbi.h: -------------------------------------------------------------------------------- 1 | #ifndef _MBI_H_ 2 | #define _MBI_H_ 3 | 4 | /************************************************************************** 5 | * * 6 | * Copyright (C) 1994, Silicon Graphics, Inc. * 7 | * * 8 | * These coded instructions, statements, and computer programs contain * 9 | * unpublished proprietary information of Silicon Graphics, Inc., and * 10 | * are protected by Federal copyright law. They may not be disclosed * 11 | * to third parties or copied or duplicated in any form, in whole or * 12 | * in part, without the prior written consent of Silicon Graphics, Inc. * 13 | * * 14 | **************************************************************************/ 15 | 16 | /************************************************************************** 17 | * 18 | * $Revision: 1.136 $ 19 | * $Date: 1999/01/05 13:04:00 $ 20 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/mbi.h,v $ 21 | * 22 | **************************************************************************/ 23 | 24 | /* 25 | * Header file for the Media Binary Interface 26 | * 27 | * NOTE: This file is included by the RSP microcode, so any C-specific 28 | * constructs must be bracketed by #ifdef _LANGUAGE_C 29 | * 30 | */ 31 | 32 | 33 | /* 34 | * the SHIFT macros are used to build display list commands, inserting 35 | * bit-fields into a 32-bit word. They take a value, a shift amount, 36 | * and a width. 37 | * 38 | * For the left shift, the lower bits of the value are masked, 39 | * then shifted left. 40 | * 41 | * For the right shift, the value is shifted right, then the lower bits 42 | * are masked. 43 | * 44 | * (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment) 45 | * 46 | */ 47 | #define _SHIFTL(v, s, w) \ 48 | ((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s))) 49 | #define _SHIFTR(v, s, w) \ 50 | ((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1))) 51 | 52 | #define _SHIFT _SHIFTL /* old, for compatibility only */ 53 | 54 | #define G_ON (1) 55 | #define G_OFF (0) 56 | 57 | /************************************************************************** 58 | * 59 | * Graphics Binary Interface 60 | * 61 | **************************************************************************/ 62 | 63 | #include 64 | 65 | /************************************************************************** 66 | * 67 | * Audio Binary Interface 68 | * 69 | **************************************************************************/ 70 | 71 | #include 72 | 73 | /************************************************************************** 74 | * 75 | * Task list 76 | * 77 | **************************************************************************/ 78 | 79 | #define M_GFXTASK 1 80 | #define M_AUDTASK 2 81 | #define M_VIDTASK 3 82 | #define M_HVQTASK 6 83 | #define M_HVQMTASK 7 84 | 85 | /************************************************************************** 86 | * 87 | * Segment macros and definitions 88 | * 89 | **************************************************************************/ 90 | 91 | #define NUM_SEGMENTS (16) 92 | #define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff) 93 | #define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28) 94 | #define SEGMENT_ADDR(num, off) (((num) << 24) + (off)) 95 | 96 | #ifndef NULL 97 | #define NULL 0 98 | #endif 99 | 100 | #endif /* !_MBI_H_ */ 101 | -------------------------------------------------------------------------------- /include/PR/os_system.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_system.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_system.h,v $ 26 | $Revision: 1.1 $ 27 | $Date: 1998/10/09 08:01:18 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_SYSTEM_H_ 31 | #define _OS_SYSTEM_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | /* 57 | * Values for osTvType 58 | */ 59 | #define OS_TV_PAL 0 60 | #define OS_TV_NTSC 1 61 | #define OS_TV_MPAL 2 62 | 63 | /* 64 | * Size of buffer the retains contents after NMI 65 | */ 66 | #define OS_APP_NMI_BUFSIZE 64 67 | 68 | 69 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 70 | 71 | /************************************************************************** 72 | * 73 | * Macro definitions 74 | * 75 | */ 76 | 77 | 78 | /************************************************************************** 79 | * 80 | * Extern variables 81 | * 82 | */ 83 | 84 | extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */ 85 | extern void *osRomBase; /* Rom base address of the game image */ 86 | extern s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */ 87 | extern s32 osResetType; /* 0 = cold reset, 1 = NMI */ 88 | extern s32 osCicId; 89 | extern s32 osVersion; 90 | extern u32 osMemSize; /* Memory Size */ 91 | extern s32 osAppNMIBuffer[]; 92 | 93 | extern u64 osClockRate; 94 | 95 | extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */ 96 | 97 | 98 | /************************************************************************** 99 | * 100 | * Function prototypes 101 | * 102 | */ 103 | 104 | extern void osInitialize(void); 105 | extern void osExit(void); 106 | extern u32 osGetMemSize(void); 107 | 108 | /* pre-NMI */ 109 | extern s32 osAfterPreNMI(void); 110 | 111 | 112 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 113 | 114 | #ifdef _LANGUAGE_C_PLUS_PLUS 115 | } 116 | #endif 117 | 118 | #endif /* !_OS_SYSTEM_H_ */ 119 | -------------------------------------------------------------------------------- /tools/asmproc/tests/large.c: -------------------------------------------------------------------------------- 1 | 2 | GLOBAL_ASM( 3 | glabel test 4 | 5 | addiu $sp, $sp, -24 6 | sw $zero, 4($sp) 7 | lw $t6, 4($sp) 8 | addu $t7, $a0, $t6 9 | sb $zero, ($t7) 10 | lw $t8, 4($sp) 11 | addiu $t9, $t8, 1 12 | slt $at, $t9, $a1 13 | sw $t9, 4($sp) 14 | nop 15 | jr $ra 16 | addiu $sp, $sp, 24 17 | addiu $sp, $sp, -24 18 | sw $zero, 4($sp) 19 | lw $t6, 4($sp) 20 | addu $t7, $a0, $t6 21 | sb $zero, ($t7) 22 | lw $t8, 4($sp) 23 | addiu $t9, $t8, 1 24 | slt $at, $t9, $a1 25 | sw $t9, 4($sp) 26 | nop 27 | jr $ra 28 | addiu $sp, $sp, 24 29 | addiu $sp, $sp, -24 30 | sw $zero, 4($sp) 31 | lw $t6, 4($sp) 32 | addu $t7, $a0, $t6 33 | sb $zero, ($t7) 34 | lw $t8, 4($sp) 35 | addiu $t9, $t8, 1 36 | slt $at, $t9, $a1 37 | sw $t9, 4($sp) 38 | nop 39 | jr $ra 40 | addiu $sp, $sp, 24 41 | addiu $sp, $sp, -24 42 | sw $zero, 4($sp) 43 | lw $t6, 4($sp) 44 | addu $t7, $a0, $t6 45 | sb $zero, ($t7) 46 | lw $t8, 4($sp) 47 | addiu $t9, $t8, 1 48 | slt $at, $t9, $a1 49 | sw $t9, 4($sp) 50 | nop 51 | jr $ra 52 | addiu $sp, $sp, 24 53 | addiu $sp, $sp, -24 54 | sw $zero, 4($sp) 55 | lw $t6, 4($sp) 56 | addu $t7, $a0, $t6 57 | sb $zero, ($t7) 58 | lw $t8, 4($sp) 59 | addiu $t9, $t8, 1 60 | slt $at, $t9, $a1 61 | sw $t9, 4($sp) 62 | nop 63 | jr $ra 64 | addiu $sp, $sp, 24 65 | addiu $sp, $sp, -24 66 | sw $zero, 4($sp) 67 | lw $t6, 4($sp) 68 | addu $t7, $a0, $t6 69 | sb $zero, ($t7) 70 | lw $t8, 4($sp) 71 | addiu $t9, $t8, 1 72 | slt $at, $t9, $a1 73 | sw $t9, 4($sp) 74 | nop 75 | jr $ra 76 | addiu $sp, $sp, 24 77 | addiu $sp, $sp, -24 78 | sw $zero, 4($sp) 79 | lw $t6, 4($sp) 80 | addu $t7, $a0, $t6 81 | sb $zero, ($t7) 82 | lw $t8, 4($sp) 83 | addiu $t9, $t8, 1 84 | slt $at, $t9, $a1 85 | sw $t9, 4($sp) 86 | nop 87 | jr $ra 88 | addiu $sp, $sp, 24 89 | addiu $sp, $sp, -24 90 | sw $zero, 4($sp) 91 | lw $t6, 4($sp) 92 | addu $t7, $a0, $t6 93 | sb $zero, ($t7) 94 | lw $t8, 4($sp) 95 | addiu $t9, $t8, 1 96 | slt $at, $t9, $a1 97 | sw $t9, 4($sp) 98 | nop 99 | jr $ra 100 | addiu $sp, $sp, 24 101 | addiu $sp, $sp, -24 102 | sw $zero, 4($sp) 103 | lw $t6, 4($sp) 104 | addu $t7, $a0, $t6 105 | sb $zero, ($t7) 106 | lw $t8, 4($sp) 107 | addiu $t9, $t8, 1 108 | slt $at, $t9, $a1 109 | sw $t9, 4($sp) 110 | nop 111 | jr $ra 112 | addiu $sp, $sp, 24 113 | addiu $sp, $sp, -24 114 | sw $zero, 4($sp) 115 | lw $t6, 4($sp) 116 | addu $t7, $a0, $t6 117 | sb $zero, ($t7) 118 | lw $t8, 4($sp) 119 | addiu $t9, $t8, 1 120 | slt $at, $t9, $a1 121 | sw $t9, 4($sp) 122 | nop 123 | jr $ra 124 | addiu $sp, $sp, 24 125 | addiu $sp, $sp, -24 126 | sw $zero, 4($sp) 127 | lw $t6, 4($sp) 128 | addu $t7, $a0, $t6 129 | sb $zero, ($t7) 130 | lw $t8, 4($sp) 131 | addiu $t9, $t8, 1 132 | slt $at, $t9, $a1 133 | sw $t9, 4($sp) 134 | nop 135 | jr $ra 136 | addiu $sp, $sp, 24 137 | addiu $sp, $sp, -24 138 | sw $zero, 4($sp) 139 | lw $t6, 4($sp) 140 | addu $t7, $a0, $t6 141 | sb $zero, ($t7) 142 | lw $t8, 4($sp) 143 | addiu $t9, $t8, 1 144 | slt $at, $t9, $a1 145 | sw $t9, 4($sp) 146 | nop 147 | jr $ra 148 | addiu $sp, $sp, 24 149 | addiu $sp, $sp, -24 150 | sw $zero, 4($sp) 151 | lw $t6, 4($sp) 152 | addu $t7, $a0, $t6 153 | sb $zero, ($t7) 154 | lw $t8, 4($sp) 155 | addiu $t9, $t8, 1 156 | slt $at, $t9, $a1 157 | sw $t9, 4($sp) 158 | nop 159 | jr $ra 160 | addiu $sp, $sp, 24 161 | 162 | ) 163 | 164 | void foo(void) {} 165 | -------------------------------------------------------------------------------- /include/PR/os_convert.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_convert.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_convert.h,v $ 26 | $Revision: 1.2 $ 27 | $Date: 1999/04/21 02:53:11 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_CONVERT_H_ 31 | #define _OS_CONVERT_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | 48 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 49 | 50 | /************************************************************************** 51 | * 52 | * Global definitions 53 | * 54 | */ 55 | 56 | #define OS_CLOCK_RATE 62500000LL 57 | #define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4) 58 | 59 | 60 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 61 | 62 | /************************************************************************** 63 | * 64 | * Macro definitions 65 | * 66 | */ 67 | 68 | extern u64 osClockRate; 69 | 70 | #define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(osClockRate))/1000000000LL) 71 | #define OS_USEC_TO_CYCLES(n) (((u64)(n)*(osClockRate))/1000000LL) 72 | #define OS_CYCLES_TO_NSEC(c) (((u64)(c)*1000000000LL)/(osClockRate)) 73 | #define OS_CYCLES_TO_USEC(c) (((u64)(c)*1000000LL)/(osClockRate)) 74 | 75 | /* OS_K?_TO_PHYSICAL macro bug fix for CodeWarrior */ 76 | #ifndef __MWERKS__ 77 | #define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000)) 78 | #define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000)) 79 | #else 80 | #define OS_K0_TO_PHYSICAL(x) ((char *)(x)-0x80000000) 81 | #define OS_K1_TO_PHYSICAL(x) ((char *)(x)-0xa0000000) 82 | #endif 83 | 84 | #define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000)) 85 | #define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000)) 86 | 87 | 88 | /************************************************************************** 89 | * 90 | * Extern variables 91 | * 92 | */ 93 | 94 | 95 | /************************************************************************** 96 | * 97 | * Function prototypes 98 | * 99 | */ 100 | 101 | /* Address translation routines and macros */ 102 | 103 | extern u32 osVirtualToPhysical(void *); 104 | extern void * osPhysicalToVirtual(u32); 105 | 106 | 107 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 108 | 109 | #ifdef _LANGUAGE_C_PLUS_PLUS 110 | } 111 | #endif 112 | 113 | #endif /* !_OS_CONVERT_H_ */ 114 | -------------------------------------------------------------------------------- /include/PR/os_debug.h: -------------------------------------------------------------------------------- 1 | 2 | /*==================================================================== 3 | * os_debug.h 4 | * 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 9 | * Inc.; the contents of this file may not be disclosed to third 10 | * parties, copied or duplicated in any form, in whole or in part, 11 | * without the prior written permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to 15 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 16 | * in Technical Data and Computer Software clause at DFARS 17 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 18 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 19 | * Copyright Laws of the United States. 20 | *====================================================================*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | Copyright (C) 1998 Nintendo. (Originated by SGI) 24 | 25 | $RCSfile: os_debug.h,v $ 26 | $Revision: 1.4 $ 27 | $Date: 1999/06/30 03:04:08 $ 28 | *---------------------------------------------------------------------*/ 29 | 30 | #ifndef _OS_DEBUG_H_ 31 | #define _OS_DEBUG_H_ 32 | 33 | #ifdef _LANGUAGE_C_PLUS_PLUS 34 | extern "C" { 35 | #endif 36 | 37 | #include 38 | 39 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 40 | 41 | /************************************************************************** 42 | * 43 | * Type definitions 44 | * 45 | */ 46 | 47 | /* 48 | * Structure for Profiler 49 | */ 50 | typedef struct { 51 | u16 *histo_base; /* histogram base */ 52 | u32 histo_size; /* histogram size */ 53 | u32 *text_start; /* start of text segment */ 54 | u32 *text_end; /* end of text segment */ 55 | } OSProf; 56 | 57 | 58 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 59 | 60 | /************************************************************************** 61 | * 62 | * Global definitions 63 | * 64 | */ 65 | 66 | /* 67 | * Profiler constants 68 | */ 69 | #define PROF_MIN_INTERVAL 50 /* microseconds */ 70 | 71 | 72 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 73 | 74 | /************************************************************************** 75 | * 76 | * Macro definitions 77 | * 78 | */ 79 | 80 | 81 | /************************************************************************** 82 | * 83 | * Extern variables 84 | * 85 | */ 86 | 87 | 88 | /************************************************************************** 89 | * 90 | * Function prototypes 91 | * 92 | */ 93 | 94 | /* Profiler Interface */ 95 | 96 | extern void osProfileInit(OSProf *, u32 profcnt); 97 | extern void osProfileStart(u32); 98 | extern void osProfileFlush(void); 99 | extern void osProfileStop(void); 100 | 101 | /* Thread Profiler Interface */ 102 | extern void osThreadProfileClear(OSId); 103 | extern void osThreadProfileInit(void); 104 | extern void osThreadProfileStart(void); 105 | extern void osThreadProfileStop(void); 106 | extern u32 osThreadProfileReadCount(OSId); 107 | extern u32 osThreadProfileReadCountTh(OSThread*); 108 | extern OSTime osThreadProfileReadTime(OSId); 109 | extern OSTime osThreadProfileReadTimeTh(OSThread*); 110 | 111 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 112 | 113 | #ifdef _LANGUAGE_C_PLUS_PLUS 114 | } 115 | #endif 116 | 117 | #endif /* !_OS_DEBUG_H_ */ 118 | -------------------------------------------------------------------------------- /include/PR/region.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************** 3 | * * 4 | * Copyright (C) 1994, Silicon Graphics, Inc. * 5 | * * 6 | * These coded instructions, statements, and computer programs contain * 7 | * unpublished proprietary information of Silicon Graphics, Inc., and * 8 | * are protected by Federal copyright law. They may not be disclosed * 9 | * to third parties or copied or duplicated in any form, in whole or * 10 | * in part, without the prior written consent of Silicon Graphics, Inc. * 11 | * * 12 | **************************************************************************/ 13 | 14 | /************************************************************************** 15 | * 16 | * Module: region.h 17 | * 18 | * $Revision: 1.8 $ 19 | * $Date: 1997/11/26 00:30:56 $ 20 | * $Author: mitu $ 21 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/region.h,v $ 22 | * 23 | * Description: 24 | * This file contains macros and structure definitions for the region 25 | * library. 26 | * 27 | **************************************************************************/ 28 | 29 | 30 | #ifndef _REGION_H_ 31 | #define _REGION_H_ 32 | 33 | 34 | #ifdef _LANGUAGE_C_PLUS_PLUS 35 | extern "C" { 36 | #endif 37 | 38 | #include 39 | 40 | 41 | /*************************************** 42 | * 43 | * Global defines 44 | * 45 | */ 46 | /* Alignment sizes */ 47 | #define ALIGNSZ (sizeof(long long)) /* 8 bytes */ 48 | #define ALIGNOFFST (ALIGNSZ-1) 49 | 50 | /* size for storing index to free buffer */ 51 | #define BUF_CTRL_SIZE ALIGNSZ 52 | 53 | /* Max bufcount = 32K */ 54 | #define MAX_BUFCOUNT 0x8000 55 | /* code for last free buffer */ 56 | #define BUF_FREE_WO_NEXT 0x8000 57 | 58 | /* 59 | * Global defines for alignment size (default is 8-byte alignment) 60 | */ 61 | #define OS_RG_ALIGN_2B 2 /* 2 bytes = 16-bit alignment */ 62 | #define OS_RG_ALIGN_4B 4 /* 4 bytes = 32-bit alignment */ 63 | #define OS_RG_ALIGN_8B 8 /* 8 bytes = 64-bit alignment */ 64 | #define OS_RG_ALIGN_16B 16 /* 16 bytes = 128-bit alignment */ 65 | 66 | #define OS_RG_ALIGN_DEFAULT OS_RG_ALIGN_8B 67 | 68 | 69 | /*************************************** 70 | * 71 | * Macro definitions 72 | * 73 | */ 74 | 75 | /* Perform alignment on input 's' */ 76 | #define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1)) 77 | 78 | 79 | /*************************************** 80 | * 81 | * Typedefs & structure definitions 82 | * 83 | */ 84 | /* 85 | * Structure for region header/control area 86 | */ 87 | typedef struct _Region_s { 88 | u8 *r_startBufferAddress; /* start address to data buffer */ 89 | u8 *r_endAddress; /* end address of region */ 90 | s32 r_bufferSize; /* size of buffers for this region */ 91 | s32 r_bufferCount; /* up to 32K entries; MSB is used for 92 | setting end-of-list/used */ 93 | u16 r_freeList; /* point to array index of first 94 | available memory buffer */ 95 | u16 r_alignSize; /* alignment size (# of bytes) */ 96 | } OSRegion; 97 | 98 | /* 99 | * Macro to simplify accessing region header structure 100 | */ 101 | #define RP(x) rp->r_##x 102 | 103 | 104 | /*************************************** 105 | * 106 | * Function prototypes 107 | * 108 | */ 109 | extern void *osCreateRegion(void *, u32, u32, u32); 110 | extern void *osMalloc(void *); 111 | extern void osFree(void *, void *); 112 | extern s32 osGetRegionBufCount(void *); 113 | extern s32 osGetRegionBufSize(void *); 114 | 115 | 116 | #ifdef _LANGUAGE_C_PLUS_PLUS 117 | } 118 | #endif 119 | 120 | 121 | #endif /* _REGION_H_ */ 122 | 123 | 124 | -------------------------------------------------------------------------------- /tools/asmproc/build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | from pathlib import Path 4 | import shlex 5 | import subprocess 6 | import tempfile 7 | import uuid 8 | import asm_processor 9 | 10 | # Boolean for debugging purposes 11 | # Preprocessed files are temporary, set to True to keep a copy 12 | keep_preprocessed_files = False 13 | 14 | dir_path = Path(__file__).resolve().parent 15 | asm_prelude_path = dir_path / "prelude.inc" 16 | 17 | all_args = sys.argv[1:] 18 | sep0 = next(index for index, arg in enumerate(all_args) if not arg.startswith("-")) 19 | sep1 = all_args.index("--") 20 | sep2 = all_args.index("--", sep1 + 1) 21 | 22 | asmproc_flags = all_args[:sep0] 23 | compiler = all_args[sep0:sep1] 24 | 25 | assembler_args = all_args[sep1 + 1 : sep2] 26 | assembler_sh = " ".join(shlex.quote(x) for x in assembler_args) 27 | 28 | 29 | compile_args = all_args[sep2 + 1 :] 30 | 31 | in_file = Path(compile_args[-1]) 32 | del compile_args[-1] 33 | 34 | out_ind = compile_args.index("-o") 35 | out_file = Path(compile_args[out_ind + 1]) 36 | del compile_args[out_ind + 1] 37 | del compile_args[out_ind] 38 | 39 | 40 | in_dir = in_file.resolve().parent 41 | opt_flags = [ 42 | x for x in compile_args if x in {"-g3", "-g", "-O0", "-O1", "-O2", "-framepointer", "-KPIC"} 43 | ] 44 | if "-mips2" not in compile_args: 45 | opt_flags.append("-mips1") 46 | 47 | asmproc_flags += opt_flags + [str(in_file)] 48 | 49 | # Drop .mdebug and .gptab sections from resulting binaries. This makes 50 | # resulting .o files much smaller and speeds up builds, but loses line 51 | # number debug data. 52 | # asmproc_flags += ["--drop-mdebug-gptab"] 53 | 54 | # Convert encoding before compiling. 55 | # asmproc_flags += ["--input-enc", "utf-8", "--output-enc", "euc-jp"] 56 | 57 | with tempfile.TemporaryDirectory(prefix="asm_processor") as tmpdirname: 58 | tmpdir_path = Path(tmpdirname) 59 | preprocessed_filename = "preprocessed_" + uuid.uuid4().hex + in_file.suffix 60 | preprocessed_path = tmpdir_path / preprocessed_filename 61 | 62 | with preprocessed_path.open("wb") as f: 63 | functions, deps = asm_processor.run(asmproc_flags, outfile=f) 64 | 65 | if keep_preprocessed_files: 66 | import shutil 67 | 68 | keep_output_dir = Path("./asm_processor_preprocessed") 69 | keep_output_dir.mkdir(parents=True, exist_ok=True) 70 | 71 | shutil.copy( 72 | preprocessed_path, 73 | keep_output_dir / (in_file.stem + "_" + preprocessed_filename), 74 | ) 75 | 76 | compile_cmdline = ( 77 | compiler 78 | + compile_args 79 | + ["-I", str(in_dir), "-o", str(out_file), str(preprocessed_path)] 80 | ) 81 | 82 | try: 83 | subprocess.check_call(compile_cmdline) 84 | except subprocess.CalledProcessError as e: 85 | print("Failed to compile file " + str(in_file) + ". Command line:") 86 | print() 87 | print(" ".join(shlex.quote(x) for x in compile_cmdline)) 88 | print() 89 | sys.exit(55) 90 | 91 | asm_processor.run( 92 | asmproc_flags 93 | + [ 94 | "--post-process", 95 | str(out_file), 96 | "--assembler", 97 | assembler_sh, 98 | "--asm-prelude", 99 | str(asm_prelude_path), 100 | ], 101 | functions=functions, 102 | ) 103 | 104 | deps_file = out_file.with_suffix(".asmproc.d") 105 | if deps: 106 | with deps_file.open("w") as f: 107 | f.write(str(out_file) + ": " + " \\\n ".join(deps) + "\n") 108 | for dep in deps: 109 | f.write("\n" + dep + ":\n") 110 | else: 111 | try: 112 | deps_file.unlink() 113 | except OSError: 114 | pass 115 | -------------------------------------------------------------------------------- /include/PR/ramrom.h: -------------------------------------------------------------------------------- 1 | #ifndef _RAMROM_H 2 | #define _RAMROM_H 3 | 4 | /************************************************************************** 5 | * * 6 | * Copyright (C) 1994, Silicon Graphics, Inc. * 7 | * * 8 | * These coded instructions, statements, and computer programs contain * 9 | * unpublished proprietary information of Silicon Graphics, Inc., and * 10 | * are protected by Federal copyright law. They may not be disclosed * 11 | * to third parties or copied or duplicated in any form, in whole or * 12 | * in part, without the prior written consent of Silicon Graphics, Inc. * 13 | * * 14 | **************************************************************************/ 15 | 16 | /************************************************************************** 17 | * 18 | * $Revision: 1.20 $ 19 | * $Date: 1997/02/11 08:26:47 $ 20 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ramrom.h,v $ 21 | * 22 | **************************************************************************/ 23 | 24 | /* 25 | * Defines for the GIO card in the Nintendo Development Station 26 | * 27 | * The RAM on the GIO card acts as ROM for the game 28 | * Interrupts available between the game and the Indy host 29 | * 30 | * The last part of the ramrom is used for communication between 31 | * game and host. There are 6 4K buffers defined: 32 | * log, printf, rmon to indy, rmon from indy, app to indy, app from indy 33 | * The last 8 bytes of the buffer are used in the emulator environment 34 | */ 35 | 36 | #define RAMROM_SIZE (0x1000000) 37 | 38 | #define RAMROM_BUF_SIZE (4096) 39 | #define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6) 40 | #define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE) 41 | #define RAMROM_MSG_HDR_SIZE (3*sizeof(long)) 42 | #define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE) 43 | 44 | #define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE)) 45 | #define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE)) 46 | #define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE)) 47 | #define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE)) 48 | #define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE)) 49 | #define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE)) 50 | 51 | /*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/ 52 | 53 | /* 54 | * For the initial round of PIF bringup, we will load in a bootstrap loader 55 | * 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000 56 | */ 57 | #ifndef _HW_VERSION_1 58 | #define RAMROM_BOOTSTRAP_OFFSET 0x40 59 | #define RAMROM_GAME_OFFSET 0x1000 60 | #define RAMROM_FONTDATA_OFFSET 0xb70 61 | #define RAMROM_FONTDATA_SIZE 1152 62 | #else 63 | #define RAMROM_BOOTSTRAP_OFFSET 0x400 64 | #define RAMROM_GAME_OFFSET 0x2000 65 | #endif 66 | #define RAMROM_CLOCKRATE_OFFSET 0x4 67 | #define RAMROM_CLOCKRATE_MASK 0xfffffff0 68 | #define RAMROM_BOOTADDR_OFFSET 0x8 69 | #define RAMROM_RELEASE_OFFSET 0xc 70 | /* 71 | * Second version of the PIF jumps to location 0x1000, and we'll put a jump to 72 | * location 0x400 into the ramrom (for backwards compatibility). 73 | */ 74 | #define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000 75 | 76 | typedef struct { 77 | long type; 78 | long length; /* in bytes of userdata */ 79 | long magic; 80 | char userdata[RAMROM_USER_DATA_SIZE]; 81 | } RamRomBuffer; 82 | 83 | /* 84 | * Interrupt values (must fit in 6 bits!) 85 | * values are used for both request & response 86 | * Transactions initiated by the host start with HOST 87 | * and those initiated by the target start with GAME. 88 | */ 89 | 90 | #define HOST_PIACCESS_REQ 1 91 | #define HOST_DBG_CMD_READY 2 92 | #define GAME_DBG_DATA_SEND 3 93 | #define HOST_DBG_DATA_ACK 4 94 | #define GAME_PRINTF_SEND 5 95 | #define HOST_PRINTF_ACK 6 96 | #define GAME_LOG_SEND 7 97 | #define HOST_LOG_ACK 8 98 | #define HOST_APP_CMD_READY 9 99 | #define GAME_APP_DATA_READY 10 100 | #define HOST_PROF_REQ 11 101 | #define GAME_PROF_SEND 12 102 | #define HOST_PROF_ACK 13 103 | #define GAME_FAULT_SEND 14 104 | #define HOST_FAULT_ACK 15 105 | #define GAME_EXIT 16 106 | #define HOST_DATA_ACK 17 107 | 108 | #ifdef _EMULATOR 109 | void __RamRomInit(int key, void *romaddr); 110 | void __RamRomDestroy(int key); 111 | #endif /* _EMULATOR */ 112 | 113 | #endif /* !_RAMROM_H */ 114 | -------------------------------------------------------------------------------- /include/PR/sched.h: -------------------------------------------------------------------------------- 1 | /*==================================================================== 2 | * sched.h 3 | * 4 | * Synopsis: 5 | * 6 | * Copyright 1993, Silicon Graphics, Inc. 7 | * All Rights Reserved. 8 | * 9 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 10 | * Inc.; the contents of this file may not be disclosed to third 11 | * parties, copied or duplicated in any form, in whole or in part, 12 | * without the prior written permission of Silicon Graphics, Inc. 13 | * 14 | * RESTRICTED RIGHTS LEGEND: 15 | * Use, duplication or disclosure by the Government is subject to 16 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 17 | * in Technical Data and Computer Software clause at DFARS 18 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 19 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 20 | * Copyright Laws of the United States. 21 | *====================================================================*/ 22 | 23 | /************************************************************************** 24 | * 25 | * $Revision: 1.7 $ 26 | * $Date: 1997/02/11 08:32:02 $ 27 | * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sched.h,v $ 28 | * 29 | **************************************************************************/ 30 | 31 | #ifndef __sched__ 32 | #define __sched__ 33 | 34 | #include 35 | 36 | #define OS_SC_STACKSIZE 0x2000 37 | 38 | #define OS_SC_RETRACE_MSG 1 39 | #define OS_SC_DONE_MSG 2 40 | #define OS_SC_RDP_DONE_MSG 3 41 | #define OS_SC_PRE_NMI_MSG 4 42 | #define OS_SC_LAST_MSG 4 /* this should have highest number */ 43 | #define OS_SC_MAX_MESGS 8 44 | 45 | typedef struct { 46 | short type; 47 | char misc[30]; 48 | } OSScMsg; 49 | 50 | typedef struct OSScTask_s { 51 | struct OSScTask_s *next; /* note: this must be first */ 52 | u32 state; 53 | u32 flags; 54 | void *framebuffer; /* used by graphics tasks */ 55 | 56 | OSTask list; 57 | OSMesgQueue *msgQ; 58 | OSMesg msg; 59 | #ifndef _FINALROM /* all #ifdef items should */ 60 | OSTime startTime; /* remain at the end!!, or */ 61 | OSTime totalTime; /* possible conflict if */ 62 | #endif /* FINALROM library used with */ 63 | } OSScTask; /* non FINALROM code */ 64 | 65 | /* 66 | * OSScTask flags: 67 | */ 68 | #define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */ 69 | #define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */ 70 | #define OS_SC_DRAM_DLIST 0x0004 /* SP & DP communicate through DRAM */ 71 | #define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */ 72 | #define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */ 73 | #define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */ 74 | 75 | #define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */ 76 | #define OS_SC_TYPE_MASK 0x0007 /* complete type mask */ 77 | /* 78 | * OSScClient: 79 | * 80 | * Data structure used by threads that wish to communicate to the 81 | * scheduling thread 82 | * 83 | */ 84 | typedef struct SCClient_s { 85 | struct SCClient_s *next; /* next client in the list */ 86 | OSMesgQueue *msgQ; /* where to send the frame msg */ 87 | } OSScClient; 88 | 89 | typedef struct { 90 | OSScMsg retraceMsg; 91 | OSScMsg prenmiMsg; 92 | OSMesgQueue interruptQ; 93 | OSMesg intBuf[OS_SC_MAX_MESGS]; 94 | OSMesgQueue cmdQ; 95 | OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; 96 | OSThread thread; 97 | OSScClient *clientList; 98 | OSScTask *audioListHead; 99 | OSScTask *gfxListHead; 100 | OSScTask *audioListTail; 101 | OSScTask *gfxListTail; 102 | OSScTask *curRSPTask; 103 | OSScTask *curRDPTask; 104 | u32 frameCount; 105 | s32 doAudio; 106 | } OSSched; 107 | 108 | void osCreateScheduler(OSSched *s, void *stack, OSPri priority, 109 | u8 mode, u8 numFields); 110 | void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ); 111 | void osScRemoveClient(OSSched *s, OSScClient *c); 112 | OSMesgQueue *osScGetCmdQ(OSSched *s); 113 | 114 | #endif 115 | 116 | --------------------------------------------------------------------------------