.section ".text.boot"
.global _start
_start:
// get cpu id
mrs x1, MPIDR_EL1
and x1, x1, #3
cbz x1, 2f
// if cpu_id > 0, stop
1:
wfe
b 1b
// if cpu_id == 0
2:
// set stack pointer
ldr x1, =_start
mov sp, x1
// clear bss
ldr x1, =__bss_start
ldr x2, =__bss_size
3: cbz x2, 4f
str xzr, [x1], #8
sub x2, x2, #1
cbnz x2, 3b
// jump to main function in C
4: bl main
// halt this core if return
b 1b
mrs: Move to ARM register from system coprocessor register