From d374e71cb83cef8f4b73679ffc55e13e665ec911 Mon Sep 17 00:00:00 2001 From: cadmic Date: Fri, 6 Sep 2024 10:32:29 -0700 Subject: [PATCH] Fix size of leoDiskStack (#2143) --- include/ultra64/leodrive.h | 2 +- src/libleo/api/cacreateleomanager.c | 3 ++- src/libleo/api/cjcreateleomanager.c | 3 ++- src/libleo/leo/leointerrupt.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/ultra64/leodrive.h b/include/ultra64/leodrive.h index cb70b9a1fc..fbbbef8e0f 100644 --- a/include/ultra64/leodrive.h +++ b/include/ultra64/leodrive.h @@ -187,7 +187,7 @@ extern const s32 LEORAM_BYTE[]; extern s32 __leoActive; extern LEOVersion __leoVersion; -extern STACK(leoDiskStack, 0xFF0); +extern STACK(leoDiskStack, 0x1000); extern OSPiHandle* LEOPiInfo; diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c index 7628f58896..1f2caf6d97 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -1,4 +1,5 @@ #include "global.h" +#include "ultra64/asm.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" @@ -25,7 +26,7 @@ s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) driveRomHandle = osDriveRomInit(); __leoActive = true; - __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack)); + __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, (u8*)STACK_TOP(leoDiskStack) - FRAMESZ(SZREG * NARGSAVE)); leoInitialize(comPri, intPri, cmdBuf, cmdMsgCnt); if (osResetType == 1) { // NMI diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c index c10e1fd263..e3a5183005 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -1,4 +1,5 @@ #include "global.h" +#include "ultra64/asm.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" @@ -25,7 +26,7 @@ s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) driveRomHandle = osDriveRomInit(); __leoActive = true; - __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack)); + __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, (u8*)STACK_TOP(leoDiskStack) - FRAMESZ(SZREG * NARGSAVE)); leoInitialize(comPri, intPri, cmdBuf, cmdMsgCnt); if (osResetType == 1) { // NMI diff --git a/src/libleo/leo/leointerrupt.c b/src/libleo/leo/leointerrupt.c index e11d345080..d9e2175ad3 100644 --- a/src/libleo/leo/leointerrupt.c +++ b/src/libleo/leo/leointerrupt.c @@ -9,7 +9,7 @@ extern OSHWIntr __OSGlobalIntMask; void __osLeoAbnormalResume(void); void __osLeoResume(void); -STACK(leoDiskStack, 0xFF0); +STACK(leoDiskStack, 0x1000); s32 __osLeoInterrupt(void) { u32 stat = 0;