summaryrefslogtreecommitdiff
path: root/kernel/boot/entry.S
blob: 4c977a3cd7ba2e93d4af46e52527c14012cf89f9 (plain)
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
.section .text.init

.globl _start
_start:
        csrw       satp, zero
        csrw       sie, zero
        csrw       sip, zero

        .option push
        .option norelax
        la         gp, __global_pointer$
        .option pop

        la         sp, __stack_start
        mv         t0, a0
        li         t1, PAGE_SIZE 
        mul        t0, t0, t1
        add        sp, sp, t0

        li         a2, 1
        lla        a3, _boot_hart
        amoswap.w, a3, a2, (a3)
        bnez a3,   mp_entry 

        la         a2, __bss_start
        la         a3, __bss_end
1:
        sd         zero, (a2)
        addi       a2, a2, __SIZEOF_POINTER__
        blt        a2, a3, 1b 
        
        call       boot

_boot_hart:
        .dword 0