arch/armv8-r: update g_running_tasks before context switch

fix invalid running_task() in assertion logic

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-07-11 15:28:55 +08:00 committed by Xiang Xiao
parent 2f8560e838
commit d4024c8388

View File

@ -31,6 +31,7 @@
#include <nuttx/board.h>
#include <arch/board/board.h>
#include <sched/sched.h>
#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;
}