1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 05:19:36 +00:00
oot/src/boot/boot_main.c
Tharo cf048f849a
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
2022-02-06 13:00:01 -05:00

30 lines
874 B
C

#include "global.h"
StackEntry sBootThreadInfo;
OSThread sIdleThread;
STACK(sIdleThreadStack, 0x400);
StackEntry sIdleThreadInfo;
STACK(sBootThreadStack, 0x400);
void cleararena(void) {
bzero(_dmadataSegmentStart, osMemSize - OS_K0_TO_PHYSICAL(_dmadataSegmentStart));
}
void bootproc(void) {
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot");
osMemSize = osGetMemSize();
cleararena();
__osInitialize_common();
__osInitialize_autodetect();
gCartHandle = osCartRomInit();
osDriveRomInit();
isPrintfInit();
Locale_Init();
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, STACK_TOP(sIdleThreadStack), 0, 256, "idle");
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, STACK_TOP(sIdleThreadStack),
Z_PRIORITY_MAIN);
osStartThread(&sIdleThread);
}