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