diff --git a/arch/sim/src/up_blocktask.c b/arch/sim/src/up_blocktask.c index dbd5acc9ea9..ccc39204896 100644 --- a/arch/sim/src/up_blocktask.c +++ b/arch/sim/src/up_blocktask.c @@ -75,7 +75,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) { - FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head; + FAR struct tcb_s *rtcb = this_task(); bool switch_needed; /* Verify that the context switch can be performed */ @@ -98,7 +98,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) sched_addblocked(tcb, (tstate_t)task_state); - /* If there are any pending tasks, then add them to the g_readytorun + /* If there are any pending tasks, then add them to the ready-to-run * task list now */ @@ -116,17 +116,17 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) sched_suspend_scheduler(rtcb); /* Copy the exception context into the TCB at the (old) head of the - * g_readytorun Task list. if up_setjmp returns a non-zero + * ready-to-run Task list. if up_setjmp returns a non-zero * value, then this is really the previously running task restarting! */ if (!up_setjmp(rtcb->xcp.regs)) { /* Restore the exception context of the rtcb at the (new) head - * of the g_readytorun task list. + * of the ready-to-run task list. */ - rtcb = (FAR struct tcb_s *)g_readytorun.head; + rtcb = this_task(); sdbg("New Active Task TCB=%p\n", rtcb); /* The way that we handle signals in the simulation is kind of diff --git a/arch/sim/src/up_exit.c b/arch/sim/src/up_exit.c index 3f3b8301afb..a022405d762 100644 --- a/arch/sim/src/up_exit.c +++ b/arch/sim/src/up_exit.c @@ -48,18 +48,6 @@ #include "sched/sched.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -89,7 +77,7 @@ void _exit(int status) * head of the list. */ - tcb = (FAR struct tcb_s *)g_readytorun.head; + tcb = this_task(); sdbg("New Active Task TCB=%p\n", tcb); /* The way that we handle signals in the simulation is kind of diff --git a/arch/sim/src/up_head.c b/arch/sim/src/up_head.c index 323370c030c..727e107a523 100644 --- a/arch/sim/src/up_head.c +++ b/arch/sim/src/up_head.c @@ -112,7 +112,7 @@ void up_assert(const uint8_t *filename, int line) /* Allow for any board/configuration specific crash information */ #ifdef CONFIG_BOARD_CRASHDUMP - board_crashdump(up_getsp(), g_readytorun.head, filename, line); + board_crashdump(up_getsp(), this_task(), filename, line); #endif /* Exit the simulation */ diff --git a/arch/sim/src/up_releasepending.c b/arch/sim/src/up_releasepending.c index 0efc0106f35..386b58589a3 100644 --- a/arch/sim/src/up_releasepending.c +++ b/arch/sim/src/up_releasepending.c @@ -64,11 +64,11 @@ void up_release_pending(void) { - FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head; + FAR struct tcb_s *rtcb = this_task(); sdbg("From TCB=%p\n", rtcb); - /* Merge the g_pendingtasks list into the g_readytorun task list */ + /* Merge the g_pendingtasks list into the ready-to-run task list */ /* sched_lock(); */ if (sched_mergepending()) @@ -89,10 +89,10 @@ void up_release_pending(void) if (!up_setjmp(rtcb->xcp.regs)) { /* Restore the exception context of the rtcb at the (new) head - * of the g_readytorun task list. + * of the ready-to-run task list. */ - rtcb = (FAR struct tcb_s *)g_readytorun.head; + rtcb = this_task(); sdbg("New Active Task TCB=%p\n", rtcb); /* The way that we handle signals in the simulation is kind of diff --git a/arch/sim/src/up_reprioritizertr.c b/arch/sim/src/up_reprioritizertr.c index 49b9e6f1e1e..39c981c6483 100644 --- a/arch/sim/src/up_reprioritizertr.c +++ b/arch/sim/src/up_reprioritizertr.c @@ -92,7 +92,7 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) } else { - FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head; + FAR struct tcb_s *rtcb = this_task(); bool switch_needed; sdbg("TCB=%p PRI=%d\n", tcb, priority); @@ -137,17 +137,17 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) sched_suspend_scheduler(rtcb); /* Copy the exception context into the TCB at the (old) head of the - * g_readytorun Task list. if up_setjmp returns a non-zero + * ready-to-run Task list. if up_setjmp returns a non-zero * value, then this is really the previously running task restarting! */ if (!up_setjmp(rtcb->xcp.regs)) { /* Restore the exception context of the rtcb at the (new) head - * of the g_readytorun task list. + * of the ready-to-run task list. */ - rtcb = (FAR struct tcb_s *)g_readytorun.head; + rtcb = this_task(); sdbg("New Active Task TCB=%p\n", rtcb); /* The way that we handle signals in the simulation is kind of diff --git a/arch/sim/src/up_schedulesigaction.c b/arch/sim/src/up_schedulesigaction.c index 686a4de22bf..6664f489a71 100644 --- a/arch/sim/src/up_schedulesigaction.c +++ b/arch/sim/src/up_schedulesigaction.c @@ -100,7 +100,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) { /* We don't have to anything complex for the simulated target */ - if (tcb == (FAR struct tcb_s *)g_readytorun.head) + if (tcb == this_task()) { sigdeliver(tcb); } diff --git a/arch/sim/src/up_unblocktask.c b/arch/sim/src/up_unblocktask.c index 09deede2257..07e3954ce8f 100644 --- a/arch/sim/src/up_unblocktask.c +++ b/arch/sim/src/up_unblocktask.c @@ -70,7 +70,7 @@ void up_unblock_task(FAR struct tcb_s *tcb) { - FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head; + FAR struct tcb_s *rtcb = this_task(); /* Verify that the context switch can be performed */ @@ -88,7 +88,7 @@ void up_unblock_task(FAR struct tcb_s *tcb) sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized - * g_readytorun task list + * ready-to-run task list */ if (sched_addreadytorun(tcb)) @@ -107,10 +107,10 @@ void up_unblock_task(FAR struct tcb_s *tcb) { /* Restore the exception context of the new task that is ready to * run (probably tcb). This is the new rtcb at the head of the - * g_readytorun task list. + * ready-to-run task list. */ - rtcb = (FAR struct tcb_s *)g_readytorun.head; + rtcb = this_task(); sdbg("New Active Task TCB=%p\n", rtcb); /* The way that we handle signals in the simulation is kind of