From ea4c4ef36a8b6481268ea62638a69a0175dda624 Mon Sep 17 00:00:00 2001 From: chao an Date: Thu, 24 Oct 2024 19:43:16 +0800 Subject: [PATCH] arm/armv8-r: fix unable to switch context in ISR context Regression by: | commit 35c8c80a00a99ff0e19d51eaa74165bd830a36f8 | Author: ligd | Date: Fri Jul 26 23:14:13 2024 +0800 | | arch: change nxsched_suspend/resume_scheduler() called position Signed-off-by: chao an --- arch/arm/src/armv8-r/arm_doirq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/armv8-r/arm_doirq.c b/arch/arm/src/armv8-r/arm_doirq.c index 98c5dc4bc2..af47bc641d 100644 --- a/arch/arm/src/armv8-r/arm_doirq.c +++ b/arch/arm/src/armv8-r/arm_doirq.c @@ -58,7 +58,9 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) * and we will use this_task(). Therefore, it cannot be overridden. */ +#ifdef CONFIG_SMP if (irq != GIC_SMP_CPUSTART) +#endif { tcb->xcp.regs = regs; } @@ -72,11 +74,10 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) /* Deliver the IRQ */ irq_dispatch(irq, regs); + tcb = this_task(); if (regs != tcb->xcp.regs) { - tcb = this_task(); - /* Update scheduler parameters */ nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); @@ -87,7 +88,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) * crashes. */ - g_running_tasks[this_cpu()] = this_task(); + g_running_tasks[this_cpu()] = tcb; regs = tcb->xcp.regs; }