From e55c67451735c68cee673b5b32c04acb9b9c3b7a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 8 Sep 2024 20:39:43 -0500 Subject: [PATCH] PAL: core1 initialized --- Makefile | 4 +- decompressed.pal.yaml | 200 +++++++++++++++++++++--------------------- manual_syms.pal.txt | 84 ------------------ src/core1/ll.c | 45 ---------- src/core1/ll_cvt.c | 39 ++++++++ symbol_addrs.pal.txt | 45 ++++------ 6 files changed, 157 insertions(+), 260 deletions(-) create mode 100644 src/core1/ll_cvt.c diff --git a/Makefile b/Makefile index 6993d52c..cb486817 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ BIN_OBJS := $(filter-out $(ASSET_OBJS),$(BIN_OBJS)) ALL_OBJS := $(C_OBJS) $(ASM_OBJS) $(BIN_OBJS) SYMBOL_ADDRS := symbol_addrs.$(VERSION).txt SYMBOL_ADDR_FILES := $(filter-out $(SYMBOL_ADDRS), $(wildcard symbol_addrs.*.$(VERSION).txt)) -MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/core1/ll.c.o +MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/core1/ll.c.o $(BUILD_DIR)/$(SRC_ROOT)/core1/ll_cvt.c.o BOOT_MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/done/ll.c.o BOOT_C_OBJS := $(filter-out $(BOOT_MIPS3_OBJS),$(BOOT_C_OBJS)) COMPRESSED_SYMBOLS := $(BUILD_DIR)/compressed_symbols.txt @@ -386,6 +386,8 @@ build/$(VERSION)/src/core1/audio/%.c.o: OPT_FLAGS = -O3 build/$(VERSION)/src/core1/audio/%.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR build/$(VERSION)/src/core1/ll.c.o: OPT_FLAGS := -O1 build/$(VERSION)/src/core1/ll.c.o: MIPSBIT := -mips3 -o32 +build/$(VERSION)/src/core1/ll_cvt.c.o: OPT_FLAGS := -O1 +build/$(VERSION)/src/core1/ll_cvt.c.o: MIPSBIT := -mips3 -o32 build/$(VERSION)/src/bk_boot_27F0.c.o: OPT_FLAGS = -O2 build/$(VERSION)/src/done/destroythread.c.o: OPT_FLAGS := -O1 diff --git a/decompressed.pal.yaml b/decompressed.pal.yaml index 709d0a64..824e81db 100644 --- a/decompressed.pal.yaml +++ b/decompressed.pal.yaml @@ -264,7 +264,7 @@ segments: - [0xF64830, c, io/vigetcurrframebuf] - [0xF64870, c, os/stoptimer] - [0xF64960, c, os/settimer] - - [0xF64A40, c, ll] + - [0xF64A40, c, ll_cvt] - [0xF64C50, c, io/sptaskyielded] - [0xF64CD0, c, io/sptaskyield] - [0xF64CF0, c, io/visetmode] @@ -291,72 +291,72 @@ segments: - [0xF67570, c, io/conteeplongread] - [0xF67600, c, io/piread] - [0xF67640, c, audio/copy] - - [0xF676C0, bin, untouched] - # - [0xF43FF0, c, audio/drvrNew] - # - [0xF44790, c, audio/reverb] - # - [0xF453E0, c, syncprintf] - # - [0xF45420, c, audio/seq] - # - [0xF45A40, hasm, setsr] - # - [0xF45A50, hasm, getsr] - # - [0xF45A60, hasm, setfpccsr] - # - [0xF45A70, c, io/sirawread] - # - [0xF45AC0, c, io/sirawwrite] - # - [0xF45B10, hasm, ultra/exceptasm] - # - [0xF46480, c, io/pirawread] - # - [0xF464E0, hasm, interrupt] - # - [0xF46520, c, os/thread] - # - [0xF46560, c, audio/synthesizer] - # - [0xF46C40, c, audio/syndelete] - # - [0xF46C50, hasm, probetlb] - # - [0xF46D10, c, io/ai] - # - [0xF46D40, c, os/jammesg] - # - [0xF46E90, c, io/pigetcmdq] - # - [0xF46EC0, c, io/cartrominit] - # - [0xF46FC0, c, io/leodiskinit] - # - [0xF470C0, c, io/piacs] - # - [0xF47180, c, os/getthreadpri] - # - [0xF471A0, c, io/pirawdma] - # - [0xF47280, c, io/epirawdma] - # - [0xF474B0, c, io/devmgr] - # - [0xF47940, hasm, bcopy] - # - [0xF47C50, c, io/spsetstat] - # - [0xF47C60, c, io/spsetpc] - # - [0xF47CA0, c, io/sprawdma] - # - [0xF47D30, c, io/sp] - # - [0xF47D60, c, io/vi] - # - [0xF47EA0, c, os/timerintr] - # - [0xF482A0, hasm, setcompare] - # - [0xF482B0, c, io/spgetstat] - # - [0xF482C0, c, io/vigetcurrcontext] - # - [0xF482D0, c, io/viswapcontext] - # - [0xF48630, hasm, getcount] - # - [0xF48640, c, gu/normalize] - # - [0xF486D0, c, io/siacs] - # - [0xF48790, c, io/sirawdma] - # - [0xF48840, c, io/pfsisplug] - # - [0xF48BB0, c, io/crc] - # - [0xF48D30, c, io/contramwrite] - # - [0xF490B0, c, io/contramread] - # - [0xF49440, c, io/pfsgetstatus] - # - [0xF49550, c, io/contpfs] - # - [0xF4A2B0, c, io/pfschecker] - # - [0xF4AD10, c, io/conteepwrite] - # - [0xF4B260, c, io/conteepread] - # - [0xF4B5C0, c, audio/filter] - # - [0xF4B5E0, c, audio/env] - # - [0xF4C160, c, audio/load] - # - [0xF4CCB0, c, audio/resample] - # - [0xF4CFB0, c, audio/auxbus] - # - [0xF4D0C0, c, audio/mainbus] - # - [0xF4D210, c, audio/save] - # - [0xF4D2D0, c, io/si] - # - [0xF4D300, c, io/leointerrupt] - # - [0xF4DB80, c, audio/synallocfx] - # - [0xF4DC20, c, os/resetglobalintmask] - # - [0xF4DC80, c, io/epirawwrite] - # - [0xF4DCD0, c, io/epirawread] - # - [0xF4DD20, c, os/setglobalintmask] - # - [0xF4DD70, c, os/yieldthread] + - [0xF676C0, c, audio/drvrNew] + - [0xF67AB0, c, audio/reverb] + - [0xF67E60, c, syncprintf] + - [0xF67EA0, c, audio/seq] + - [0xF69110, hasm, setsr] + - [0xF69120, hasm, getsr] + - [0xF69130, hasm, setfpccsr] + - [0xF69140, c, io/sirawread] + - [0xF69190, c, io/sirawwrite] + - [0xF691E0, hasm, ultra/exceptasm] + - [0xF69B50, c, io/pirawread] + - [0xF69BB0, c, ll] + - [0xF69E70, hasm, interrupt] + - [0xF69EB0, c, os/thread] + - [0xF69EF0, c, audio/synthesizer] + - [0xF6A5D0, c, audio/syndelete] + - [0xF6A5E0, hasm, probetlb] + - [0xF6A6A0, c, io/ai] + - [0xF6A6D0, c, os/jammesg] + - [0xF6A720, c, io/pigetcmdq] + - [0xF6A750, c, io/cartrominit] + - [0xF6A950, c, io/leodiskinit] + - [0xF6AA50, c, io/piacs] + - [0xF6AB10, c, os/getthreadpri] + - [0xF6AB30, c, io/pirawdma] + - [0xF6AC10, c, io/epirawdma] + - [0xF6AE40, c, io/devmgr] + - [0xF6B2D0, hasm, bcopy] + - [0xF6B5E0, c, io/spsetstat] + - [0xF6B5F0, c, io/spsetpc] + - [0xF6B630, c, io/sprawdma] + - [0xF6B6C0, c, io/sp] + - [0xF6B6F0, c, io/vi] + - [0xF6B830, c, os/timerintr] + - [0xF6BC30, hasm, setcompare] + - [0xF6BC40, c, io/spgetstat] + - [0xF6BC50, c, io/vigetcurrcontext] + - [0xF6BC60, c, io/viswapcontext] + - [0xF6BFC0, hasm, getcount] + - [0xF6BFD0, c, gu/normalize] + - [0xF6C060, c, io/siacs] + - [0xF6C120, c, io/sirawdma] + - [0xF6C1D0, c, io/pfsisplug] + - [0xF6C540, c, io/crc] + - [0xF6C6C0, c, io/contramwrite] + - [0xF6CA40, c, io/contramread] + - [0xF6CE80, c, io/pfsgetstatus] + - [0xF6CEE0, c, io/contpfs] + - [0xF6DC40, c, io/pfschecker] + - [0xF6E6A0, c, io/conteepwrite] + - [0xF6EBF0, c, io/conteepread] + - [0xF6EF50, c, audio/filter] + - [0xF6EF70, c, audio/env] + - [0xF6FAF0, c, audio/load] + - [0xF70640, c, audio/resample] + - [0xF70840, c, audio/auxbus] + - [0xF70940, c, audio/mainbus] + - [0xF70A90, c, audio/save] + - [0xF70B50, c, io/si] + - [0xF70B80, c, io/leointerrupt] + - [0xF71400, c, audio/synallocfx] + - [0xF715B0, c, os/resetglobalintmask] + - [0xF71610, c, io/epirawwrite] + - [0xF71660, c, io/epirawread] + - [0xF716B0, c, os/setglobalintmask] + - [0xF71700, c, os/yieldthread] - [0xF71750, bin, n_aspMain_text] - [0xF723B0, bin, gSPF3DEX_fifo_text] - [0xF737E0, bin, gSPL3DEX_fifo_text] @@ -398,18 +398,17 @@ segments: - [0xF76210, .data, io/pimgr] - [0xF76240, .data, io/vimgr] - [0xF76260, .data, io/controller] - - [0xF76270, bin, remain_core1_data] - # - [0xF529F0, .data, audio/drvrNew] - # - [0xF52B80, .data, ultra/exceptasm] - # - [0xF52BA0, .data, os/thread] - # - [0xF52BC0, .data, io/piacs] - # - [0xF52BD0, .data, io/vi] - # - [0xF52C40, .data, os/timerintr] - # - [0xF52C50, .data, io/siacs] - # - [0xF52C60, .data, audio/env] - # - [0xF52D60, .data, io/vimodepallan1] - # - [0xF52DB0, .data, io/vimodempallan1] - # - [0xF52DB0, .data, io/vimodentsclan1] + - [0xF76270, .data, audio/drvrNew] + - [0xF76400, .data, ultra/exceptasm] + - [0xF76420, .data, os/thread] + - [0xF76440, .data, io/piacs] + - [0xF76450, .data, io/vi] + - [0xF764C0, .data, os/timerintr] + - [0xF764D0, .data, io/siacs] + - [0xF764E0, .data, audio/env] + - [0xF765E0, .data, io/vimodepallan1] + - [0xF76630, .data, io/vimodempallan1] + - [0xF76680, .data, io/vimodentsclan1] - [0xF766D0, .rodata, code_1D00] - [0xF766F0, .rodata, code_3250] - [0xF76700, .rodata, code_3A70] @@ -437,20 +436,19 @@ segments: - [0xF77C90, .rodata, audio/cents2ratio] - [0xF77CA0, .rodata, gu/cosf] - [0xF77CF0, .rodata, ultra/setintmask] - - [0xF77D70, .rodata, ll] + - [0xF77D70, .rodata, ll_cvt] - [0xF77D80, .rodata, gu/rotate] - [0xF77D90, .rodata, audio/cseq] - - [0xF77DA0, bin, remain_core1_rodata] - # - [0xF54530, .rodata, audio/drvrNew] - # - [0xF54550, .rodata, audio/reverb] - # - [0xF54580, .rodata, audio/seq] - # - [0xF54590, .rodata, ultra/exceptasm] - # - [0xF545E0, hasm, ultra/libm_vals] # Nothing in this file, just here so splat sees it's ASM - # - [0xF545E0, .rodata, ultra/libm_vals] - # - [0xF545F0, .rodata, audio/synthesizer] - # - [0xF54600, .rodata, io/devmgr] - # - [0xF54620, .rodata, audio/env] - # - [0xF54670, .rodata, audio/resample] + - [0xF77DA0, .rodata, audio/drvrNew] + - [0xF77DC0, .rodata, audio/reverb] + - [0xF77DF0, .rodata, audio/seq] + - [0xF77E00, .rodata, ultra/exceptasm] + - [0xF77E50, hasm, ultra/libm_vals] # Nothing in this file, just here so splat sees it's ASM + - [0xF77E50, .rodata, ultra/libm_vals] + - [0xF77E60, .rodata, audio/synthesizer] + - [0xF77E70, .rodata, io/devmgr] + - [0xF77E90, .rodata, audio/env] + - [0xF77EE0, .rodata, audio/resample] - [0xF77F20, bin, n_aspMain_data] - [0xF781D0, bin, gSPF3DEX_fifo_data] - [0xF789D0, bin, gSPL3DEX_fifo_data] @@ -489,15 +487,15 @@ segments: - [0xF791D0, .bss, gu/rotate] - [0xF791D0, .bss, io/controller] - [0xF791D0, .bss, io/motor] - # - [0xF791D0, .bss, io/cartrominit] - # - [0xF791D0, .bss, io/leodiskinit] - # - [0xF791D0, .bss, io/piacs] - # - [0xF791D0, .bss, os/timerintr] - # - [0xF791D0, .bss, io/siacs] - # - [0xF791D0, .bss, io/pfsisplug] - # - [0xF791D0, .bss, io/conteepread] - # - [0xF791D0, .bss, os/kdebugserver] - # - [0xF791D0, .bss, io/leointerrupt] + - [0xF791D0, .bss, io/cartrominit] + - [0xF791D0, .bss, io/leodiskinit] + - [0xF791D0, .bss, io/piacs] + - [0xF791D0, .bss, os/timerintr] + - [0xF791D0, .bss, io/siacs] + - [0xF791D0, .bss, io/pfsisplug] + - [0xF791D0, .bss, io/conteepread] + - [0xF791D0, .bss, os/kdebugserver] + - [0xF791D0, .bss, io/leointerrupt] - name: core2 dir: core2 type: code @@ -506,7 +504,7 @@ segments: follows_vram: core1 subsegments: - [0xF791D0, linker_offset, TEXT_START] #text Section - - [0xF791D0, bin, untouched] + - [0xF791D0, bin, core2_untouched] - [0x1055E20, linker_offset, TEXT_END] #text Section - [0x1055E20, linker_offset, DATA_START] #text Section - [0x1055E20, bin, untouched_data] diff --git a/manual_syms.pal.txt b/manual_syms.pal.txt index 72e11dfa..698dfbbb 100644 --- a/manual_syms.pal.txt +++ b/manual_syms.pal.txt @@ -33,90 +33,6 @@ boot_func_8023DA20 = func_8023DA20; /* Temporary*/ /* Temporary Correct*/ -_init_lpfilter = 0x80268620; -_doModFunc = 0x80268b00; -rmonPrintf = 0x8026976c; -alSeqSetLoc = 0x802697ac; -alSeqGetTicks = 0x802697c8; -__alSeqNextDelta = 0x80269c00; -__osSetSR = 0x80269db0; -__osGetSR = 0x80269dc0; -__osSetFpcCsr = 0x80269dd0; -__osSiRawReadIo = 0x80269de0; -__osSiRawWriteIo = 0x80269e30; -func_8026A2E0 = 0x80269e80; -__osEnqueueAndYield = 0x8026a4ac; -__osEnqueueThread = 0x8026a5ac; -__osPopThread = 0x8026a5f4; -__osDispatchThread = 0x8026a604; -__osCleanupThread = 0x8026A780; -osMapTLBRdb = 0x8026a790; -osPiRawReadIo = 0x8026a7f0; -__ull_div = 0x8026a8b8; -__ll_mul = 0x8026a9b8; -__osDisableInt = 0x8026ab10; -__osDequeueThread = 0x8026ab50; -__osRestoreInt = 0x8026ab30; -alSynNew = 0x8026af70; -alSynDelete = 0x8026b270; -__osProbeTLB = 0x8026b280; -__osAiDeviceBusy = 0x8026b340; -osJamMesg = 0x8026b370; -osPiGetCmdQueue = 0x8026b4c0; -__osPiCreateAccessQueue = 0x8026b6f0; -__osPiGetAccess = 0x8026b740; -__osPiRelAccess = 0x8026b784; -osGetThreadPri = 0x8026b7b0; -osPiRawStartDma = 0x8026B7D0; -osEPiRawStartDma = 0x8026b8b0; -__osDevMgrMain = 0x8026bae0; -bcopy = 0x8026bf70; -__osSpSetStatus = 0x8026c280; -__osSpDeviceBusy = 0x8026c360; -__osSpRawStartDma = 0x8026c2d0; -__osSpSetPc = 0x8026c290; -__osViInit = 0x8026c390; -__osTimerServicesInit = 0x8026c4d0; -__osTimerInterrupt = 0x8026c55c; -__osSetTimerIntr = 0x8026c6d4; -__osInsertTimer = 0x8026c748; -__osSetCompare = 0x8026c8d0; -__osSpGetStatus = 0x8026c8e0; -__osViGetCurrentContext = 0x8026c8f0; -__osViSwapContext = 0x8026c900; -osGetCount = 0x8026cc60; -guNormalize = 0x8026cc70; -__osSiCreateAccessQueue = 0x8026cd00; -__osSiGetAccess = 0x8026cd50; -__osSiRelAccess = 0x8026cd94; -__osSiRawStartDma = 0x8026cdc0; -__osContAddressCrc = 0x8026d1e0; -__osContRamWrite = 0x8026d360; -__osContRamRead = 0x8026d6e0; -__osPfsGetStatus = 0x8026da70; -__osGetId = 0x8026e1f4; -osPfsChecker = 0x8026e8e0; -osEepromWrite = 0x8026f340; -osEepromRead = 0x8026f890; - - -__osThreadTail = 0x802770c0; -__osRunQueue = 0x802770c8; -__osActiveQueue = 0x802770cc; -__osRunningThread = 0x802770d0; -__osPiAccessQueueEnabled = 0x802770e0; -__osViCurr = 0x80277150; -__osViNext = 0x80277154; -__osTimerList = 0x80277160; -__libm_qnan_f = 0x80278AF0; -__osPiDevMgr = 0x80276eb0; -CartRomHandle = 0x80285A00; -LeoDiskHandle = 0x80285A80; -__osPiAccessQueue = 0x80285b08; -__osCurrentTime = 0x80285b40; -__osBaseCounter = 0x80285b48; -__osViIntrCount = 0x80285b4c; -__osPfsPifRam = 0x80285b80; core2_VRAM = 0x80286db0; core2_TEXT_START = 0x80286db0; diff --git a/src/core1/ll.c b/src/core1/ll.c index c257d1b4..a50fc92d 100644 --- a/src/core1/ll.c +++ b/src/core1/ll.c @@ -1,5 +1,3 @@ -#include "version.h" -#if VERSION == VERSION_USA_1_0 unsigned long long __ull_rshift(unsigned long long a0, unsigned long long a1) { return a0 >> a1; @@ -53,46 +51,3 @@ long long __ll_rshift(long long a0, long long a1) { return a0 >> a1; } - -#elif VERSION == VERSION_PAL - -long long __d_to_ll(double a0) -{ - return a0; -} - -long long __f_to_ll(float a0) -{ - return a0; -} - -unsigned long long __d_to_ull(double a0) -{ - return a0; -} - -unsigned long long __f_to_ull(float a0) -{ - return a0; -} - -double __ll_to_d(long long a0) -{ - return a0; -} - -float __ll_to_f(long long a0) -{ - return a0; -} - -double __ull_to_d(unsigned long long a0) -{ - return a0; -} - -float __ull_to_f(unsigned long long a0) -{ - return a0; -} -#endif \ No newline at end of file diff --git a/src/core1/ll_cvt.c b/src/core1/ll_cvt.c new file mode 100644 index 00000000..c8470bf0 --- /dev/null +++ b/src/core1/ll_cvt.c @@ -0,0 +1,39 @@ +long long __d_to_ll(double a0) +{ + return a0; +} + +long long __f_to_ll(float a0) +{ + return a0; +} + +unsigned long long __d_to_ull(double a0) +{ + return a0; +} + +unsigned long long __f_to_ull(float a0) +{ + return a0; +} + +double __ll_to_d(long long a0) +{ + return a0; +} + +float __ll_to_f(long long a0) +{ + return a0; +} + +double __ull_to_d(unsigned long long a0) +{ + return a0; +} + +float __ull_to_f(unsigned long long a0) +{ + return a0; +} diff --git a/symbol_addrs.pal.txt b/symbol_addrs.pal.txt index 885c19de..cefcf1da 100644 --- a/symbol_addrs.pal.txt +++ b/symbol_addrs.pal.txt @@ -25,38 +25,25 @@ osWritebackDCache = 0x80264740; osInvalDCache = 0x802647C0; osSetIntMask = 0x80265120; osInvalICache = 0x80268060; - - -__osSetSR = 0x8026A210; -__osGetSR = 0x8026A220; -__osSetFpcCsr = 0x8026A230; -__osEnqueueAndYield = 0x8026A90C; -__osEnqueueThread = 0x8026AA0C; -__osPopThread = 0x8026AA54; -__osDispatchThread = 0x8026AA64; -__osCleanupThread = 0x8026ABE0; -osMapTLBRdb = 0x8026ABF0; -__osDisableInt = 0x8026ACB0; -__osRestoreInt = 0x8026ACD0; -__osProbeTLB = 0x8026B420; -bcopy = 0x8026C110; -__osSetCompare = 0x8026CA70; -osGetCount = 0x8026CE00; - +__osSetSR = 0x80269db0; +__osGetSR = 0x80269dc0; +__osSetFpcCsr = 0x80269dd0; +func_8026A2E0 = 0x80269e80; +__osEnqueueAndYield = 0x8026a4ac; +__osEnqueueThread = 0x8026a5ac; +__osPopThread = 0x8026a5f4; +__osDispatchThread = 0x8026a604; +__osCleanupThread = 0x8026A780; +osMapTLBRdb = 0x8026a790; +__osDisableInt = 0x8026ab10; +__osRestoreInt = 0x8026ab30; +__osProbeTLB = 0x8026b280; +bcopy = 0x8026bf70; +__osSetCompare = 0x8026c8d0; +osGetCount = 0x8026cc60; D_80276E70 = 0x80276bc0; - - - -__osShutdown = 0x8027712C; -__OSGlobalIntMask = 0x80277130; -__osRunQueue = 0x80277378; -__osRunningThread = 0x80277380; -__osFaultedThread = 0x80277384; -__osRcpImTable = 0x80278C60; -__libm_qnan_f = 0x80278DB0; - func_80240204 = 0x80240D80; alUnlink = 0x80264080; alLink = 0x802640b0;