Better fix for bug 2846162.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1112 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2009-08-28 14:53:54 +00:00
parent 518fc97030
commit 1ce340b59e
2 changed files with 4 additions and 5 deletions

View File

@ -138,19 +138,18 @@ static void wakeup(void *p) {
* @retval RDY_TIMEOUT if a timeout occurs. * @retval RDY_TIMEOUT if a timeout occurs.
*/ */
msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
Thread *tp = currp;
if (TIME_INFINITE != time) { if (TIME_INFINITE != time) {
VirtualTimer vt; VirtualTimer vt;
chVTSetI(&vt, time, wakeup, tp); chVTSetI(&vt, time, wakeup, currp);
chSchGoSleepS(newstate); chSchGoSleepS(newstate);
if (chVTIsArmedI(&vt)) if (chVTIsArmedI(&vt))
chVTResetI(&vt); chVTResetI(&vt);
} }
else else
chSchGoSleepS(newstate); chSchGoSleepS(newstate);
return tp->p_rdymsg; return currp->p_rdymsg;
} }
/** /**

View File

@ -306,13 +306,13 @@ struct context {
if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) \ if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) \
asm volatile ("movs r0, #0 \n\t" \ asm volatile ("movs r0, #0 \n\t" \
"b chDbgPanic"); \ "b chDbgPanic"); \
asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp)); \ asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); \
} }
#else /* !CH_DBG_ENABLE_STACK_CHECK */ #else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(otp, ntp) { \ #define port_switch(otp, ntp) { \
register Thread *_otp asm ("r0") = (otp); \ register Thread *_otp asm ("r0") = (otp); \
register Thread *_ntp asm ("r1") = (ntp); \ register Thread *_ntp asm ("r1") = (ntp); \
asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp)); \ asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); \
} }
#endif /* !CH_DBG_ENABLE_STACK_CHECK */ #endif /* !CH_DBG_ENABLE_STACK_CHECK */