This commit is contained in:
2025-03-16 05:52:09 +08:00
parent bfcb951628
commit ac0bf1639e
28 changed files with 738 additions and 76 deletions

View File

@@ -4,25 +4,24 @@
_start:
// read cpu id, stop slave cores
mrs x1, mpidr_el1
and x1, x1, #3
cbz x1, 2f
mrs x1, mpidr_el1
and x1, x1, #3
cbz x1, run
// cpu id > 0, stop
1:
wait:
wfe
b 1b
2:// cpu id == 0
// set top of stack just before our code (stack grows to a lower address per AAPCS64)
ldr x1, =_start
mov sp, x1
b wait
run: // cpu id == 0
mov x20, x0
adrp x0, __stack_end
mov sp, x0
// clear bss
adr x0, __bss_start
adr x1, __bss_end
bl memzero
4:
// jump to C code, should not return
bl main
// for failsafe, halt this core too
b 1b
mov x0, x20
bl main
b wait