From d932ac1121ee535dc4479f9fc49e81e1e70256c0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 29 Aug 2009 08:44:30 +0000 Subject: [PATCH] Fixed bug 2846336. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_1.2.x@1126 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- readme.txt | 1 + src/chschd.c | 10 +++++----- src/include/scheduler.h | 5 +---- src/include/vt.h | 3 ++- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/readme.txt b/readme.txt index 758b93f8c..dc877ca88 100644 --- a/readme.txt +++ b/readme.txt @@ -3,6 +3,7 @@ ***************************************************************************** *** 1.2.4 *** +- FIX: Fixed GCC 4.4.x aliasing warnings (bug 2846336). - FIX: Modified linker scripts for GCC 4.4.x (bug 2846302). - FIX: Fixed the CH_OPTIMIZE_SPEED option in the CM3 port (bug 2846278). - FIX: Fixed GCC 4.4.x related problems in CM3 port (bug 2846162). diff --git a/src/chschd.c b/src/chschd.c index aefe4355b..f072a8c3f 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -44,7 +44,7 @@ ReadyList rlist; */ void scheduler_init(void) { - queue_init(&rlist); + queue_init(&rlist.r_queue); rlist.r_prio = NOPRIO; #if CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; @@ -89,7 +89,7 @@ void chSchGoSleepS(tstate_t newstate) { Thread *otp; (otp = currp)->p_state = newstate; - (currp = fifo_remove((void *)&rlist))->p_state = PRCURR; + (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR; #if CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; #endif @@ -198,7 +198,7 @@ void chSchDoRescheduleI(void) { Thread *otp = currp; /* pick the first thread from the ready queue and makes it current */ - (currp = fifo_remove((void *)&rlist))->p_state = PRCURR; + (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR; chSchReadyI(otp); #if CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; @@ -215,7 +215,7 @@ void chSchDoRescheduleI(void) { void chSchRescheduleS(void) { /* first thread in the runnable queue has higher priority than the running * thread? */ - if (firstprio(&rlist) > currp->p_prio) + if (firstprio(&rlist.r_queue) > currp->p_prio) chSchDoRescheduleI(); } @@ -228,7 +228,7 @@ void chSchRescheduleS(void) { * @retval FALSE if a reschedulation is not required. */ bool_t chSchRescRequiredI(void) { - tprio_t p1 = firstprio(&rlist); + tprio_t p1 = firstprio(&rlist.r_queue); tprio_t p2 = currp->p_prio; #if CH_USE_ROUNDROBIN /* If the running thread has not reached its time quantum, reschedule only diff --git a/src/include/scheduler.h b/src/include/scheduler.h index 4149eab17..b10a9aa8e 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -71,10 +71,7 @@ * @extends ThreadsQueue */ typedef struct { - Thread *p_next; /**< Next @p Thread in the ready list.*/ - Thread *p_prev; /**< Previous @p Thread in the ready - list.*/ - /* End of the fields shared with the ThreadsQueue structure. */ + ThreadsQueue r_queue; /**< Threads queue.*/ tprio_t r_prio; /**< This field must be initialized to zero.*/ /* End of the fields shared with the Thread structure. */ diff --git a/src/include/vt.h b/src/include/vt.h index 45ed3b275..58c171a0b 100644 --- a/src/include/vt.h +++ b/src/include/vt.h @@ -96,7 +96,8 @@ extern VTList vtlist; while (!(vtp = vtlist.vt_next)->vt_time) { \ vtfunc_t fn = vtp->vt_func; \ vtp->vt_func = NULL; \ - (vtp->vt_next->vt_prev = (void *)&vtlist)->vt_next = vtp->vt_next;\ + vtp->vt_next->vt_prev = (void *)&vtlist; \ + (&vtlist)->vt_next = vtp->vt_next; \ fn(vtp->vt_par); \ } \ } \