1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-10 08:50:23 +00:00

Correctly align program stacks (#1133)

* Properly align program stacks

* Enforce size being a multiple of 8 bytes

* Correct alignment calculation

* Use an ALIGN8 macro in the stack declaration macro
This commit is contained in:
Tharo 2022-02-06 18:00:01 +00:00 committed by GitHub
parent b41489c443
commit cf048f849a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 30 deletions

View file

@ -6,7 +6,7 @@ OSMgrArgs __osPiDevMgr = { 0 };
OSPiHandle __Dom1SpeedParam;
OSPiHandle __Dom2SpeedParam;
OSThread piThread;
u8 piStackThread[0x1000];
STACK(piStackThread, 0x1000);
OSMesgQueue piEventQueue;
OSMesg piEventBuf[2];
OSThread __osThreadSave;
@ -46,7 +46,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
__osPiDevMgr.piDmaCallback = __osPiRawStartDma;
__osPiDevMgr.epiDmaCallback = __osEPiRawStartDma;
osCreateThread(&piThread, 0, __osDevMgrMain, (void*)&__osPiDevMgr, piStackThread + sizeof(piStackThread), pri);
osCreateThread(&piThread, 0, __osDevMgrMain, (void*)&__osPiDevMgr, STACK_TOP(piStackThread), pri);
osStartThread(&piThread);
__osRestoreInt(prevInt);

View file

@ -2,7 +2,7 @@
#include "ultra64/internal.h"
OSThread viThread;
u8 viThreadStack[0x1000];
STACK(viThreadStack, 0x1000);
OSMesgQueue viEventQueue;
OSMesg viEventBuf[6];
OSIoMesg viRetraceMsg;
@ -45,7 +45,7 @@ void osCreateViManager(OSPri pri) {
__osViDevMgr.piDmaCallback = NULL;
__osViDevMgr.epiDmaCallback = NULL;
osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack + sizeof(viThreadStack), pri);
osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, STACK_TOP(viThreadStack), pri);
__osViInit();
osStartThread(&viThread);
__osRestoreInt(prevInt);