diff options
Diffstat (limited to 'src/arch/arm64/armv8/cpu.S')
-rw-r--r-- | src/arch/arm64/armv8/cpu.S | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/arch/arm64/armv8/cpu.S b/src/arch/arm64/armv8/cpu.S index 4713ca59f9..711c338685 100644 --- a/src/arch/arm64/armv8/cpu.S +++ b/src/arch/arm64/armv8/cpu.S @@ -21,7 +21,8 @@ * Bring an ARMv8 processor we just gained control of (e.g. from IROM) into a * known state regarding caches/SCTLR/PSTATE. Completely cleans and invalidates * icache/dcache, disables MMU and dcache (if active), and enables unaligned - * accesses, icache and branch prediction (if inactive). Clobbers R22 and R23. + * accesses, icache and branch prediction (if inactive). Seeds the stack and + * initializes SP_EL0. Clobbers R22 and R23. */ ENTRY(arm64_init_cpu) /* Initialize PSTATE (unmask all exceptions, select SP_EL0). */ @@ -60,5 +61,17 @@ ENTRY(arm64_init_cpu) dsb sy isb + /* Initialize stack with sentinel value to later check overflow. */ + ldr x2, =0xdeadbeefdeadbeef + ldr x0, =_stack + ldr x1, =_estack +1: + stp x2, x2, [x0], #16 + cmp x0, x1 + bne 1b + + /* Leave a line of beef dead for easier visibility in stack dumps. */ + sub sp, x0, #16 + ret x23 ENDPROC(arm64_init_cpu) |