Added stack checking to the Cortex-Mx RVCT port.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.2.x@2836 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2011-03-19 18:22:19 +00:00
parent ab96cc78df
commit 2f1519d343
3 changed files with 20 additions and 1 deletions

View File

@ -214,7 +214,16 @@ struct intctx {
* @param[in] ntp the thread to be switched in * @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out * @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) #define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
struct intctx *r13 = (struct intctx *)__current_sp(); \
if ((void *)(r13 - 1) < (void *)(otp + 1)) \
chDbgPanic("stack overflow"); \
_port_switch(ntp, otp); \
}
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -240,7 +240,16 @@ struct intctx {
* @param[in] ntp the thread to be switched in * @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out * @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) #define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
struct intctx *r13 = (struct intctx *)__current_sp(); \
if ((void *)(r13 - 1) < (void *)(otp + 1)) \
chDbgPanic("stack overflow"); \
_port_switch(ntp, otp); \
}
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -75,6 +75,7 @@
- FIX: Fixed wrong checks in PAL driver (bug 3224681). - FIX: Fixed wrong checks in PAL driver (bug 3224681).
- FIX: Fixed wrong checks in I/O Queues (bug 3219197). - FIX: Fixed wrong checks in I/O Queues (bug 3219197).
- FIX: Fixed invalid assertion in adcConvert() (bug 3205410). - FIX: Fixed invalid assertion in adcConvert() (bug 3205410).
- NEW: Implemented stack checking in the Cortex-Mx RVCT port.
- NEW: Improved preemption implementation for the Cortex-M0, now it uses - NEW: Improved preemption implementation for the Cortex-M0, now it uses
the NMI vector in order to restore the original context. The change makes the NMI vector in order to restore the original context. The change makes
IRQ handling faster and also saves some RAM/ROM space. The GCC port code IRQ handling faster and also saves some RAM/ROM space. The GCC port code