Remove pxCurrentTCB define in SMP

This commit is contained in:
Ching-Hsin,Lee 2024-05-20 18:13:17 +08:00
parent 1c9130fbfa
commit 8200e590f1
2 changed files with 38 additions and 34 deletions

View file

@ -58,11 +58,13 @@
/* Only the current stack state is to be checked. */
#define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe(); \
\
/* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
if( pxConstCurrentTCB->pxTopOfStack <= pxConstCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
{ \
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
char * pcOverflowTaskName = pxConstCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxConstCurrentTCB, pcOverflowTaskName ); \
} \
} while( 0 )
@ -74,12 +76,13 @@
/* Only the current stack state is to be checked. */
#define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe(); \
\
/* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
if( pxConstCurrentTCB->pxTopOfStack >= pxConstCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
{ \
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
char * pcOverflowTaskName = pxConstCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxConstCurrentTCB, pcOverflowTaskName ); \
} \
} while( 0 )
@ -90,7 +93,8 @@
#define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe(); \
const uint32_t * const pulStack = ( uint32_t * ) pxConstCurrentTCB->pxStack; \
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
\
if( ( pulStack[ 0 ] != ulCheckValue ) || \
@ -98,8 +102,8 @@
( pulStack[ 2 ] != ulCheckValue ) || \
( pulStack[ 3 ] != ulCheckValue ) ) \
{ \
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
char * pcOverflowTaskName = pxConstCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxConstCurrentTCB, pcOverflowTaskName ); \
} \
} while( 0 )
@ -110,7 +114,8 @@
#define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe(); \
int8_t * pcEndOfStack = ( int8_t * ) pxConstCurrentTCB->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, \
@ -123,8 +128,8 @@
/* Has the extremity of the task stack ever been written over? */ \
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
{ \
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
char * pcOverflowTaskName = pxConstCurrentTCB->pcTaskName; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxConstCurrentTCB, pcOverflowTaskName ); \
} \
} while( 0 )

View file

@ -463,7 +463,6 @@ typedef tskTCB TCB_t;
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-84 */
/* coverity[misra_c_2012_rule_8_4_violation] */
portDONT_DISCARD PRIVILEGED_DATA TCB_t * volatile pxCurrentTCBs[ configNUMBER_OF_CORES ];
#define pxCurrentTCB prvGetCurrentTaskTCBUnsafe()
#endif
/* Lists for ready and blocked tasks. --------------------