Module Name: src
Committed By: snj
Date: Tue Jul 21 00:37:30 UTC 2009
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-0]: trap.c
Log Message:
Pull up following revision(s) (requested by rmind in ticket #865):
sys/arch/amd64/amd64/trap.c: revisions 1.56, 1.57
handle protection fault properly.
To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.6.1 src/sys/arch/amd64/amd64/trap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.52 src/sys/arch/amd64/amd64/trap.c:1.52.6.1
--- src/sys/arch/amd64/amd64/trap.c:1.52 Wed Oct 15 06:51:17 2008
+++ src/sys/arch/amd64/amd64/trap.c Tue Jul 21 00:37:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.52 2008/10/15 06:51:17 wrstuden Exp $ */
+/* $NetBSD: trap.c,v 1.52.6.1 2009/07/21 00:37:29 snj Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52 2008/10/15 06:51:17 wrstuden Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.6.1 2009/07/21 00:37:29 snj Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -325,26 +325,35 @@
case T_STKFLT|T_USER:
case T_ALIGNFLT|T_USER:
#ifdef TRAP_SIGDEBUG
- printf("pid %d (%s): BUS (%x) at rip %lx addr %lx\n",
+ printf("pid %d (%s): BUS/SEGV (%x) at rip %lx addr %lx\n",
p->p_pid, p->p_comm, type, frame->tf_rip, rcr2());
frame_dump(frame);
#endif
KSI_INIT_TRAP(&ksi);
- ksi.ksi_signo = SIGBUS;
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)rcr2();
switch (type) {
case T_SEGNPFLT|T_USER:
case T_STKFLT|T_USER:
+ ksi.ksi_signo = SIGBUS;
ksi.ksi_code = BUS_ADRERR;
break;
case T_TSSFLT|T_USER:
+ ksi.ksi_signo = SIGBUS;
ksi.ksi_code = BUS_OBJERR;
break;
case T_ALIGNFLT|T_USER:
+ ksi.ksi_signo = SIGBUS;
ksi.ksi_code = BUS_ADRALN;
break;
+ case T_PROTFLT|T_USER:
+ ksi.ksi_signo = SIGSEGV;
+ ksi.ksi_code = SEGV_ACCERR;
+ break;
default:
+#ifdef DIAGNOSTIC
+ panic("unhandled type %x\n", type);
+#endif
break;
}
goto trapsignal;
@@ -368,6 +377,9 @@
ksi.ksi_code = ILL_COPROC;
break;
default:
+#ifdef DIAGNOSTIC
+ panic("unhandled type %x\n", type);
+#endif
break;
}
goto trapsignal;
@@ -414,6 +426,9 @@
ksi.ksi_code = FPE_FLTDIV;
break;
default:
+#ifdef DIAGNOSTIC
+ panic("unhandled type %x\n", type);
+#endif
break;
}
goto trapsignal;