armv6m: fix regresion from https://github.com/apache/nuttx/pull/14881
reason: svc call may trigger hardfalt Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
d368c0cc04
commit
702affa63b
3 changed files with 12 additions and 2 deletions
|
@ -65,7 +65,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
|
||||||
* is invalid, and we can safely overwrite it.
|
* is invalid, and we can safely overwrite it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(NVIC_IRQ_SVCALL == irq && regs[REG_R0] == SYS_restore_context))
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
tcb->xcp.regs = regs;
|
tcb->xcp.regs = regs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,7 @@ retry:
|
||||||
rtcb->irqcount--;
|
rtcb->irqcount--;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
rtcb->xcp.regs = rtcb->xcp.saved_regs;
|
rtcb->xcp.regs = rtcb->xcp.saved_regs;
|
||||||
arm_fullcontextrestore();
|
arm_fullcontextrestore();
|
||||||
UNUSED(regs);
|
UNUSED(regs);
|
||||||
|
|
|
@ -60,9 +60,18 @@ void up_exit(int status)
|
||||||
|
|
||||||
nxtask_exit();
|
nxtask_exit();
|
||||||
|
|
||||||
/* Scheduler parameters will update inside syscall */
|
/* Update g_running_tasks */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_ARMV6M
|
||||||
|
/* ARMV6M syscal may trigger hard fault, We use
|
||||||
|
* running_task != NULL to determine whether it is
|
||||||
|
* a context for restoration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
#else
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = this_task();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue