From 13ea8e13d160c8b2fbb9c5a19ad1f851d14bbdc0 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Thu, 21 Mar 2024 09:29:57 +0200 Subject: [PATCH] arch/risc-v/src/common/supervisor/riscv_perform_syscall.c: Record the currently running task in risc-v syscall If a context switch occurs in syscall, the g_running_task need to be recorded for assert logic. This copies the logic from arm platforms Signed-off-by: Jukka Laitinen --- arch/risc-v/src/common/supervisor/riscv_perform_syscall.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c b/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c index 88d8be77ee2e3..d1bf8503b4c0e 100644 --- a/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c +++ b/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c @@ -28,6 +28,7 @@ #include +#include "sched/sched.h" #include "riscv_internal.h" /**************************************************************************** @@ -59,6 +60,12 @@ void *riscv_perform_syscall(uintptr_t *regs) if (regs != CURRENT_REGS) { + /* Record the new "running" task. g_running_tasks[] is only used by + * assertion logic for reporting crashes. + */ + + g_running_tasks[this_cpu()] = this_task(); + /* Restore the cpu lock */ restore_critical_section();