ppc32/64: don't store uc_link on the stack
This was previously stored either in the CR (ppc64) or LR (ppc32) save area of the stack, or to one of the parameter save slots. In either case, the saved value was unused. This value is also passed to __start_context via r31, so there's no need to pass it on the stack.pull/11/head
parent
b9bd4045fb
commit
b500b054c7
|
@ -30,13 +30,12 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
greg_t *sp, *argp;
|
greg_t *sp, *argp;
|
||||||
va_list va;
|
va_list va;
|
||||||
int i;
|
int i;
|
||||||
unsigned int uc_link, stack_args;
|
unsigned int stack_args;
|
||||||
|
|
||||||
stack_args = argc > 8 ? argc - 8 : 0;
|
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 = (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);
|
sp = (greg_t *) ((uintptr_t) sp & -16L);
|
||||||
|
|
||||||
ucp->uc_mcontext.gregs[REG_NIP] = (uintptr_t) func;
|
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;
|
ucp->uc_mcontext.gregs[REG_SP] = (uintptr_t) sp;
|
||||||
|
|
||||||
sp[0] = 0;
|
sp[0] = 0;
|
||||||
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
|
||||||
argp = &sp[2];
|
argp = &sp[2];
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
|
@ -30,13 +30,12 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
greg_t *sp, *argp;
|
greg_t *sp, *argp;
|
||||||
va_list va;
|
va_list va;
|
||||||
int i;
|
int i;
|
||||||
unsigned int uc_link, stack_args;
|
unsigned int stack_args;
|
||||||
|
|
||||||
stack_args = argc > 8 ? argc - 8 : 0;
|
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 = (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));
|
sp = (greg_t *) (((uintptr_t) sp & -16L));
|
||||||
|
|
||||||
ucp->uc_mcontext.gp_regs[REG_NIP] = (uintptr_t) func;
|
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;
|
ucp->uc_mcontext.gp_regs[REG_R31] = (uintptr_t) ucp->uc_link;
|
||||||
|
|
||||||
sp[0] = 0;
|
sp[0] = 0;
|
||||||
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
|
||||||
argp = &sp[2];
|
argp = &sp[2];
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
Loading…
Reference in New Issue