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.
This commit is contained in:
Ville Juven 2022-04-19 15:41:09 +03:00 committed by Petro Karashchenko
parent 8f8ee25a9c
commit 6546789b7e

View File

@ -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().
*/