casaroli commented on code in PR #19562:
URL: https://github.com/apache/nuttx/pull/19562#discussion_r3743826715
##########
arch/arm/src/common/gnu/fork.S:
##########
@@ -88,6 +86,7 @@
up_fork:
/* Create a stack frame */
+ mov r2, r0 /* Preserve the vfork flag */
Review Comment:
done
##########
arch/x86_64/src/common/fork.S:
##########
@@ -91,14 +88,19 @@
* | [r15] | i
* | [r14] | n
* | [r13] | g
- * | [r12] | <- rsp before calling x86_64_fork, rdi = rsp
+ * | [r12] | <- rsp before calling x86_64_fork, rsi = rsp
* | ......... |
*/
.globl up_fork
.type up_fork, @function
up_fork:
+ /* %rdx is call-clobbered and is not part of the snapshot, so it carries
+ * the vfork flag across the sequence below, which clobbers %rdi.
+ */
+
+ movq %rdi, %rdx
Review Comment:
done
##########
arch/risc-v/src/common/fork.S:
##########
@@ -94,12 +84,15 @@
up_fork:
#ifdef CONFIG_LIB_SYSCALL
- /* When coming via system call, everything is in place already */
+ /* When coming via system call, everything is in place already: a0 already
+ * holds the vfork flag, and riscv_fork() takes its snapshot from the TCB.
+ */
tail riscv_fork
#else
/* Create a stack frame */
+ mv a2, a0 /* Preserve the vfork flag */
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]