提交 70f3aa1c 编写于 作者: Z zhushengle

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

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

Close #I42OLJ
Signed-off-by: Nzhushengle <zhushengle@huawei.com>
Change-Id: Ib97b8bd0fc56bd4b2a7e5c474cb240db4e9c2419
上级 403d6dc4
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册