forked from ariadne/libucontext
ppc32/64: fix back chain pointer
The ABI states that sp[0] should point to the previous stack frame, or be zero if there is no previous stack frame. makecontext previously set this slot to point to the __start_context function, rather than to a valid stack frame.arm_linker_fix
parent
b6a9b5e279
commit
b9bd4045fb
|
@ -44,7 +44,7 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.gregs[REG_R31] = (uintptr_t) ucp->uc_link;
|
ucp->uc_mcontext.gregs[REG_R31] = (uintptr_t) ucp->uc_link;
|
||||||
ucp->uc_mcontext.gregs[REG_SP] = (uintptr_t) sp;
|
ucp->uc_mcontext.gregs[REG_SP] = (uintptr_t) sp;
|
||||||
|
|
||||||
sp[0] = (uintptr_t) &__start_context;
|
sp[0] = 0;
|
||||||
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
||||||
argp = &sp[2];
|
argp = &sp[2];
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.gp_regs[REG_ENTRY] = (uintptr_t) func;
|
ucp->uc_mcontext.gp_regs[REG_ENTRY] = (uintptr_t) func;
|
||||||
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] = (uintptr_t) &__start_context;
|
sp[0] = 0;
|
||||||
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
||||||
argp = &sp[2];
|
argp = &sp[2];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue