aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-21 11:14:24 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-21 11:14:24 +0000
commit73a6c86af1bb7f4c16f5aaf8d170176adc609fc8 (patch)
tree8ed5b49743dccecded1d0abb2fea4a9fb4444a22 /ports
parent3139ee3c532881a23fb5d4171cdc7120f4f1f869 (diff)
downloadChibiOS-73a6c86af1bb7f4c16f5aaf8d170176adc609fc8.tar.gz
ChibiOS-73a6c86af1bb7f4c16f5aaf8d170176adc609fc8.tar.bz2
ChibiOS-73a6c86af1bb7f4c16f5aaf8d170176adc609fc8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@798 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r--ports/ARM7/chcore.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/ports/ARM7/chcore.h b/ports/ARM7/chcore.h
index e2c6481b5..5cc6fc276 100644
--- a/ports/ARM7/chcore.h
+++ b/ports/ARM7/chcore.h
@@ -277,9 +277,34 @@ struct context {
* @param ntp the thread to be switched in
*/
#ifdef THUMB
+#if CH_DBG_ENABLE_STACK_CHECK
+#define port_switch(otp, ntp) { \
+ register Thread *_otp asm ("r0") = (otp); \
+ register Thread *_ntp asm ("r1") = (ntp); \
+ 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(_otp, _ntp); \
+}
+#else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(otp, ntp) _port_switch_thumb(otp, ntp)
+#endif /* !CH_DBG_ENABLE_STACK_CHECK */
#else /* !THUMB */
+#if CH_DBG_ENABLE_STACK_CHECK
+#define port_switch(otp, ntp) { \
+ register Thread *_otp asm ("r0") = (otp); \
+ register Thread *_ntp asm ("r1") = (ntp); \
+ 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(_otp, _ntp); \
+}
+#else /* !CH_DBG_ENABLE_STACK_CHECK */
#define port_switch(otp, ntp) _port_switch_arm(otp, ntp)
+#endif /* !CH_DBG_ENABLE_STACK_CHECK */
#endif /* !THUMB */
#ifdef __cplusplus