Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChien Wong <13152803+ivq@users.noreply.github.com>2023-08-17 07:53:10 +0300
committerGitHub <noreply@github.com>2023-08-17 07:53:10 +0300
commitb1a85116bdbc22063f9ca0df9eadc95e17f221af (patch)
tree054767ee2f419c1adc35118ebf3fdbc9950ac74f /tasks.c
parentbd720c316a39cba26ef7e619a70f87f9017224df (diff)
Add missing stack alignment adjustment if stack grows upwards (#751)
Signed-off-by: Chien Wong <m@xv97.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Diffstat (limited to 'tasks.c')
-rw-r--r--tasks.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tasks.c b/tasks.c
index f9bb48930..3a278424e 100644
--- a/tasks.c
+++ b/tasks.c
@@ -1532,9 +1532,10 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
#else /* portSTACK_GROWTH */
{
pxTopOfStack = pxNewTCB->pxStack;
+ pxTopOfStack = ( StackType_t * ) ( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) + portBYTE_ALIGNMENT_MASK ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 !e9033 !e9078 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. Checked by assert(). */
- /* Check the alignment of the stack buffer is correct. */
- configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxNewTCB->pxStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
+ /* Check the alignment of the calculated top of stack is correct. */
+ configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
/* The other extreme of the stack space is required if stack checking is
* performed. */