This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d4024c8388 arch/armv8-r: update g_running_tasks before context switch
d4024c8388 is described below
commit d4024c838809fe1981daa1942e3c9cd683fe4d6e
Author: chao an <[email protected]>
AuthorDate: Thu Jul 11 15:28:55 2024 +0800
arch/armv8-r: update g_running_tasks before context switch
fix invalid running_task() in assertion logic
Signed-off-by: chao an <[email protected]>
---
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 <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;
}