From 2bdb300da1e34184c6853ed3163197ef4de86975 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sun, 20 Jan 2008 00:39:51 +0000 Subject: [PATCH] HPPA support. --- BasiliskII/src/Unix/sigsegv.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/BasiliskII/src/Unix/sigsegv.cpp b/BasiliskII/src/Unix/sigsegv.cpp index 6786a8e1..24f63a7d 100644 --- a/BasiliskII/src/Unix/sigsegv.cpp +++ b/BasiliskII/src/Unix/sigsegv.cpp @@ -243,6 +243,8 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int // Generic extended signal handler #if defined(__FreeBSD__) #define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGBUS) +#elif defined(__hpux) +#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) FAULT_HANDLER(SIGBUS) #else #define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) #endif @@ -350,6 +352,18 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #endif #endif #if (defined(__hpux) || defined(__hpux__)) +#if (defined(__hppa) || defined(__hppa__)) +#define SIGSEGV_CONTEXT_REGS (&((ucontext_t *)scp)->uc_mcontext) +#define SIGSEGV_FAULT_INSTRUCTION_32 (SIGSEGV_CONTEXT_REGS->ss_narrow.ss_pcoq_head & ~3ul) +#define SIGSEGV_FAULT_INSTRUCTION_64 (SIGSEGV_CONTEXT_REGS->ss_wide.ss_64.ss_pcoq_head & ~3ull) +#if defined(__LP64__) +#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_FAULT_INSTRUCTION_64 +#else +#define SIGSEGV_FAULT_INSTRUCTION ((SIGSEGV_CONTEXT_REGS->ss_flags & SS_WIDEREGS) ? \ + (uint32_t)SIGSEGV_FAULT_INSTRUCTION_64 : \ + SIGSEGV_FAULT_INSTRUCTION_32) +#endif +#endif #if (defined(__ia64) || defined(__ia64__)) #include #define SIGSEGV_CONTEXT_REGS ((ucontext_t *)scp) @@ -358,7 +372,7 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #define SIGSEGV_SKIP_INSTRUCTION ia64_skip_instruction #include -static sigsegv_address_t get_fault_instruction(const ucontext_t *ucp) +static inline sigsegv_address_t get_fault_instruction(const ucontext_t *ucp) { uint64_t ip; if (__uc_get_ip(ucp, &ip) != 0)