You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/22 05:30:35 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5507: arch: Align the implementation of stack related functions

xiaoxiang781216 commented on a change in pull request #5507:
URL: https://github.com/apache/incubator-nuttx/pull/5507#discussion_r811589126



##########
File path: arch/arm/src/common/arm_createstack.c
##########
@@ -163,21 +161,31 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 
   if (tcb->stack_alloc_ptr)
     {
+      uintptr_t top_of_stack;
+      size_t size_of_stack;
+
       /* The ARM uses a "full descending" stack:
        * the stack grows toward lower addresses in memory.
        * The stack pointer register points to the last pushed item in
        * the stack.
        * Items on the stack are referenced as positive word offsets from sp.
        */
 
+      top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size;
+
       /* Since both stack_alloc_ptr and stack_size are in
        * STACK_ALIGNMENT, and the stack ptr is decremented before

Review comment:
       Yes, arm stack is grow toward lower address, we just need align the top of stack.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org