user-exec.c: fix build on NetBSD/sparc64 and NetBSD/arm

A couple of #ifdef changes necessary to use NetBSD's ucontext
structs on sparc64 and arm.

Signed-off-by: Tobias Nygren <tnn@NetBSD.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1425591461-17550-1-git-send-email-tnn@NetBSD.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Tobias Nygren 2015-03-05 22:37:41 +01:00 committed by Peter Maydell
parent dea4635998
commit 7ccfb495c6
1 changed files with 15 additions and 1 deletions

View File

@ -404,6 +404,10 @@ int cpu_signal_handler(int host_signum, void *pinfo,
struct sigcontext *uc = puc; struct sigcontext *uc = puc;
unsigned long pc = uc->sc_pc; unsigned long pc = uc->sc_pc;
void *sigmask = (void *)(long)uc->sc_mask; void *sigmask = (void *)(long)uc->sc_mask;
#elif defined(__NetBSD__)
ucontext_t *uc = puc;
unsigned long pc = _UC_MACHINE_PC(uc);
void *sigmask = (void *)&uc->uc_sigmask;
#endif #endif
#endif #endif
@ -441,15 +445,25 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#elif defined(__arm__) #elif defined(__arm__)
#if defined(__NetBSD__)
#include <ucontext.h>
#endif
int cpu_signal_handler(int host_signum, void *pinfo, int cpu_signal_handler(int host_signum, void *pinfo,
void *puc) void *puc)
{ {
siginfo_t *info = pinfo; siginfo_t *info = pinfo;
#if defined(__NetBSD__)
ucontext_t *uc = puc;
#else
struct ucontext *uc = puc; struct ucontext *uc = puc;
#endif
unsigned long pc; unsigned long pc;
int is_write; int is_write;
#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) #if defined(__NetBSD__)
pc = uc->uc_mcontext.__gregs[_REG_R15];
#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
pc = uc->uc_mcontext.gregs[R15]; pc = uc->uc_mcontext.gregs[R15];
#else #else
pc = uc->uc_mcontext.arm_pc; pc = uc->uc_mcontext.arm_pc;