From 65ea70e44b003fa8830a185015f6fe32d421ca15 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 22 Oct 2022 09:49:11 -0700 Subject: [PATCH] Link dsp.c --- .vscode/settings.json | 3 ++- configure.py | 2 +- obj_files.mk | 2 +- src/Dolphin/dsp/dsp.c | 44 ++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6ec66233..02695ede 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,8 @@ "sipriv.h": "c", "dvd_regs.h": "c", "dvd.h": "c", - "dvdpriv.h": "c" + "dvdpriv.h": "c", + "__ppc_eabi_linker.h": "c" }, "files.autoSave": "onFocusChange", "files.insertFinalNewline": true, diff --git a/configure.py b/configure.py index 8e03c7b8..3643362c 100755 --- a/configure.py +++ b/configure.py @@ -759,7 +759,7 @@ LIBS = [ "cflags": "$cflags_base", "host": False, "objects": [ - ["Dolphin/dsp/dsp", False], + ["Dolphin/dsp/dsp", True], ["Dolphin/dsp/dsp_debug", True], "Dolphin/dsp/dsp_task", ], diff --git a/obj_files.mk b/obj_files.mk index 2f586f4b..a9a21250 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -648,7 +648,7 @@ DB_FILES :=\ $(BUILD_DIR)/src/Dolphin/db.ep.o\ DSP_FILES :=\ - $(BUILD_DIR)/asm/Dolphin/dsp/dsp.o\ + $(BUILD_DIR)/src/Dolphin/dsp/dsp.ep.o\ $(BUILD_DIR)/src/Dolphin/dsp/dsp_debug.o\ $(BUILD_DIR)/asm/Dolphin/dsp/dsp_task.o diff --git a/src/Dolphin/dsp/dsp.c b/src/Dolphin/dsp/dsp.c index 719e6c89..049f10c4 100644 --- a/src/Dolphin/dsp/dsp.c +++ b/src/Dolphin/dsp/dsp.c @@ -83,6 +83,7 @@ void DSPHalt(void) { u32 DSPGetDMAStatus(void) { return __DSPRegs[5] & 0x200; } +#if NONMATCHING DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) { u32 oldInt; oldInt = OSDisableInterrupts(); @@ -96,7 +97,48 @@ DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) { return task; } - +#else +#pragma push +#include "__ppc_eabi_linker.h" +/* clang-format off */ +#pragma optimization_level 0 +#pragma optimizewithasm off +extern void __DSP_insert_task(DSPTaskInfo* task); +asm DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) { + nofralloc + mflr r0 + stw r0, 4(r1) + stwu r1, -0x18(r1) + stw r31, 0x14(r1) + stw r30, 0x10(r1) + mr r30, r3 + bl OSDisableInterrupts + addi r31, r3, 0 + addi r3, r30, 0 + bl __DSP_insert_task + li r0, 0 + stw r0, 0(r30) + li r0, 1 + addi r3, r31, 0 + stw r0, 8(r30) + bl OSRestoreInterrupts + lwz r0, __DSP_first_task + cmplw r30, r0 + bne lbl_8036FBB4 + mr r3, r30 + bl __DSP_boot_task +lbl_8036FBB4: + mr r3, r30 + lwz r0, 0x1c(r1) + lwz r31, 0x14(r1) + lwz r30, 0x10(r1) + addi r1, r1, 0x18 + mtlr r0 + blr +} +#endif +/* clang-format on */ +#pragma pop #ifdef __cplusplus } #endif