From f594ae8bebf223347a68dfe4de57fe6c69664e0a Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sat, 5 Jun 2021 16:40:12 -0500 Subject: [PATCH] Moved rodata from C to GLOBAL_ASM in lib/unknown_0D3160 --- Makefile | 1 + .../unknown_0CCF90/guPerspectiveF.s | 5 +++ .../unknown_0D3160/__osDevMgrMain.s | 15 ++++++-- lib/src/unknown_0D3160.c | 34 ------------------- lib/src/unknown_0D3360.c | 29 ++++++++++++++++ 5 files changed, 48 insertions(+), 36 deletions(-) create mode 100644 lib/src/unknown_0D3360.c diff --git a/Makefile b/Makefile index d7f0ca6d..b9eb4931 100755 --- a/Makefile +++ b/Makefile @@ -272,6 +272,7 @@ $(BUILD_DIR)/lib/src/unknown_0C91A0.o : OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D29F0.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0CDE90.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D3160.o: OPT_FLAGS := -O1 +$(BUILD_DIR)/lib/src/unknown_0D3360.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D5EC0.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0C9C90.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 $(BUILD_DIR)/lib/src/osCreateThread.o : OPT_FLAGS := -O1 diff --git a/lib/asm/non_matchings/unknown_0CCF90/guPerspectiveF.s b/lib/asm/non_matchings/unknown_0CCF90/guPerspectiveF.s index c40711e2..a593c03f 100644 --- a/lib/asm/non_matchings/unknown_0CCF90/guPerspectiveF.s +++ b/lib/asm/non_matchings/unknown_0CCF90/guPerspectiveF.s @@ -1,3 +1,8 @@ +.late_rodata +glabel D_800E9640 +.double 0.017453292222222222 + +.text glabel guPerspectiveF /* 0CD520 800CC920 27BDFFD0 */ addiu $sp, $sp, -0x30 /* 0CD524 800CC924 44867000 */ mtc1 $a2, $f14 diff --git a/lib/asm/non_matchings/unknown_0D3160/__osDevMgrMain.s b/lib/asm/non_matchings/unknown_0D3160/__osDevMgrMain.s index 90b4a7d3..85ec3a1a 100644 --- a/lib/asm/non_matchings/unknown_0D3160/__osDevMgrMain.s +++ b/lib/asm/non_matchings/unknown_0D3160/__osDevMgrMain.s @@ -1,3 +1,8 @@ +.late_rodata +glabel jpt_800E9650 +.word L800D2A70, L800D2964, L800D29A4, L800D2A90, L800D2A90, L800D29E0, L800D2A28 + +.text glabel __osDevMgrMain /* 0D3360 800D2760 27BDFFC0 */ addiu $sp, $sp, -0x40 /* 0D3364 800D2764 AFA40040 */ sw $a0, 0x40($sp) @@ -131,11 +136,12 @@ glabel __osDevMgrMain /* 0D3544 800D2944 10200052 */ beqz $at, .L800D2A90 /* 0D3548 800D2948 00000000 */ nop /* 0D354C 800D294C 00084080 */ sll $t0, $t0, 2 -/* 0D3550 800D2950 3C01800F */ lui $at, %hi(D_800E9650) # $at, 0x800f +/* 0D3550 800D2950 3C01800F */ lui $at, %hi(jpt_800E9650) # $at, 0x800f /* 0D3554 800D2954 00280821 */ addu $at, $at, $t0 -/* 0D3558 800D2958 8C289650 */ lw $t0, %lo(D_800E9650)($at) +/* 0D3558 800D2958 8C289650 */ lw $t0, %lo(jpt_800E9650)($at) /* 0D355C 800D295C 01000008 */ jr $t0 /* 0D3560 800D2960 00000000 */ nop +glabel L800D2964 /* 0D3564 800D2964 8FAC002C */ lw $t4, 0x2c($sp) /* 0D3568 800D2968 27A50034 */ addiu $a1, $sp, 0x34 /* 0D356C 800D296C 24060001 */ li $a2, 1 @@ -152,6 +158,7 @@ glabel __osDevMgrMain /* 0D3598 800D2998 00000000 */ nop /* 0D359C 800D299C 1000003E */ b .L800D2A98 /* 0D35A0 800D29A0 AFA20030 */ sw $v0, 0x30($sp) +glabel L800D29A4 /* 0D35A4 800D29A4 8FAB002C */ lw $t3, 0x2c($sp) /* 0D35A8 800D29A8 27A50034 */ addiu $a1, $sp, 0x34 /* 0D35AC 800D29AC 24060001 */ li $a2, 1 @@ -167,6 +174,7 @@ glabel __osDevMgrMain /* 0D35D4 800D29D4 8DA70010 */ lw $a3, 0x10($t5) /* 0D35D8 800D29D8 1000002F */ b .L800D2A98 /* 0D35DC 800D29DC AFA20030 */ sw $v0, 0x30($sp) +glabel L800D29E0 /* 0D35E0 800D29E0 8FAA002C */ lw $t2, 0x2c($sp) /* 0D35E4 800D29E4 27A50034 */ addiu $a1, $sp, 0x34 /* 0D35E8 800D29E8 24060001 */ li $a2, 1 @@ -185,6 +193,7 @@ glabel __osDevMgrMain /* 0D361C 800D2A1C 00000000 */ nop /* 0D3620 800D2A20 1000001D */ b .L800D2A98 /* 0D3624 800D2A24 AFA20030 */ sw $v0, 0x30($sp) +glabel L800D2A28 /* 0D3628 800D2A28 8FAC002C */ lw $t4, 0x2c($sp) /* 0D362C 800D2A2C 27A50034 */ addiu $a1, $sp, 0x34 /* 0D3630 800D2A30 24060001 */ li $a2, 1 @@ -203,6 +212,7 @@ glabel __osDevMgrMain /* 0D3664 800D2A64 00000000 */ nop /* 0D3668 800D2A68 1000000B */ b .L800D2A98 /* 0D366C 800D2A6C AFA20030 */ sw $v0, 0x30($sp) +glabel L800D2A70 /* 0D3670 800D2A70 8FAE003C */ lw $t6, 0x3c($sp) /* 0D3674 800D2A74 00003025 */ move $a2, $zero /* 0D3678 800D2A78 8DC40004 */ lw $a0, 4($t6) @@ -212,6 +222,7 @@ glabel __osDevMgrMain /* 0D3688 800D2A88 10000003 */ b .L800D2A98 /* 0D368C 800D2A8C AFAA0030 */ sw $t2, 0x30($sp) .L800D2A90: +glabel L800D2A90 /* 0D3690 800D2A90 240FFFFF */ li $t7, -1 /* 0D3694 800D2A94 AFAF0030 */ sw $t7, 0x30($sp) .L800D2A98: diff --git a/lib/src/unknown_0D3160.c b/lib/src/unknown_0D3160.c index 3d95cfc6..e754a52f 100644 --- a/lib/src/unknown_0D3160.c +++ b/lib/src/unknown_0D3160.c @@ -6,19 +6,6 @@ #include "libultra_internal.h" #include "hardware.h" -/************ .rodata ************/ - -const DoubleLiteral D_800E9640 = { 0.017453292222222222 }; -const DoubleLiteral D_800E9648 = { 0.0 }; // This is probably a file boundary. This file needs to be split. - -// Jump table in __osDevMgrMain -const u32 D_800E9650[] = { - 0x800D2A70, 0x800D2964, 0x800D29A4, 0x800D2A90, - 0x800D2A90, 0x800D29E0, 0x800D2A28 -}; - -/*********************************/ - GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s") @@ -49,24 +36,3 @@ s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) } GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/osEPiRawStartDma.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDevMgrMain.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osViInit.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/alSynDelete.s") - -void __osDequeueThread(OSThread **queue, OSThread *t) -{ - register OSThread *pred; - register OSThread *succ; - pred = (OSThread *)queue; //this is actually legit.. - succ = pred->next; - while (succ != NULL) - { - if (succ == t) - { - pred->next = t->next; - return; - } - pred = succ; - succ = pred->next; - } -} \ No newline at end of file diff --git a/lib/src/unknown_0D3360.c b/lib/src/unknown_0D3360.c new file mode 100644 index 00000000..687ccda5 --- /dev/null +++ b/lib/src/unknown_0D3360.c @@ -0,0 +1,29 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D2760 */ + +#include "types.h" +#include "macros.h" +#include "libultra_internal.h" +#include "hardware.h" + +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDevMgrMain.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osViInit.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/alSynDelete.s") + +void __osDequeueThread(OSThread **queue, OSThread *t) +{ + register OSThread *pred; + register OSThread *succ; + pred = (OSThread *)queue; //this is actually legit.. + succ = pred->next; + while (succ != NULL) + { + if (succ == t) + { + pred->next = t->next; + return; + } + pred = succ; + succ = pred->next; + } +}