anchao commented on a change in pull request #5761:
URL: https://github.com/apache/incubator-nuttx/pull/5761#discussion_r830033086



##########
File path: arch/arm/src/common/arm_vfork.c
##########
@@ -137,10 +137,19 @@ pid_t up_vfork(const struct vfork_s *context)
    * effort is overkill.
    */
 
-  newtop = STACK_ALIGN_DOWN((uint32_t)child->cmn.stack_base_ptr +
-                                      child->cmn.adj_stack_size -
-                                      XCPTCONTEXT_SIZE);
-  newsp = newtop - stackutil;
+  newsp = (uint32_t)child->cmn.stack_base_ptr +
+                    child->cmn.adj_stack_size - stackutil;
+
+  newtop = newsp - XCPTCONTEXT_SIZE;
+
+  /* Move the register context to newtop. */
+
+  memcpy((void *)newtop, child->cmn.stack_base_ptr +
+                         child->cmn.adj_stack_size -
+                         XCPTCONTEXT_SIZE, XCPTCONTEXT_SIZE);

Review comment:
       Done

##########
File path: arch/arm/src/common/arm_vfork.c
##########
@@ -137,10 +137,19 @@ pid_t up_vfork(const struct vfork_s *context)
    * effort is overkill.
    */
 
-  newtop = STACK_ALIGN_DOWN((uint32_t)child->cmn.stack_base_ptr +
-                                      child->cmn.adj_stack_size -
-                                      XCPTCONTEXT_SIZE);
-  newsp = newtop - stackutil;
+  newsp = (uint32_t)child->cmn.stack_base_ptr +
+                    child->cmn.adj_stack_size - stackutil;
+
+  newtop = newsp - XCPTCONTEXT_SIZE;

Review comment:
       Done




-- 
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-unsubscr...@nuttx.apache.org

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


Reply via email to