fix: risc-v 锁中断在调度后失效

risc-v架构中,由于执行完mret指令之后,未将mstatus.mpie位清除,
导致锁中断后调度保存上下文信息后, 恢复上下文时误将中断打开。

Close #I42OLJ
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib97b8bd0fc56bd4b2a7e5c474cb240db4e9c2419
This commit is contained in:
zhushengle 2021-07-27 21:38:33 +08:00
parent 403d6dc428
commit 70f3aa1c11
1 changed files with 13 additions and 2 deletions

View File

@ -107,14 +107,25 @@
HalTaskContextSwitch:
PUSH_ALL_REG
// clear mpie
li a2, RISCV_MSTATUS_MPIE
not a2, a2
and a0, a0, a2
// get mie
andi a1, a0, RISCV_MSTATUS_MIE
// must be in machine mode
ori a1, a1, 0x180
slli a1, a1, 0x4
or a0, a0, a1
li a1, ~RISCV_MSTATUS_MIE
and a0, a0, a1
// clear mie
li a2, RISCV_MSTATUS_MIE
not a2, a2
and a0, a0, a2
SREG a0, 16 * REGBYTES(sp)
SREG ra, 17 * REGBYTES(sp)