xiaoxiang781216 commented on code in PR #19562:
URL: https://github.com/apache/nuttx/pull/19562#discussion_r3743967302
##########
arch/arm/src/common/gnu/fork.S:
##########
@@ -102,19 +100,21 @@ up_fork:
mov r7, r11
stmia r1!, {r4-r7} /* Save r8-r11 in the structure
*/
mov r5, lr /* Copy lr to a low register */
- stmia r1!, {r0,r5} /* Save sp and lr in the
structure */
+ stmia r1!, {r3,r5} /* Save sp and lr in the
structure */
- /* Then, call arm_fork(), passing it a pointer to the stack structure */
+ /* Then, call arm_fork(). r0 still holds the vfork flag: nothing above
+ * touches it.
+ */
- mov r0, sp
+ mov r1, sp
Review Comment:
remove since r1 already equals sp
##########
arch/sim/src/sim/sim_fork_arm.S:
##########
@@ -86,18 +86,27 @@
************************************************************************************/
.text
+
.globl up_fork
.type up_fork, @function
up_fork:
+ push {r4, lr}
Review Comment:
remove extra spaces before {r4, lr}
##########
arch/arm64/src/common/arm64_fork.c:
##########
Review Comment:
why not check `(child->stack_base_ptr == parent->stack_base_ptr)` like arm
##########
arch/sim/src/sim/sim_fork_x86.S:
##########
@@ -94,21 +94,34 @@
************************************************************************************/
.text
+
.globl SYMBOL(up_fork)
#ifdef __ELF__
.type SYMBOL(up_fork), @function
#endif
SYMBOL(up_fork):
+ push %ebx /* Callee-saved: carries the vfork flag
+ * across setjmp() */
Review Comment:
ditto
##########
sched/sched/sched.h:
##########
@@ -127,6 +127,20 @@
* is used to map a task_state enumeration to the corresponding task list.
*/
+/* The rendezvous between a suspended vfork() parent and its child. This
+ * lives in the frame of nxtask_start_fork() on the parent's stack: the
+ * parent is blocked in that frame for the whole lifetime of the child, so
+ * the storage is alive exactly as long as it is needed, and no allocation
+ * is required on a path that must not fail.
+ */
+
+#ifdef CONFIG_ARCH_HAVE_VFORK
+struct vfork_s
+{
+ sem_t sem; /* Posted when the child is done */
Review Comment:
wy not use sem_t directly and remove vfork_s
##########
arch/sim/src/sim/sim_fork_arm.S:
##########
@@ -86,18 +86,27 @@
************************************************************************************/
.text
+
.globl up_fork
.type up_fork, @function
up_fork:
+ push {r4, lr}
+ mov r4, r0 /* Callee-saved: carries the vfork flag
+ * across setjmp() */
Review Comment:
merge to previous line
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]