[add] laos using xv6-riscv thought

This commit is contained in:
bLueriVerLHR
2023-05-18 00:05:52 +08:00
parent 399c978c09
commit 5d31bf294c
21 changed files with 462 additions and 22 deletions

20
laos/src/kernel/entry.S Normal file
View File

@@ -0,0 +1,20 @@
#include "asm.h"
.section .entry
.global _entry
_entry:
# set up a stack for C.
# stack0 is declared in start.c,
# with a 4096-byte stack per CPU.
# sp = stack0 + (hartid * 4096)
la.global $sp, stack0
lu12i.w $a0, (1024*4 >> 12) & 0xfffff
addi.w $a0, $a0, 1024*4 & 0xfff
csrrd $a1, CPUID
addi.w $a1, $a1, 1
mul.w $a0, $a0, $a1
add.w $sp, $sp, $a0
# jump to start() in start.c
bl start
spin:
b spin