From 7a55962329c3bdc9306d2e4b3cd0c638ac4ff19c Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 25 Jun 2005 08:28:34 +0000 Subject: [PATCH] the exception numbers are MI. --- sys/compat/mach/mach_exception.c | 17 +++++++++-------- sys/compat/mach/mach_exception.h | 14 +++++++++++++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/sys/compat/mach/mach_exception.c b/sys/compat/mach/mach_exception.c index 81461ff04230..de662e167eca 100644 --- a/sys/compat/mach/mach_exception.c +++ b/sys/compat/mach/mach_exception.c @@ -1,4 +1,4 @@ -/* $NetBSD: mach_exception.c,v 1.5 2005/02/26 23:10:19 perry Exp $ */ +/* $NetBSD: mach_exception.c,v 1.6 2005/06/25 08:28:34 christos Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mach_exception.c,v 1.5 2005/02/26 23:10:19 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mach_exception.c,v 1.6 2005/06/25 08:28:34 christos Exp $"); #include "opt_ktrace.h" #include "opt_compat_darwin.h" @@ -414,12 +414,12 @@ mach_siginfo_to_exception(ksi, code) const struct ksiginfo *ksi; int *code; { + code[1] = (long)ksi->ksi_addr; switch (ksi->ksi_signo) { case SIGBUS: switch (ksi->ksi_code) { case BUS_ADRALN: code[0] = MACH_BUS_ADRALN; - code[1] = (long)ksi->ksi_addr; break; default: printf("untranslated siginfo signo %d, code %d\n", @@ -432,7 +432,9 @@ mach_siginfo_to_exception(ksi, code) switch (ksi->ksi_code) { case SEGV_MAPERR: code[0] = MACH_SEGV_MAPERR; - code[1] = (long)ksi->ksi_addr; + break; + case SEGV_ACCERR: + code[0] = MACH_SEGV_ACCERR; break; default: printf("untranslated siginfo signo %d, code %d\n", @@ -459,14 +461,14 @@ mach_siginfo_to_exception(ksi, code) case ILL_ILLOPC: case ILL_ILLOPN: case ILL_ILLADR: - case ILL_ILLTRP: code[0] = MACH_ILL_ILLOPC; - code[1] = (long)ksi->ksi_addr; break; case ILL_PRVOPC: case ILL_PRVREG: code[0] = MACH_ILL_PRVOPC; - code[1] = (long)ksi->ksi_addr; + break; + case ILL_ILLTRP: + code[0] = MACH_ILL_ILLTRP; break; default: printf("untranslated siginfo signo %d, code %d\n", @@ -480,7 +482,6 @@ mach_siginfo_to_exception(ksi, code) ksi->ksi_signo, ksi->ksi_code); break; } - return; } int diff --git a/sys/compat/mach/mach_exception.h b/sys/compat/mach/mach_exception.h index f0b6871c97cc..4224ce96aba8 100644 --- a/sys/compat/mach/mach_exception.h +++ b/sys/compat/mach/mach_exception.h @@ -1,4 +1,4 @@ -/* $NetBSD: mach_exception.h,v 1.4 2005/02/26 23:10:19 perry Exp $ */ +/* $NetBSD: mach_exception.h,v 1.5 2005/06/25 08:28:34 christos Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -39,6 +39,18 @@ #ifndef _MACH_EXCEPTION_H_ #define _MACH_EXCEPTION_H_ +/* really should be in mach_signal.h or siginfo.h */ +#define MACH_BUS_ADRALN 1 + +#define MACH_SEGV_MAPERR 1 +#define MACH_SEGV_ACCERR 2 + +#define MACH_TRAP_BRKPT 1 + +#define MACH_ILL_ILLOPC 1 +#define MACH_ILL_ILLTRP 2 +#define MACH_ILL_PRVOPC 3 + #define MACH_EXC_BAD_ACCESS 1 #define MACH_EXC_BAD_INSTRUCTION 2 #define MACH_EXC_ARITHMETIC 3