You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/04/25 13:23:23 UTC
[incubator-nuttx] branch master updated: RISC-V: Add syscall support for vfork
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 6546789b7e RISC-V: Add syscall support for vfork
6546789b7e is described below
commit 6546789b7e6e191ce2650c6f0a91c6645e14c837
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Tue Apr 19 15:41:09 2022 +0300
RISC-V: Add syscall support for vfork
If vfork is called via syscall (PROTECTED/KERNEL build) need to set up
return parameters for syscall. Otherwise the SW will get lost.
---
arch/risc-v/src/common/riscv_vfork.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/risc-v/src/common/riscv_vfork.c b/arch/risc-v/src/common/riscv_vfork.c
index 0e2c3ebc82..7403b94670 100644
--- a/arch/risc-v/src/common/riscv_vfork.c
+++ b/arch/risc-v/src/common/riscv_vfork.c
@@ -224,6 +224,29 @@ pid_t up_vfork(const struct vfork_s *context)
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
#endif
+#ifdef CONFIG_LIB_SYSCALL
+ /* If we got here via a syscall, then we are going to have to setup some
+ * syscall return information as well.
+ */
+
+ if (parent->xcp.nsyscalls > 0)
+ {
+ int index;
+ for (index = 0; index < parent->xcp.nsyscalls; index++)
+ {
+ child->cmn.xcp.syscall[index].sysreturn =
+ parent->xcp.syscall[index].sysreturn;
+
+#ifndef CONFIG_BUILD_FLAT
+ child->cmn.xcp.syscall[index].int_ctx =
+ parent->xcp.syscall[index].int_ctx;
+#endif
+ }
+
+ child->cmn.xcp.nsyscalls = parent->xcp.nsyscalls;
+ }
+#endif /* CONFIG_LIB_SYSCALL */
+
/* And, finally, start the child task. On a failure, nxtask_start_vfork()
* will discard the TCB by calling nxtask_abort_vfork().
*/