1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-14 11:00:41 +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

@ -2,16 +2,16 @@
StackEntry sBootThreadInfo;
OSThread sIdleThread;
u8 sIdleThreadStack[0x400];
STACK(sIdleThreadStack, 0x400);
StackEntry sIdleThreadInfo;
u8 sBootThreadStack[0x400];
STACK(sBootThreadStack, 0x400);
void cleararena(void) {
bzero(_dmadataSegmentStart, osMemSize - OS_K0_TO_PHYSICAL(_dmadataSegmentStart));
}
void bootproc(void) {
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot");
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot");
osMemSize = osGetMemSize();
cleararena();
@ -23,8 +23,8 @@ void bootproc(void) {
isPrintfInit();
Locale_Init();
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle");
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack),
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, STACK_TOP(sIdleThreadStack), 0, 256, "idle");
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, STACK_TOP(sIdleThreadStack),
Z_PRIORITY_MAIN);
osStartThread(&sIdleThread);
}