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 <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2024-03-21 09:29:57 +02:00 committed by Xiang Xiao
parent 0dee4eb7f0
commit 1f6079814a

View File

@ -28,6 +28,7 @@
#include <nuttx/addrenv.h>
#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();