From e4deeada850d2202823058bccdda4a79091db3b3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Sep 2014 10:59:15 -0600 Subject: [PATCH] More vfork(): If we get to vfork() via system call, then we need to clone some system call information so that the return form the cloned system call works correctly --- arch/arm/src/common/up_vfork.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/src/common/up_vfork.c b/arch/arm/src/common/up_vfork.c index b578bd027f..a11c3b94f4 100644 --- a/arch/arm/src/common/up_vfork.c +++ b/arch/arm/src/common/up_vfork.c @@ -227,6 +227,26 @@ pid_t up_vfork(const struct vfork_s *context) child->cmn.xcp.regs[REG_FP] = newfp; /* Frame pointer */ child->cmn.xcp.regs[REG_SP] = newsp; /* Stack pointer */ +#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; + child->cmn.xcp.syscall[index].excreturn = + parent->xcp.syscall[index].excreturn; + } + + child->cmn.xcp.nsyscalls = parent->xcp.nsyscalls; + } +#endif + /* And, finally, start the child task. On a failure, task_vforkstart() * will discard the TCB by calling task_vforkabort(). */