diff --git a/arch/ppc/makecontext.c b/arch/ppc/makecontext.c index 729f465..2b7ea67 100644 --- a/arch/ppc/makecontext.c +++ b/arch/ppc/makecontext.c @@ -30,13 +30,12 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) greg_t *sp, *argp; va_list va; int i; - unsigned int uc_link, stack_args; + unsigned int stack_args; stack_args = argc > 8 ? argc - 8 : 0; - uc_link = stack_args + 1; sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); - sp -= (uc_link + 1); + sp -= stack_args + 2; sp = (greg_t *) ((uintptr_t) sp & -16L); ucp->uc_mcontext.gregs[REG_NIP] = (uintptr_t) func; @@ -45,7 +44,6 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) ucp->uc_mcontext.gregs[REG_SP] = (uintptr_t) sp; sp[0] = 0; - sp[uc_link] = (uintptr_t) ucp->uc_link; argp = &sp[2]; va_start(va, argc); diff --git a/arch/ppc64/makecontext.c b/arch/ppc64/makecontext.c index 91fb579..b060371 100644 --- a/arch/ppc64/makecontext.c +++ b/arch/ppc64/makecontext.c @@ -30,13 +30,12 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) greg_t *sp, *argp; va_list va; int i; - unsigned int uc_link, stack_args; + unsigned int stack_args; stack_args = argc > 8 ? argc - 8 : 0; - uc_link = stack_args + 1; sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); - sp -= (uc_link + 1); + sp -= stack_args + 2; sp = (greg_t *) (((uintptr_t) sp & -16L)); ucp->uc_mcontext.gp_regs[REG_NIP] = (uintptr_t) func; @@ -46,7 +45,6 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) ucp->uc_mcontext.gp_regs[REG_R31] = (uintptr_t) ucp->uc_link; sp[0] = 0; - sp[uc_link] = (uintptr_t) ucp->uc_link; argp = &sp[2]; va_start(va, argc);