diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-01-15 10:14:20 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-01-15 10:14:20 +0000 |
commit | 6e11b18986d202f8a2e44cead0c37a2145360337 (patch) | |
tree | 049911c9b2aba94fc8ac4ed0d98185ecdc2a32aa /os/ports/IAR/ARMCMx/chcore_v7m.h | |
parent | 7474bb1c105be4221812eb272e2a8764ae74bee7 (diff) | |
download | ChibiOS-6e11b18986d202f8a2e44cead0c37a2145360337.tar.gz ChibiOS-6e11b18986d202f8a2e44cead0c37a2145360337.tar.bz2 ChibiOS-6e11b18986d202f8a2e44cead0c37a2145360337.zip |
Fixed bug 3158776.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2643 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/IAR/ARMCMx/chcore_v7m.h')
-rw-r--r-- | os/ports/IAR/ARMCMx/chcore_v7m.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/os/ports/IAR/ARMCMx/chcore_v7m.h b/os/ports/IAR/ARMCMx/chcore_v7m.h index ba0c83f5a..ad4abf25b 100644 --- a/os/ports/IAR/ARMCMx/chcore_v7m.h +++ b/os/ports/IAR/ARMCMx/chcore_v7m.h @@ -225,7 +225,15 @@ struct intctx { * @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out
*/
+#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define port_switch(ntp, otp) _port_switch(ntp, otp)
+#else
+#define port_switch(ntp, otp) { \
+ if ((void *)(__get_SP() - sizeof(struct intctx)) < (void *)(otp + 1)) \
+ chDbgPanic("stack overflow"); \
+ _port_switch(ntp, otp); \
+}
+#endif
#ifdef __cplusplus
extern "C" {
|