mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-05-06 13:19:03 -04:00
This reverts commit 4162ca49d6
.
This commit is contained in:
parent
4162ca49d6
commit
e3a0e3e86a
|
@ -66,10 +66,8 @@
|
||||||
*/
|
*/
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
|
@ -80,33 +78,13 @@
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#else /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \
|
|
||||||
\
|
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
|
||||||
if( pxTCB->pxTopOfStack <= pxTCB->pxStack + portSTACK_LIMIT_PADDING ) \
|
|
||||||
{ \
|
|
||||||
char * pcOverflowTaskName = pxTCB->pcTaskName; \
|
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \
|
|
||||||
} \
|
|
||||||
} while( 0 )
|
|
||||||
|
|
||||||
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
|
@ -117,32 +95,12 @@
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#else /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \
|
|
||||||
\
|
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
|
||||||
if( pxTCB->pxTopOfStack >= pxTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
|
|
||||||
{ \
|
|
||||||
char * pcOverflowTaskName = pxTCB->pcTaskName; \
|
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \
|
|
||||||
} \
|
|
||||||
} while( 0 )
|
|
||||||
|
|
||||||
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
||||||
|
@ -159,36 +117,12 @@
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#else /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \
|
|
||||||
const uint32_t * const pulStack = ( uint32_t * ) pxTCB->pxStack; \
|
|
||||||
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
|
|
||||||
\
|
|
||||||
if( ( pxTCB->pxTopOfStack <= pxTCB->pxStack + portSTACK_LIMIT_PADDING ) || \
|
|
||||||
( pulStack[ 0 ] != ulCheckValue ) || \
|
|
||||||
( pulStack[ 1 ] != ulCheckValue ) || \
|
|
||||||
( pulStack[ 2 ] != ulCheckValue ) || \
|
|
||||||
( pulStack[ 3 ] != ulCheckValue ) ) \
|
|
||||||
{ \
|
|
||||||
char * pcOverflowTaskName = pxTCB->pcTaskName; \
|
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \
|
|
||||||
} \
|
|
||||||
} while( 0 )
|
|
||||||
|
|
||||||
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
||||||
|
@ -208,41 +142,12 @@
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#else /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \
|
|
||||||
int8_t * pcEndOfStack = ( int8_t * ) pxTCB->pxEndOfStack; \
|
|
||||||
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
|
||||||
\
|
|
||||||
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
|
||||||
\
|
|
||||||
if( ( pxTCB->pxTopOfStack >= pxTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
|
|
||||||
( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) ) \
|
|
||||||
{ \
|
|
||||||
char * pcOverflowTaskName = pxTCB->pcTaskName; \
|
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \
|
|
||||||
} \
|
|
||||||
} while( 0 )
|
|
||||||
|
|
||||||
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Remove stack overflow macro if not being used. */
|
/* Remove stack overflow macro if not being used. */
|
||||||
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
#define taskCHECK_FOR_STACK_OVERFLOW()
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW()
|
|
||||||
#else
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW( xCoreID )
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
2
tasks.c
2
tasks.c
|
@ -5251,7 +5251,7 @@ BaseType_t xTaskIncrementTick( void )
|
||||||
#endif /* configGENERATE_RUN_TIME_STATS */
|
#endif /* configGENERATE_RUN_TIME_STATS */
|
||||||
|
|
||||||
/* Check for stack overflow, if configured. */
|
/* Check for stack overflow, if configured. */
|
||||||
taskCHECK_FOR_STACK_OVERFLOW( xCoreID );
|
taskCHECK_FOR_STACK_OVERFLOW();
|
||||||
|
|
||||||
/* Before the currently running task is switched out, save its errno. */
|
/* Before the currently running task is switched out, save its errno. */
|
||||||
#if ( configUSE_POSIX_ERRNO == 1 )
|
#if ( configUSE_POSIX_ERRNO == 1 )
|
||||||
|
|
Loading…
Reference in a new issue