mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.58k stars 2.38k forks source link

Setting mstatus.MIE in start.c seems meaningless. #187

Open LiuJiLan opened 1 year ago

LiuJiLan commented 1 year ago

After setting mstatus.MIE in the timerinit() function in start.c, it seems that there is no situation between when mstatus.MIE is set and asm volatile("mret") where global interrupts needing to be used in M-mode are required. And after mret enters S-mode, mstatus.MIE will be replaced by mstatus.MPIE, which is 0. Additionally, due to the design of RISC-V, in lower privilege levels, regardless of the value of mstatus.MIE, interrupts in M-mode are always enabled. I am curious if there is any special consideration for setting mstatus.MIE in this case?