SMP: Used wrong point to wrong TCB

This commit is contained in:
Gregory Nutt 2016-02-15 11:45:34 -06:00
parent fc842d740a
commit cfcd98ca89
2 changed files with 6 additions and 5 deletions

2
arch

@ -1 +1 @@
Subproject commit 839a04f989000895820af4691d9596fc4385f48b
Subproject commit 414b1da6b18e57ec4119c0a70f84e7c635243717

View File

@ -171,7 +171,6 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
bool sched_addreadytorun(FAR struct tcb_s *btcb)
{
FAR struct tcb_s *rtcb;
FAR struct tcb_s *next;
FAR dq_queue_t *tasklist;
int task_state;
int cpu;
@ -305,7 +304,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
* and check if a context switch will occur
*/
tasklist = (FAR dq_queue_t *)g_assignedtasks[cpu].head;
tasklist = (FAR dq_queue_t *)&g_assignedtasks[cpu];
switched = sched_addprioritized(btcb, tasklist);
/* If the selected task was the g_assignedtasks[] list, then a context
@ -314,6 +313,8 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
if (switched)
{
FAR struct tcb_s *next;
/* The new btcb was added at the head of the ready-to-run list. It
* is now the new active task!
*
@ -375,7 +376,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
next = (FAR struct tcb_s *)btcb->flink;
ASSERT(!rtcb->lockcount && next != NULL);
if ((btcb->flags & TCB_FLAG_CPU_ASSIGNED) != 0)
if ((next->flags & TCB_FLAG_CPU_ASSIGNED) != 0)
{
next->task_state = TSTATE_TASK_ASSIGNED;
}
@ -390,7 +391,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
*/
next->task_state = TSTATE_TASK_READYTORUN;
(void)sched_addprioritized(btcb,
(void)sched_addprioritized(next,
(FAR dq_queue_t *)&g_readytorun);
}