mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-23 08:26:17 +04:00
Fix user process bug on RV32.
Set sstatus.SIE = 0 on the initial TrapFrame, to prevent interrupt on switching.
This commit is contained in:
parent
6fc23e1134
commit
ed20aa45fd
@ -62,7 +62,7 @@ _save_context:
|
||||
lw s1, 32*4(sp) # s1 = sstatus
|
||||
lw s2, 33*4(sp) # s2 = sepc
|
||||
andi s0, s1, 1 << 8
|
||||
bnez s0, _restore_context # back to U-mode? (sstatus.SPP = 1)
|
||||
bnez s0, _restore_context # back to S-mode? (sstatus.SPP = 1)
|
||||
_save_kernel_sp:
|
||||
addi s0, sp, 36*4
|
||||
csrw 0x140, s0 # sscratch = kernel-sp
|
||||
|
@ -30,7 +30,8 @@ impl TrapFrame {
|
||||
tf.x[2] = sp;
|
||||
tf.sepc = entry_addr;
|
||||
tf.sstatus = sstatus::read();
|
||||
tf.sstatus.set_spie(false); // Enable interrupt
|
||||
tf.sstatus.set_spie(true);
|
||||
tf.sstatus.set_sie(false);
|
||||
tf.sstatus.set_spp(sstatus::SPP::User);
|
||||
tf
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user