mirror of
https://github.com/plctlab/riscv-operating-system-mooc.git
synced 2025-11-16 12:34:47 +00:00
I493SN:fix bugs introduced by I441IC
This commit is contained in:
@@ -30,14 +30,7 @@ _start:
|
||||
add sp, sp, t0 # move the current hart stack pointer
|
||||
# to its place in the stack space
|
||||
|
||||
# At the end of start_kernel, schedule() will call MRET to switch
|
||||
# to the first task, so we parepare the mstatus here.
|
||||
# Notice: default mstatus is 0
|
||||
#ifdef CONFIG_SYSCALL
|
||||
# Keep mstatus.MPP as 0, so we will run in User mode after MRET.
|
||||
# Set mstatus.MPIE to 1, so MRET will enable the interrupt.
|
||||
li t0, 1 << 7
|
||||
|
||||
# https://lore.kernel.org/qemu-devel/20201223192553.332508-1-atish.patra@wdc.com/
|
||||
# For qemu version >= 6.0, exception would be raised if no PMP enty is
|
||||
# configured. So just configure one entny, which allows all the whole
|
||||
@@ -53,6 +46,15 @@ _start:
|
||||
csrw pmpaddr0, t0
|
||||
li t0, 0xf
|
||||
csrw pmpcfg0, t0
|
||||
#endif
|
||||
|
||||
# At the end of start_kernel, schedule() will call MRET to switch
|
||||
# to the first task, so we parepare the mstatus here.
|
||||
# Notice: default mstatus is 0
|
||||
#ifdef CONFIG_SYSCALL
|
||||
# Keep mstatus.MPP as 0, so we will run in User mode after MRET.
|
||||
# Set mstatus.MPIE to 1, so MRET will enable the interrupt.
|
||||
li t0, 1 << 7
|
||||
#else
|
||||
# Set mstatus.MPP to 3, so we still run in Machine mode after MRET.
|
||||
# Set mstatus.MPIE to 1, so MRET will enable the interrupt.
|
||||
|
||||
Reference in New Issue
Block a user