diff --git a/BasiliskII/src/Unix/sigsegv.cpp b/BasiliskII/src/Unix/sigsegv.cpp index 0591e4dc..d093ce8d 100644 --- a/BasiliskII/src/Unix/sigsegv.cpp +++ b/BasiliskII/src/Unix/sigsegv.cpp @@ -244,7 +244,7 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) #define SIGSEGV_FAULT_INSTRUCTION (unsigned long)SIGSEGV_CONTEXT_REGS[CTX_EPC] #if (defined(mips) || defined(__mips)) -#define SIGSEGV_REGISTER_FILE SIGSEGV_CONTEXT_REGS +#define SIGSEGV_REGISTER_FILE &SIGSEGV_CONTEXT_REGS[CTX_EPC], &SIGSEGV_CONTEXT_REGS[CTX_R0] #define SIGSEGV_SKIP_INSTRUCTION mips_skip_instruction #endif #endif @@ -327,6 +327,13 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #define SIGSEGV_REGISTER_FILE (&SIGSEGV_CONTEXT_REGS.arm_r0) #define SIGSEGV_SKIP_INSTRUCTION arm_skip_instruction #endif +#if (defined(mips) || defined(__mips__)) +#include +#define SIGSEGV_CONTEXT_REGS (((struct ucontext *)scp)->uc_mcontext) +#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.pc) +#define SIGSEGV_REGISTER_FILE &SIGSEGV_CONTEXT_REGS.pc, &SIGSEGV_CONTEXT_REGS.gregs[0] +#define SIGSEGV_SKIP_INSTRUCTION mips_skip_instruction +#endif #endif #endif @@ -1144,14 +1151,9 @@ static bool powerpc_skip_instruction(unsigned long * nip_p, unsigned long * regs // Decode and skip MIPS instruction #if (defined(mips) || defined(__mips)) -enum { -#if (defined(sgi) || defined(__sgi)) - MIPS_REG_EPC = 35, -#endif -}; -static bool mips_skip_instruction(greg_t * regs) +static bool mips_skip_instruction(greg_t * pc_p, greg_t * regs) { - unsigned int * epc = (unsigned int *)(unsigned long)regs[MIPS_REG_EPC]; + unsigned int * epc = (unsigned int *)(unsigned long)*pc_p; if (epc == 0) return false; @@ -1300,7 +1302,7 @@ static bool mips_skip_instruction(greg_t * regs) mips_gpr_names[reg]); #endif - regs[MIPS_REG_EPC] += 4; + *pc_p += 4; return true; } #endif