From d4024c838809fe1981daa1942e3c9cd683fe4d6e Mon Sep 17 00:00:00 2001 From: chao an Date: Thu, 11 Jul 2024 15:28:55 +0800 Subject: [PATCH] arch/armv8-r: update g_running_tasks before context switch fix invalid running_task() in assertion logic Signed-off-by: chao an --- arch/arm/src/armv8-r/arm_doirq.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/src/armv8-r/arm_doirq.c b/arch/arm/src/armv8-r/arm_doirq.c index c265a14976..c949d21b96 100644 --- a/arch/arm/src/armv8-r/arm_doirq.c +++ b/arch/arm/src/armv8-r/arm_doirq.c @@ -31,6 +31,7 @@ #include #include +#include #include "arm_internal.h" #include "arm_gic.h" @@ -64,6 +65,13 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) if (regs != CURRENT_REGS) { + /* Record the new "running" task when context switch occurred. + * g_running_tasks[] is only used by assertion logic for reporting + * crashes. + */ + + g_running_tasks[this_cpu()] = this_task(); + restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; }