arch/risc-v/src: Branch to up_sigdeliver() with interrupts disabled

When executing an MRET instruction, MIE is set to MPIE.
In order to branch to up_sigdeliver() with interrupts disabled,
we need to change MPIE, not MIE.
This commit is contained in:
Yoshinori Sugino 2020-09-29 00:49:53 +09:00 committed by Brennan Ashton
parent 2adec1f366
commit 3de85be15a
3 changed files with 9 additions and 9 deletions

View File

@ -159,7 +159,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
CURRENT_REGS[REG_EPC] = (uintptr_t)up_sigdeliver;
int_ctx = CURRENT_REGS[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
#ifdef CONFIG_BUILD_PROTECTED
int_ctx |= MSTATUS_MPPM;
#endif
@ -203,7 +203,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC] = (uintptr_t)up_sigdeliver;
int_ctx = tcb->xcp.regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
tcb->xcp.regs[REG_INT_CTX] = int_ctx;
@ -304,7 +304,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC] = (uintptr_t)up_sigdeliver;
int_ctx = tcb->xcp.regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
tcb->xcp.regs[REG_INT_CTX] = int_ctx;
}
@ -329,7 +329,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
CURRENT_REGS[REG_EPC] = (uintptr_t)up_sigdeliver;
int_ctx = CURRENT_REGS[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
#ifdef CONFIG_BUILD_PROTECTED
int_ctx |= MSTATUS_MPPM;
#endif
@ -400,7 +400,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC] = (uintptr_t)up_sigdeliver;
int_ctx = tcb->xcp.regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
tcb->xcp.regs[REG_INT_CTX] = int_ctx;
}

View File

@ -138,7 +138,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
g_current_regs[REG_EPC] = (uint32_t)up_sigdeliver;
int_ctx = g_current_regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
g_current_regs[REG_INT_CTX] = int_ctx;
@ -178,7 +178,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC] = (uint32_t)up_sigdeliver;
int_ctx = tcb->xcp.regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
tcb->xcp.regs[REG_INT_CTX] = int_ctx;

View File

@ -139,7 +139,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
g_current_regs[REG_EPC] = (uint32_t)up_sigdeliver;
int_ctx = g_current_regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
g_current_regs[REG_INT_CTX] = int_ctx;
@ -179,7 +179,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC] = (uint32_t)up_sigdeliver;
int_ctx = tcb->xcp.regs[REG_INT_CTX];
int_ctx &= ~MSTATUS_MIE;
int_ctx &= ~MSTATUS_MPIE;
tcb->xcp.regs[REG_INT_CTX] = int_ctx;