diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-08-08 10:01:14 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-08-08 10:01:14 +0000 |
commit | 26eabc0db1e61d941bd60193c4c3705b8ff383c4 (patch) | |
tree | 05e72d27704a0b7de9341f3c5d088e2b19d60688 /os/ports/GCC/ARM/chcore.h | |
parent | cb54f8224b4ed312512149a2fa9272674e3fb1a5 (diff) | |
download | ChibiOS-26eabc0db1e61d941bd60193c4c3705b8ff383c4.tar.gz ChibiOS-26eabc0db1e61d941bd60193c4c3705b8ff383c4.tar.bz2 ChibiOS-26eabc0db1e61d941bd60193c4c3705b8ff383c4.zip |
Centralyzed ARM scatter files too, new stack checking implemented in ARM port.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3210 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/GCC/ARM/chcore.h')
-rw-r--r-- | os/ports/GCC/ARM/chcore.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/os/ports/GCC/ARM/chcore.h b/os/ports/GCC/ARM/chcore.h index 20727ce23..c2d2892cd 100644 --- a/os/ports/GCC/ARM/chcore.h +++ b/os/ports/GCC/ARM/chcore.h @@ -438,14 +438,10 @@ struct context { #ifdef THUMB
#if CH_DBG_ENABLE_STACK_CHECK
#define port_switch(ntp, otp) { \
- register Thread *_ntp asm ("r0") = (ntp); \
- register Thread *_otp asm ("r1") = (otp); \
- register char *sp asm ("sp"); \
- if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) \
- asm volatile ("mov r0, #0 \n\t" \
- "ldr r1, =chDbgPanic \n\t" \
- "bx r1"); \
- _port_switch_thumb(_ntp, _otp); \
+ register struct intctx *r13 asm ("r13"); \
+ if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
+ chDbgPanic("stack overflow"); \
+ _port_switch_thumb(ntp, otp); \
}
#else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(ntp, otp) _port_switch_thumb(ntp, otp)
@@ -453,13 +449,10 @@ struct context { #else /* !THUMB */
#if CH_DBG_ENABLE_STACK_CHECK
#define port_switch(ntp, otp) { \
- register Thread *_ntp asm ("r0") = (ntp); \
- register Thread *_otp asm ("r1") = (otp); \
- register char *sp asm ("sp"); \
- if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) \
- asm volatile ("mov r0, #0 \n\t" \
- "b chDbgPanic"); \
- _port_switch_arm(_ntp, _otp); \
+ register struct intctx *r13 asm ("r13"); \
+ if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
+ chDbgPanic("stack overflow"); \
+ _port_switch_arm(ntp, otp); \
}
#else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(ntp, otp) _port_switch_arm(ntp, otp)
|