Skip to content

Commit

Permalink
xtensa: remove g_running_tasks[this_cpu()] = NULL
Browse files Browse the repository at this point in the history
reason:
We hope to keep g_running_tasks valid forever.

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Nov 27, 2024
1 parent 825ba8e commit 8f19494
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/xtensa/src/common/xtensa_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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 */

Expand Down
6 changes: 5 additions & 1 deletion arch/xtensa/src/common/xtensa_irqdispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)

up_set_current_regs(regs);

if (*running_task != NULL)
/* This judgment proves that (*running_task)->xcp.regs
* is invalid, and we can safely overwrite it.
*/

if (!(XTENSA_IRQ_SWINT == irq && regs[REG_A2] == SYS_restore_context))
{
(*running_task)->xcp.regs = regs;
}
Expand Down

0 comments on commit 8f19494

Please sign in to comment.