arm/vfork: update the SP to stack top

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-03-18 21:54:01 +08:00 committed by Masayuki Ishikawa
parent 9ae0dcd4a2
commit a770ff2017

View File

@ -137,10 +137,18 @@ pid_t up_vfork(const struct vfork_s *context)
* effort is overkill. * effort is overkill.
*/ */
newtop = STACK_ALIGN_DOWN((uint32_t)child->cmn.stack_base_ptr + newtop = (uint32_t)child->cmn.stack_base_ptr +
child->cmn.adj_stack_size - child->cmn.adj_stack_size;
XCPTCONTEXT_SIZE);
newsp = newtop - stackutil; newsp = newtop - stackutil;
/* Move the register context to newtop. */
memcpy((void *)(newsp - XCPTCONTEXT_SIZE),
child->cmn.xcp.regs, XCPTCONTEXT_SIZE);
child->cmn.xcp.regs = (void *)(newsp - XCPTCONTEXT_SIZE);
memcpy((void *)newsp, (const void *)context->sp, stackutil); memcpy((void *)newsp, (const void *)context->sp, stackutil);
/* Was there a frame pointer in place before? */ /* Was there a frame pointer in place before? */