From 15a65decbec4b1291e9399361fa4869e6616cd96 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 26 Jan 2021 22:50:15 +1000 Subject: [PATCH] Decompile __osResetGlobalIntMask --- Makefile | 1 + src/lib/ultra/os/resetglobalintmask.c | 36 +++++++-------------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index b8a37071b..22bfc4877 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ $(B_DIR)/lib/ultra/io/vigetcurrframebuf.o: OPT_LVL := -O1 $(B_DIR)/lib/ultra/io/vigetnextframebuf.o: OPT_LVL := -O1 $(B_DIR)/lib/ultra/io/visetevent.o: OPT_LVL := -O1 $(B_DIR)/lib/ultra/os/destroythread.o: OPT_LVL := -O1 +$(B_DIR)/lib/ultra/os/resetglobalintmask.o: OPT_LVL := -O1 CFLAGS = -DVERSION=$(VERSION) \ -DNTSC=$(NTSC) \ diff --git a/src/lib/ultra/os/resetglobalintmask.c b/src/lib/ultra/os/resetglobalintmask.c index 3eb3f3667..f21b0a0fc 100644 --- a/src/lib/ultra/os/resetglobalintmask.c +++ b/src/lib/ultra/os/resetglobalintmask.c @@ -1,29 +1,11 @@ #include +#include "game/data/data_000000.h" -GLOBAL_ASM( -glabel __osResetGlobalIntMask -/* 518a0: 27bdffd8 */ addiu $sp,$sp,-40 -/* 518a4: afbf001c */ sw $ra,0x1c($sp) -/* 518a8: afa40028 */ sw $a0,0x28($sp) -/* 518ac: 0c01256c */ jal __osDisableInt -/* 518b0: afb00018 */ sw $s0,0x18($sp) -/* 518b4: 8faf0028 */ lw $t7,0x28($sp) -/* 518b8: 3c0e8006 */ lui $t6,%hi(__osGlobalIntMask) -/* 518bc: 8dcecf70 */ lw $t6,%lo(__osGlobalIntMask)($t6) -/* 518c0: 2401fbfe */ addiu $at,$zero,-1026 -/* 518c4: 01e1c024 */ and $t8,$t7,$at -/* 518c8: 0300c827 */ nor $t9,$t8,$zero -/* 518cc: 00408025 */ or $s0,$v0,$zero -/* 518d0: 3c018006 */ lui $at,%hi(__osGlobalIntMask) -/* 518d4: 01d94024 */ and $t0,$t6,$t9 -/* 518d8: ac28cf70 */ sw $t0,%lo(__osGlobalIntMask)($at) -/* 518dc: 0c012588 */ jal __osRestoreInt -/* 518e0: 02002025 */ or $a0,$s0,$zero -/* 518e4: 8fbf001c */ lw $ra,0x1c($sp) -/* 518e8: 8fb00018 */ lw $s0,0x18($sp) -/* 518ec: 27bd0028 */ addiu $sp,$sp,0x28 -/* 518f0: 03e00008 */ jr $ra -/* 518f4: 00000000 */ nop -/* 518f8: 00000000 */ nop -/* 518fc: 00000000 */ nop -); +void __osResetGlobalIntMask(OSHWIntr interrupt) +{ + register u32 saveMask = __osDisableInt(); + + __osGlobalIntMask &= ~(interrupt & ~(SR_IBIT3 | SR_IE)); + + __osRestoreInt(saveMask); +}