From 3fcdeebd894bc06d7d5b96cf5a1202000f0f619a Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sun, 2 Aug 2020 10:12:41 -0500 Subject: [PATCH] Made ./generate_ld automatic, and moved some more asm libultra functions. --- Makefile | 4 ++++ lib/asm/__osGetSR.s | 16 ++++++++++++++++ lib/asm/__osSetFpcCsr.s | 15 +++++++++++++++ lib/asm/__osSetSR.s | 16 ++++++++++++++++ .../{non_matchings/unknown_0CA9A0 => }/bcopy.s | 10 ++++++++++ .../non_matchings/unknown_0CCF90/osInitialize.s | 2 +- lib/asm/non_matchings/unknown_0D4270/__osGetSR.s | 6 ------ .../non_matchings/unknown_0D4270/__osSetFpcCsr.s | 6 ------ lib/asm/non_matchings/unknown_0D4270/__osSetSR.s | 6 ------ .../__osSiRawReadIo.s | 0 .../__osSiRawWriteIo.s | 0 .../func_800D47F0.s | 0 .../osPiRawWriteIo.s | 0 .../osWritebackICache.s => osInvalICache.s} | 12 +++++++++++- .../unknown_0D4270 => }/osMapTLBRdb.s | 10 ++++++++++ .../unknown_0D4270 => }/osWritebackDCache.s | 11 +++++++++++ lib/src/unknown_0CA9A0.c | 3 +-- lib/src/unknown_0D4270.c | 10 ---------- lib/src/unknown_0D5190.c | 8 ++++++++ lib/src/unknown_0D5390.c | 8 ++++++++ 20 files changed, 111 insertions(+), 32 deletions(-) create mode 100644 lib/asm/__osGetSR.s create mode 100644 lib/asm/__osSetFpcCsr.s create mode 100644 lib/asm/__osSetSR.s rename lib/asm/{non_matchings/unknown_0CA9A0 => }/bcopy.s (97%) delete mode 100644 lib/asm/non_matchings/unknown_0D4270/__osGetSR.s delete mode 100644 lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s delete mode 100644 lib/asm/non_matchings/unknown_0D4270/__osSetSR.s rename lib/asm/non_matchings/{unknown_0D4270 => unknown_0D5190}/__osSiRawReadIo.s (100%) rename lib/asm/non_matchings/{unknown_0D4270 => unknown_0D5190}/__osSiRawWriteIo.s (100%) rename lib/asm/non_matchings/{unknown_0D4270 => unknown_0D5390}/func_800D47F0.s (100%) rename lib/asm/non_matchings/{unknown_0D4270 => unknown_0D5390}/osPiRawWriteIo.s (100%) rename lib/asm/{non_matchings/unknown_0D4270/osWritebackICache.s => osInvalICache.s} (84%) rename lib/asm/{non_matchings/unknown_0D4270 => }/osMapTLBRdb.s (78%) rename lib/asm/{non_matchings/unknown_0D4270 => }/osWritebackDCache.s (85%) create mode 100644 lib/src/unknown_0D5190.c create mode 100644 lib/src/unknown_0D5390.c diff --git a/Makefile b/Makefile index a71e0ccb..1a7ae5f3 100755 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ ifeq ($(wildcard ./assets/.*),) $(error Error, /assets/ folder was not found. Did you run the ./setup.sh script?) endif +#################### Generate linker file #################### + +GENERATE_LD := $(shell ./generate_ld.sh) + ################ Target Executable and Sources ############### # BUILD_DIR is location where all build artifacts are placed diff --git a/lib/asm/__osGetSR.s b/lib/asm/__osGetSR.s new file mode 100644 index 00000000..9abea28b --- /dev/null +++ b/lib/asm/__osGetSR.s @@ -0,0 +1,16 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4570 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + +glabel __osGetSR +/* 0D5170 800D4570 40026000 */ mfc0 $v0, $12 +/* 0D5174 800D4574 03E00008 */ jr $ra +/* 0D5178 800D4578 00000000 */ nop + +/* 0D517C 800D457C 00000000 */ nop diff --git a/lib/asm/__osSetFpcCsr.s b/lib/asm/__osSetFpcCsr.s new file mode 100644 index 00000000..35101507 --- /dev/null +++ b/lib/asm/__osSetFpcCsr.s @@ -0,0 +1,15 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4580 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + +glabel __osSetFpcCsr +/* 0D5180 800D4580 4442F800 */ cfc1 $v0, $31 +/* 0D5184 800D4584 44C4F800 */ ctc1 $a0, $31 +/* 0D5188 800D4588 03E00008 */ jr $ra +/* 0D518C 800D458C 00000000 */ nop diff --git a/lib/asm/__osSetSR.s b/lib/asm/__osSetSR.s new file mode 100644 index 00000000..d252f9d4 --- /dev/null +++ b/lib/asm/__osSetSR.s @@ -0,0 +1,16 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4560 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + +glabel __osSetSR +/* 0D5160 800D4560 40846000 */ mtc0 $a0, $12 +/* 0D5164 800D4564 00000000 */ nop +/* 0D5168 800D4568 03E00008 */ jr $ra +/* 0D516C 800D456C 00000000 */ nop + diff --git a/lib/asm/non_matchings/unknown_0CA9A0/bcopy.s b/lib/asm/bcopy.s similarity index 97% rename from lib/asm/non_matchings/unknown_0CA9A0/bcopy.s rename to lib/asm/bcopy.s index 200f57d3..bfdd7f35 100644 --- a/lib/asm/non_matchings/unknown_0CA9A0/bcopy.s +++ b/lib/asm/bcopy.s @@ -1,3 +1,13 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C9DA0 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + glabel bcopy /* 0CA9A0 800C9DA0 10C0001A */ beqz $a2, .L800C9E0C /* 0CA9A4 800C9DA4 00A03825 */ move $a3, $a1 diff --git a/lib/asm/non_matchings/unknown_0CCF90/osInitialize.s b/lib/asm/non_matchings/unknown_0CCF90/osInitialize.s index a383f465..1ce2eb20 100644 --- a/lib/asm/non_matchings/unknown_0CCF90/osInitialize.s +++ b/lib/asm/non_matchings/unknown_0CCF90/osInitialize.s @@ -97,7 +97,7 @@ glabel osInitialize /* 0CD30C 800CC70C 0C03518C */ jal osWritebackDCache /* 0CD310 800CC710 ADF8000C */ sw $t8, %lo(D_8000000C)($t7) /* 0CD314 800CC714 3C048000 */ lui $a0, 0x8000 -/* 0CD318 800CC718 0C0351AC */ jal osWritebackICache +/* 0CD318 800CC718 0C0351AC */ jal osInvalICache /* 0CD31C 800CC71C 24050190 */ li $a1, 400 /* 0CD320 800CC720 0C0351CC */ jal osMapTLBRdb /* 0CD324 800CC724 00000000 */ nop diff --git a/lib/asm/non_matchings/unknown_0D4270/__osGetSR.s b/lib/asm/non_matchings/unknown_0D4270/__osGetSR.s deleted file mode 100644 index a4af5c8d..00000000 --- a/lib/asm/non_matchings/unknown_0D4270/__osGetSR.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel __osGetSR -/* 0D5170 800D4570 40026000 */ mfc0 $v0, $12 -/* 0D5174 800D4574 03E00008 */ jr $ra -/* 0D5178 800D4578 00000000 */ nop - -/* 0D517C 800D457C 00000000 */ nop diff --git a/lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s b/lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s deleted file mode 100644 index de5ca5f8..00000000 --- a/lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel __osSetFpcCsr -/* 0D5180 800D4580 4442F800 */ cfc1 $v0, $31 -/* 0D5184 800D4584 44C4F800 */ ctc1 $a0, $31 -/* 0D5188 800D4588 03E00008 */ jr $ra -/* 0D518C 800D458C 00000000 */ nop - diff --git a/lib/asm/non_matchings/unknown_0D4270/__osSetSR.s b/lib/asm/non_matchings/unknown_0D4270/__osSetSR.s deleted file mode 100644 index c610f369..00000000 --- a/lib/asm/non_matchings/unknown_0D4270/__osSetSR.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel __osSetSR -/* 0D5160 800D4560 40846000 */ mtc0 $a0, $12 -/* 0D5164 800D4564 00000000 */ nop -/* 0D5168 800D4568 03E00008 */ jr $ra -/* 0D516C 800D456C 00000000 */ nop - diff --git a/lib/asm/non_matchings/unknown_0D4270/__osSiRawReadIo.s b/lib/asm/non_matchings/unknown_0D5190/__osSiRawReadIo.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D4270/__osSiRawReadIo.s rename to lib/asm/non_matchings/unknown_0D5190/__osSiRawReadIo.s diff --git a/lib/asm/non_matchings/unknown_0D4270/__osSiRawWriteIo.s b/lib/asm/non_matchings/unknown_0D5190/__osSiRawWriteIo.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D4270/__osSiRawWriteIo.s rename to lib/asm/non_matchings/unknown_0D5190/__osSiRawWriteIo.s diff --git a/lib/asm/non_matchings/unknown_0D4270/func_800D47F0.s b/lib/asm/non_matchings/unknown_0D5390/func_800D47F0.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D4270/func_800D47F0.s rename to lib/asm/non_matchings/unknown_0D5390/func_800D47F0.s diff --git a/lib/asm/non_matchings/unknown_0D4270/osPiRawWriteIo.s b/lib/asm/non_matchings/unknown_0D5390/osPiRawWriteIo.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D4270/osPiRawWriteIo.s rename to lib/asm/non_matchings/unknown_0D5390/osPiRawWriteIo.s diff --git a/lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s b/lib/asm/osInvalICache.s similarity index 84% rename from lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s rename to lib/asm/osInvalICache.s index fc8e035c..dec7d2dd 100644 --- a/lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s +++ b/lib/asm/osInvalICache.s @@ -1,4 +1,14 @@ -glabel osWritebackICache +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D46B0 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + +glabel osInvalICache /* 0D52B0 800D46B0 18A00011 */ blez $a1, .L800D46F8 /* 0D52B4 800D46B4 00000000 */ nop /* 0D52B8 800D46B8 240B4000 */ li $t3, 16384 diff --git a/lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s b/lib/asm/osMapTLBRdb.s similarity index 78% rename from lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s rename to lib/asm/osMapTLBRdb.s index fef03659..14874513 100644 --- a/lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s +++ b/lib/asm/osMapTLBRdb.s @@ -1,3 +1,13 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4730 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + glabel osMapTLBRdb /* 0D5330 800D4730 40085000 */ mfc0 $t0, $10 /* 0D5334 800D4734 2409001F */ li $t1, 31 diff --git a/lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s b/lib/asm/osWritebackDCache.s similarity index 85% rename from lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s rename to lib/asm/osWritebackDCache.s index 832979a4..db6ff14f 100644 --- a/lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s +++ b/lib/asm/osWritebackDCache.s @@ -1,3 +1,14 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4630 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + + glabel osWritebackDCache /* 0D5230 800D4630 18A00011 */ blez $a1, .L800D4678 /* 0D5234 800D4634 00000000 */ nop diff --git a/lib/src/unknown_0CA9A0.c b/lib/src/unknown_0CA9A0.c index 81d89f83..4cbd9eec 100644 --- a/lib/src/unknown_0CA9A0.c +++ b/lib/src/unknown_0CA9A0.c @@ -1,10 +1,9 @@ /* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800C9DA0 */ +/* RAM_POS: 0x800CA0B0 */ #include "types.h" #include "macros.h" -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/bcopy.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/func_800CA0B0.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/D_800CA0D0.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/D_800CAA7C.s") diff --git a/lib/src/unknown_0D4270.c b/lib/src/unknown_0D4270.c index e9e75c2f..f9d02b98 100644 --- a/lib/src/unknown_0D4270.c +++ b/lib/src/unknown_0D4270.c @@ -10,13 +10,3 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osPiGetCmdQueue.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/func_800D3820.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/_Putfld.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/_Printf.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSetSR.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osGetSR.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSiRawReadIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSiRawWriteIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osPiRawWriteIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/func_800D47F0.s") diff --git a/lib/src/unknown_0D5190.c b/lib/src/unknown_0D5190.c new file mode 100644 index 00000000..36dca54f --- /dev/null +++ b/lib/src/unknown_0D5190.c @@ -0,0 +1,8 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4590 */ + +#include "types.h" +#include "macros.h" + +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D5190/__osSiRawReadIo.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D5190/__osSiRawWriteIo.s") diff --git a/lib/src/unknown_0D5390.c b/lib/src/unknown_0D5390.c new file mode 100644 index 00000000..3ec756cd --- /dev/null +++ b/lib/src/unknown_0D5390.c @@ -0,0 +1,8 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D4790 */ + +#include "types.h" +#include "macros.h" + +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D5390/osPiRawWriteIo.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D5390/func_800D47F0.s")