1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
.section ".text.boot"
.global _start
_start:
// Stop all cores except one.
mrs x0, mpidr_el1
and x0, x0, #0xFF
cbz x0, master
b halt
// Helper function to clear x1 bytes starting at the x0 memory address.
.globl memzero
memzero:
str xzr, [x0], #8
subs x1, x1, #8
b.gt memzero
ret
// Helper function wait for N cycles before returning.
.globl delay
delay:
subs x0, x0, #1
bne delay
ret
master:
// Clear bss.
ldr x0, =__bss_start
ldr x1, =__bss_size
sub x1, x1, x0
bl memzero
// Set stack before our code.
ldr x0, =_start
mov sp, x0
// Start C code, should not return.
bl main
b halt
halt:
wfe
b halt
|