Fixed bug 3064274.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.0.x@2190 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2010-09-25 05:53:16 +00:00
parent 0f943a5e86
commit 46e4a207af
2 changed files with 18 additions and 10 deletions

View File

@ -270,17 +270,23 @@ struct intctx {
* @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out
*/
static INLINE void port_switch(Thread *ntp, Thread *otp) {
register Thread *_ntp asm ("r0") = (ntp);
register Thread *_otp asm ("r1") = (otp);
#if CH_DBG_ENABLE_STACK_CHECK
register char *sp asm ("sp");
if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp)
asm volatile ("movs r0, #0 \n\t"
"b chDbgPanic");
#endif /* CH_DBG_ENABLE_STACK_CHECK */
asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory");
#if !CH_DBG_ENABLE_STACK_CHECK || defined(__DOXYGEN__)
#define port_switch(ntp, otp) { \
register Thread *_ntp asm ("r0") = (ntp); \
register Thread *_otp asm ("r1") = (otp); \
asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); \
}
#else /* CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(ntp, otp) { \
register Thread *_ntp asm ("r0") = (ntp); \
register Thread *_otp asm ("r1") = (otp); \
register struct intctx *r13 asm ("r13"); \
if ((void *)(r13 - 1) < (void *)(_otp + 1)) \
asm volatile ("movs r0, #0 \n\t" \
"b chDbgPanic"); \
asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); \
}
#endif /* CH_DBG_ENABLE_STACK_CHECK */
#ifdef __cplusplus
extern "C" {

View File

@ -59,6 +59,8 @@
*****************************************************************************
*** 2.0.5 ***
- FIX: Fixed broken CH_DBG_ENABLE_STACK_CHECK option in legacy CM3 port (bug
3064274).
- FIX: Fixed CAN_USE_SLEEP_MODE setting (bug 3064204).
*** 2.0.4 ***