diff --git a/arch/sh/defs.h b/arch/sh/defs.h index 0367560..2090e87 100644 --- a/arch/sh/defs.h +++ b/arch/sh/defs.h @@ -4,6 +4,7 @@ #define REG_SZ (4) #define MCONTEXT_GREGS (24) +#define REG_SP (15) #define REG_PC (16) #define REG_PR (17) #define REG_SR (18) diff --git a/arch/sh/makecontext.c b/arch/sh/makecontext.c index dafc1f9..76a0dfd 100644 --- a/arch/sh/makecontext.c +++ b/arch/sh/makecontext.c @@ -34,7 +34,7 @@ libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int arg sp -= argc > 4 ? argc - 4 : 0; /* set up the context */ - ucp->uc_mcontext.sr = (libucontext_greg_t) sp; + ucp->uc_mcontext.gregs[REG_SP] = (libucontext_greg_t) sp; ucp->uc_mcontext.pr = (libucontext_greg_t) libucontext_trampoline; ucp->uc_mcontext.pc = (libucontext_greg_t) func; ucp->uc_mcontext.gregs[8] = (libucontext_greg_t) ucp->uc_link;