z80 family: Replace explict references to g_readytorun with indirect references via the this_task() macro

This commit is contained in:
Gregory Nutt
2016-02-06 17:32:25 -06:00
parent 4078a3134e
commit 24428f7a59
15 changed files with 38 additions and 38 deletions
+3 -3
View File
@@ -91,7 +91,7 @@ static void _up_assert(int errorcode) /* noreturn_function */
{
/* 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();
for (;;)
@@ -150,7 +150,7 @@ void up_assert(void)
#endif
{
#if CONFIG_TASK_NAME_SIZE > 0
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
struct tcb_s *rtcb = this_task();
#endif
board_autoled_on(LED_ASSERTION);
@@ -181,7 +181,7 @@ void up_assert(void)
#endif
#ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), g_readytorun.head, filename, lineno);
board_crashdump(up_getsp(), this_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);
+7 -7
View File
@@ -77,7 +77,7 @@
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;
/* Verify that the context switch can be performed */
@@ -100,7 +100,7 @@ void up_block_task(FAR 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
*/
@@ -128,10 +128,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
SAVE_IRQCONTEXT(rtcb);
/* 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 */
@@ -146,17 +146,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
* 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!
*/
else if (!SAVE_USERCONTEXT(rtcb))
{
/* 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();
#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
+1 -1
View File
@@ -164,7 +164,7 @@ void _exit(int status)
* head of the list.
*/
tcb = (FAR struct tcb_s*)g_readytorun.head;
tcb = this_task();
slldbg("New Active Task TCB=%p\n", tcb);
#ifdef CONFIG_ARCH_ADDRENV
+6 -6
View File
@@ -68,11 +68,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();
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(); */
if (sched_mergepending())
@@ -96,10 +96,10 @@ void up_release_pending(void)
SAVE_IRQCONTEXT(rtcb);
/* 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 */
@@ -122,10 +122,10 @@ void up_release_pending(void)
else if (!SAVE_USERCONTEXT(rtcb))
{
/* 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();
#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
+6 -6
View File
@@ -95,7 +95,7 @@ void up_reprioritize_rtr(FAR 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;
slldbg("TCB=%p PRI=%d\n", tcb, priority);
@@ -150,10 +150,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
SAVE_IRQCONTEXT(rtcb);
/* 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 */
@@ -168,17 +168,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
* 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!
*/
else if (!SAVE_USERCONTEXT(rtcb))
{
/* 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();
#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
+1 -1
View File
@@ -78,7 +78,7 @@
static void up_stackdump(void)
{
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
struct tcb_s *rtcb = this_task();
uint16_t sp = up_getsp();
uint16_t stack_base = (uint16_t)rtcb->adj_stack_ptr;
uint16_t stack_size = (uint16_t)rtcb->adj_stack_size;
+6 -6
View File
@@ -74,7 +74,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_removeblocked(tcb);
/* Add the task in the correct location in the prioritized
* g_readytorun task list
* ready-to-run task list
*/
if (sched_addreadytorun(tcb))
@@ -112,10 +112,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
SAVE_IRQCONTEXT(rtcb);
/* 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 */
@@ -139,10 +139,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();
#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
+1 -1
View File
@@ -139,7 +139,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* to the currently executing task.
*/
if (tcb == (FAR struct tcb_s*)g_readytorun.head)
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and a task is
* signalling itself for some reason.
+1 -1
View File
@@ -82,7 +82,7 @@
void up_sigdeliver(void)
{
#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];
sig_deliver_t sigdeliver;
+1 -1
View File
@@ -139,7 +139,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* to the currently executing task.
*/
if (tcb == (FAR struct tcb_s*)g_readytorun.head)
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and a task is
* signalling itself for some reason.
+1 -1
View File
@@ -81,7 +81,7 @@
void up_sigdeliver(void)
{
#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];
sig_deliver_t sigdeliver;
+1 -1
View File
@@ -139,7 +139,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* to the currently executing task.
*/
if (tcb == (FAR struct tcb_s*)g_readytorun.head)
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and a task is
* signalling itself for some reason.
+1 -1
View File
@@ -96,7 +96,7 @@ static void z8_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src)
void up_sigdeliver(void)
{
#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];
sig_deliver_t sigdeliver;
+1 -1
View File
@@ -139,7 +139,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* to the currently executing task.
*/
if (tcb == (FAR struct tcb_s*)g_readytorun.head)
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and a task is
* signalling itself for some reason.
+1 -1
View File
@@ -81,7 +81,7 @@
void up_sigdeliver(void)
{
#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];
sig_deliver_t sigdeliver;