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
Bobby Bingham 2019-04-05 13:35:00 -05:00
parent b6a9b5e279
commit b9bd4045fb
2 changed files with 2 additions and 2 deletions

View File

@ -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];

View File

@ -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];