thermosphere: rework linkscrips, use discardable sections, better sp pivot on crash
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
// start.s
|
||||
extern uintptr_t g_initialKernelEntrypoint;
|
||||
|
||||
extern u8 __stacks_top__[], __crash_stacks_top__[];
|
||||
|
||||
// Prevents it from being put in BSS
|
||||
CoreCtx g_coreCtxs[4] = {
|
||||
{ .coreId = 0 },
|
||||
@@ -29,10 +31,12 @@ CoreCtx g_coreCtxs[4] = {
|
||||
|
||||
void coreCtxInit(u32 coreId, bool isColdbootCore, u64 argument)
|
||||
{
|
||||
size_t crashStackSize = (__crash_stacks_top__ - __stacks_top__) / 4;
|
||||
currentCoreCtx = &g_coreCtxs[coreId];
|
||||
currentCoreCtx->isColdbootCore = isColdbootCore;
|
||||
currentCoreCtx->kernelArgument = argument;
|
||||
if (isColdbootCore) {
|
||||
currentCoreCtx->crashStack = __crash_stacks_top__ - crashStackSize * coreId;
|
||||
if (isColdbootCore && currentCoreCtx->kernelEntrypoint == 0) {
|
||||
currentCoreCtx->kernelEntrypoint = g_initialKernelEntrypoint;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user