risc-v: remove g_running_tasks[this_cpu()] = NULL

reason:
We hope to keep g_running_tasks valid forever.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-11-29 15:03:05 +08:00 committed by Xiang Xiao
parent 19e42a8978
commit 400239877d
4 changed files with 7 additions and 8 deletions

View file

@ -73,9 +73,12 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs)
if (irq >= RISCV_IRQ_ECALLU && irq <= RISCV_IRQ_ECALLM)
{
regs[REG_EPC] += 4;
if (regs[REG_A0] != SYS_restore_context)
{
(*running_task)->xcp.regs = regs;
}
}
if (*running_task != NULL)
else
{
(*running_task)->xcp.regs = regs;
}

View file

@ -62,7 +62,7 @@ void up_exit(int status)
/* Scheduler parameters will update inside syscall */
g_running_tasks[this_cpu()] = NULL;
g_running_tasks[this_cpu()] = tcb;
/* Then switch contexts */

View file

@ -164,10 +164,6 @@ retry:
rtcb->irqcount--;
#endif
/* g_running_tasks is not valid now */
g_running_tasks[this_cpu()] = NULL;
rtcb->xcp.regs = regs;
riscv_fullcontextrestore();
}

View file

@ -42,7 +42,7 @@ void *riscv_perform_syscall(uintreg_t *regs)
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
struct tcb_s *tcb;
if (*running_task != NULL)
if (regs[REG_A0] != SYS_restore_context)
{
(*running_task)->xcp.regs = regs;
}