diff --git a/arch/sim/src/sim/up_vfork.c b/arch/sim/src/sim/up_vfork.c index 7560be60c79..af8820716ae 100644 --- a/arch/sim/src/sim/up_vfork.c +++ b/arch/sim/src/sim/up_vfork.c @@ -89,6 +89,8 @@ pid_t up_vfork(const xcpt_reg_t *context) { struct tcb_s *parent = this_task(); struct task_tcb_s *child; + unsigned char *pout; + unsigned char *pin; xcpt_reg_t newsp; xcpt_reg_t newfp; xcpt_reg_t newtop; @@ -133,7 +135,9 @@ pid_t up_vfork(const xcpt_reg_t *context) newtop = (xcpt_reg_t)child->cmn.stack_base_ptr + child->cmn.adj_stack_size; newsp = newtop - stackutil; - memcpy((void *)newsp, (const void *)context[JB_SP], stackutil); + pout = (unsigned char *)newsp; + pin = (unsigned char *)context[JB_SP]; + while (stackutil-- > 0) *pout++ = *pin++; /* Was there a frame pointer in place before? */