thermosphere: rework linkscrips, use discardable sections, better sp pivot on crash

This commit is contained in:
TuxSH
2019-08-02 00:47:48 +02:00
parent e6c5eb3928
commit e0339049b3
9 changed files with 92 additions and 56 deletions

View File

@@ -63,17 +63,14 @@
.endm
.macro pivot_stack_for_crash
// Note: reset x18 assumed uncorrupted
// Note: x18 assumed uncorrupted
// Note: replace sp_el0 with crashing sp
mrs x18, esr_el2
mov x18, sp
msr sp_el0, x18
bic x18, x18, #0xFF
bic x18, x18, #0x300
add x18, x18, #0x400
mov sp, x18
ldp x18, xzr, [sp, #-0x10]
add sp, sp, #0x1000
str x16, [x18, #0x18] // currentCoreCtx->scratch = x16
mov x16, sp
msr sp_el0, x16
ldr x16, [x18, #0x10] // currentCoreCtx->crashStack
mov sp, x16
ldr x16, [x18, #0x18]
.endm
/* Actual Vectors for Thermosphere. */