From 743a75d0a157fa6886ba4aa7b7124c2a95e1d003 Mon Sep 17 00:00:00 2001 From: EpochFlame <82550703+EpochFlame@users.noreply.github.com> Date: Tue, 19 Oct 2021 14:35:43 -0400 Subject: [PATCH] 25 pokos! decompiled MWCriticalSection_gc.cpp --- asm/Dolphin/MWCriticalSection_gc.s | 33 -------------------- obj_files.mk | 2 +- src/Dolphin/MWCriticalSection_gc.cpp | 46 ++++++---------------------- 3 files changed, 10 insertions(+), 71 deletions(-) delete mode 100644 asm/Dolphin/MWCriticalSection_gc.s diff --git a/asm/Dolphin/MWCriticalSection_gc.s b/asm/Dolphin/MWCriticalSection_gc.s deleted file mode 100644 index a8e4f5a9e..000000000 --- a/asm/Dolphin/MWCriticalSection_gc.s +++ /dev/null @@ -1,33 +0,0 @@ -.include "macros.inc" - -.section .text, "ax" # 0x800056C0 - 0x80472F00 -.global MWExitCriticalSection -MWExitCriticalSection: -/* 800C1598 000BE4D8 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 800C159C 000BE4DC 7C 08 02 A6 */ mflr r0 -/* 800C15A0 000BE4E0 90 01 00 14 */ stw r0, 0x14(r1) -/* 800C15A4 000BE4E4 80 63 00 00 */ lwz r3, 0(r3) -/* 800C15A8 000BE4E8 48 02 D6 B9 */ bl OSRestoreInterrupts -/* 800C15AC 000BE4EC 80 01 00 14 */ lwz r0, 0x14(r1) -/* 800C15B0 000BE4F0 7C 08 03 A6 */ mtlr r0 -/* 800C15B4 000BE4F4 38 21 00 10 */ addi r1, r1, 0x10 -/* 800C15B8 000BE4F8 4E 80 00 20 */ blr - -.global MWEnterCriticalSection -MWEnterCriticalSection: -/* 800C15BC 000BE4FC 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 800C15C0 000BE500 7C 08 02 A6 */ mflr r0 -/* 800C15C4 000BE504 90 01 00 14 */ stw r0, 0x14(r1) -/* 800C15C8 000BE508 93 E1 00 0C */ stw r31, 0xc(r1) -/* 800C15CC 000BE50C 7C 7F 1B 78 */ mr r31, r3 -/* 800C15D0 000BE510 48 02 D6 69 */ bl OSDisableInterrupts -/* 800C15D4 000BE514 90 7F 00 00 */ stw r3, 0(r31) -/* 800C15D8 000BE518 80 01 00 14 */ lwz r0, 0x14(r1) -/* 800C15DC 000BE51C 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 800C15E0 000BE520 7C 08 03 A6 */ mtlr r0 -/* 800C15E4 000BE524 38 21 00 10 */ addi r1, r1, 0x10 -/* 800C15E8 000BE528 4E 80 00 20 */ blr - -.global MWInitializeCriticalSection -MWInitializeCriticalSection: -/* 800C15EC 000BE52C 4E 80 00 20 */ blr diff --git a/obj_files.mk b/obj_files.mk index 51005e9f3..ee9d8d56c 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -264,7 +264,7 @@ TEXT_O_FILES:=\ $(BUILD_DIR)/asm/Dolphin/CircleBuffer.o\ $(BUILD_DIR)/asm/Dolphin/main.o\ $(BUILD_DIR)/asm/Dolphin/MWTrace.o\ - $(BUILD_DIR)/asm/Dolphin/MWCriticalSection_gc.o\ + $(BUILD_DIR)/src/Dolphin/MWCriticalSection_gc.o\ $(BUILD_DIR)/asm/Dolphin/__va_arg.o\ $(BUILD_DIR)/asm/Dolphin/global_destructor_chain.o\ $(BUILD_DIR)/asm/Dolphin/CPlusLibPPC.o\ diff --git a/src/Dolphin/MWCriticalSection_gc.cpp b/src/Dolphin/MWCriticalSection_gc.cpp index 1b605d8da..85bcd714d 100644 --- a/src/Dolphin/MWCriticalSection_gc.cpp +++ b/src/Dolphin/MWCriticalSection_gc.cpp @@ -1,4 +1,6 @@ - +extern "C" { +bool OSRestoreInterrupts(unsigned int); +unsigned int OSDisableInterrupts(); /* * --INFO-- @@ -15,20 +17,9 @@ void MWTerminateCriticalSection(void) * Address: 800C1598 * Size: 000024 */ -void MWExitCriticalSection(void) +void MWExitCriticalSection(unsigned int* section) { - /* - .loc_0x0: - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x0(r3) - bl 0x2D6B8 - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + OSRestoreInterrupts(*section); } /* @@ -36,23 +27,9 @@ void MWExitCriticalSection(void) * Address: 800C15BC * Size: 000030 */ -void MWEnterCriticalSection(void) +void MWEnterCriticalSection(unsigned int* section) { - /* - .loc_0x0: - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xC(r1) - mr r31, r3 - bl 0x2D668 - stw r3, 0x0(r31) - lwz r0, 0x14(r1) - lwz r31, 0xC(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + *section = OSDisableInterrupts(); } /* @@ -60,10 +37,5 @@ void MWEnterCriticalSection(void) * Address: 800C15EC * Size: 000004 */ -void MWInitializeCriticalSection(void) -{ - /* - .loc_0x0: - blr - */ -} +void MWInitializeCriticalSection(void) { } +};