ppc64: fix incorrect position of parameters within stack frame

On PPC64, there are 4 register-sized stack slots below the parameter save
area, which is different from the 2 stack slots on PPC32.
pull/11/head
Bobby Bingham 2019-04-05 14:03:47 -05:00
parent 8ea5f548b9
commit a00a05ce29
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
stack_args = argc > 8 ? argc : 0;
sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
sp -= stack_args + 2;
sp -= stack_args + 4;
sp = (greg_t *) (((uintptr_t) sp & -16L));
ucp->uc_mcontext.gp_regs[REG_NIP] = (uintptr_t) func;
@ -52,7 +52,7 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
if (i < 8)
ucp->uc_mcontext.gp_regs[i + 3] = va_arg (va, greg_t);
else
sp[i + 2] = va_arg (va, greg_t);
sp[i + 4] = va_arg (va, greg_t);
}
va_end(va);