29 lines
496 B
ArmAsm
29 lines
496 B
ArmAsm
.section ".text.boot"
|
|
|
|
.global _start
|
|
|
|
_start:
|
|
// read cpu id, stop slave cores
|
|
mrs x1, mpidr_el1
|
|
and x1, x1, #3
|
|
cbz x1, 2f
|
|
// cpu id > 0, stop
|
|
1:
|
|
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
|
|
|
|
// 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
|