xv6-riscv-kernel/kernel/entry.S

21 lines
548 B
ArmAsm
Raw Normal View History

2020-08-15 11:46:32 +02:00
# qemu -kernel loads the kernel at 0x80000000
# and causes each CPU to jump there.
# kernel.ld causes the following code to
# be placed at 0x80000000.
2019-05-31 15:45:59 +02:00
.section .text
_entry:
2019-06-05 17:42:03 +02:00
# set up a stack for C.
# stack0 is declared in start.c,
# with a 4096-byte stack per CPU.
# sp = stack0 + (hartid * 4096)
2019-05-31 15:45:59 +02:00
la sp, stack0
2019-06-05 17:42:03 +02:00
li a0, 1024*4
csrr a1, mhartid
addi a1, a1, 1
mul a0, a0, a1
add sp, sp, a0
2019-07-23 20:31:12 +02:00
# jump to start() in start.c
call start
2020-08-15 11:46:32 +02:00
spin:
j spin