z16: Replace explict references to g_readytorun with indirect references via the this_task() macro
This commit is contained in:
parent
b0bcd82ba7
commit
4078a3134e
@ -76,10 +76,6 @@
|
|||||||
# undef CONFIG_ARCH_USBDUMP
|
# undef CONFIG_ARCH_USBDUMP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -92,7 +88,7 @@ static void _up_assert(int errorcode) /* noreturn_function */
|
|||||||
{
|
{
|
||||||
/* Are we in an interrupt handler or the idle task? */
|
/* Are we in an interrupt handler or the idle task? */
|
||||||
|
|
||||||
if (up_interrupt_context() || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (up_interrupt_context() || this_task()->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for (;;)
|
for (;;)
|
||||||
@ -151,7 +147,7 @@ void up_assert(void)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
struct tcb_s *rtcb = this_task();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
board_autoled_on(LED_ASSERTION);
|
board_autoled_on(LED_ASSERTION);
|
||||||
@ -182,7 +178,7 @@ void up_assert(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||||
board_crashdump(up_getsp(), g_readytorun.head, filename, lineno);
|
board_crashdump(up_getsp(), this_task(), filename, lineno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_up_assert(EXIT_FAILURE);
|
_up_assert(EXIT_FAILURE);
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
void up_block_task(FAR 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;
|
bool switch_needed;
|
||||||
|
|
||||||
/* Verify that the context switch can be performed */
|
/* Verify that the context switch can be performed */
|
||||||
@ -98,7 +98,7 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
sched_addblocked(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
|
* task list now
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -126,10 +126,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
SAVE_IRQCONTEXT(rtcb);
|
SAVE_IRQCONTEXT(rtcb);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Reset scheduler parameters */
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
@ -143,17 +143,17 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the user C context into the TCB at the (old) head of the
|
/* Copy the user C context into the TCB at the (old) head of the
|
||||||
* g_readytorun Task list. if SAVE_USERCONTEXT returns a non-zero
|
* ready-to-run Task list. if SAVE_USERCONTEXT returns a non-zero
|
||||||
* value, then this is really the previously running task restarting!
|
* value, then this is really the previously running task restarting!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (!SAVE_USERCONTEXT(rtcb))
|
else if (!SAVE_USERCONTEXT(rtcb))
|
||||||
{
|
{
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Reset scheduler parameters */
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
@ -53,14 +53,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -162,7 +154,7 @@ void _exit(int status)
|
|||||||
* head of the list.
|
* head of the list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcb = (FAR struct tcb_s*)g_readytorun.head;
|
tcb = this_task();
|
||||||
slldbg("New Active Task TCB=%p\n", tcb);
|
slldbg("New Active Task TCB=%p\n", tcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
@ -66,11 +66,11 @@
|
|||||||
|
|
||||||
void up_release_pending(void)
|
void up_release_pending(void)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
FAR struct tcb_s *rtcb = this_task();
|
||||||
|
|
||||||
slldbg("From TCB=%p\n", rtcb);
|
slldbg("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(); */
|
/* sched_lock(); */
|
||||||
if (sched_mergepending())
|
if (sched_mergepending())
|
||||||
@ -94,10 +94,10 @@ void up_release_pending(void)
|
|||||||
SAVE_IRQCONTEXT(rtcb);
|
SAVE_IRQCONTEXT(rtcb);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
@ -119,10 +119,10 @@ void up_release_pending(void)
|
|||||||
else if (!SAVE_USERCONTEXT(rtcb))
|
else if (!SAVE_USERCONTEXT(rtcb))
|
||||||
{
|
{
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
FAR struct tcb_s *rtcb = this_task();
|
||||||
bool switch_needed;
|
bool switch_needed;
|
||||||
|
|
||||||
slldbg("TCB=%p PRI=%d\n", tcb, priority);
|
slldbg("TCB=%p PRI=%d\n", tcb, priority);
|
||||||
@ -148,10 +148,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
SAVE_IRQCONTEXT(rtcb);
|
SAVE_IRQCONTEXT(rtcb);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
@ -165,17 +165,17 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the exception context into the TCB at the (old) head of the
|
/* Copy the exception context into the TCB at the (old) head of the
|
||||||
* g_readytorun Task list. if SAVE_USERCONTEXT returns a non-zero
|
* ready-to-run Task list. if SAVE_USERCONTEXT returns a non-zero
|
||||||
* value, then this is really the previously running task restarting!
|
* value, then this is really the previously running task restarting!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (!SAVE_USERCONTEXT(rtcb))
|
else if (!SAVE_USERCONTEXT(rtcb))
|
||||||
{
|
{
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
@ -51,18 +51,6 @@
|
|||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -118,9 +106,9 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dbg("rtcb=0x%p current_regs=0x%p\n", g_readytorun.head, current_regs);
|
dbg("rtcb=0x%p current_regs=0x%p\n", this_task(), current_regs);
|
||||||
|
|
||||||
if (tcb == (FAR struct tcb_s*)g_readytorun.head)
|
if (tcb == this_task())
|
||||||
{
|
{
|
||||||
/* CASE 1: We are not in an interrupt handler and
|
/* CASE 1: We are not in an interrupt handler and
|
||||||
* a task is signalling itself for some reason.
|
* a task is signalling itself for some reason.
|
||||||
|
@ -53,18 +53,6 @@
|
|||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -82,7 +70,7 @@
|
|||||||
void up_sigdeliver(void)
|
void up_sigdeliver(void)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
FAR struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
FAR struct tcb_s *rtcb = this_task();
|
||||||
chipreg_t regs[XCPTCONTEXT_REGS];
|
chipreg_t regs[XCPTCONTEXT_REGS];
|
||||||
FAR uint32_t *regs32 = (FAR uint32_t*)regs;
|
FAR uint32_t *regs32 = (FAR uint32_t*)regs;
|
||||||
sig_deliver_t sigdeliver;
|
sig_deliver_t sigdeliver;
|
||||||
|
@ -54,14 +54,6 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -77,7 +69,7 @@
|
|||||||
|
|
||||||
static void up_stackdump(void)
|
static void up_stackdump(void)
|
||||||
{
|
{
|
||||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
struct tcb_s *rtcb = this_task();
|
||||||
chipreg_t sp = up_getsp();
|
chipreg_t sp = up_getsp();
|
||||||
chipreg_t stack_base = (chipreg_t)rtcb->adj_stack_ptr;
|
chipreg_t stack_base = (chipreg_t)rtcb->adj_stack_ptr;
|
||||||
chipreg_t stack_size = (chipreg_t)rtcb->adj_stack_size;
|
chipreg_t stack_size = (chipreg_t)rtcb->adj_stack_size;
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
void up_unblock_task(FAR struct tcb_s *tcb)
|
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 */
|
/* Verify that the context switch can be performed */
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||||||
sched_removeblocked(tcb);
|
sched_removeblocked(tcb);
|
||||||
|
|
||||||
/* Add the task in the correct location in the prioritized
|
/* Add the task in the correct location in the prioritized
|
||||||
* g_readytorun task list
|
* ready-to-run task list
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (sched_addreadytorun(tcb))
|
if (sched_addreadytorun(tcb))
|
||||||
@ -110,10 +110,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||||||
SAVE_IRQCONTEXT(rtcb);
|
SAVE_IRQCONTEXT(rtcb);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* 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();
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
@ -136,10 +136,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||||||
{
|
{
|
||||||
/* Restore the exception context of the new task that is ready to
|
/* 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
|
* 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();
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user