Module Name: src
Committed By: matt
Date: Fri Apr 30 16:11:14 UTC 2010
Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c
Log Message:
Report alignment faults as SIGBUS, not SIGSEGV.
To generate a diff of this commit:
cvs rdiff -u -r1.217.12.22 -r1.217.12.23 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.22 src/sys/arch/mips/mips/trap.c:1.217.12.23
--- src/sys/arch/mips/mips/trap.c:1.217.12.22 Thu Mar 11 08:19:01 2010
+++ src/sys/arch/mips/mips/trap.c Fri Apr 30 16:11:14 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.217.12.22 2010/03/11 08:19:01 matt Exp $ */
+/* $NetBSD: trap.c,v 1.217.12.23 2010/04/30 16:11:14 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.22 2010/03/11 08:19:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.23 2010/04/30 16:11:14 matt Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ddb.h"
@@ -457,9 +457,18 @@
case T_BUS_ERR_IFETCH+T_USER: /* BERR asserted to CPU */
case T_BUS_ERR_LD_ST+T_USER: /* BERR asserted to CPU */
ksi.ksi_trap = type & ~T_USER;
- ksi.ksi_signo = SIGSEGV; /* XXX */
ksi.ksi_addr = (void *)vaddr;
- ksi.ksi_code = SEGV_MAPERR; /* XXX */
+ if ((intptr_t)vaddr < 0) {
+ ksi.ksi_signo = SIGSEGV;
+ ksi.ksi_code = SEGV_MAPERR;
+ } else {
+ ksi.ksi_signo = SIGBUS;
+ if (type == T_BUS_ERR_IFETCH+T_USER
+ || type == T_BUS_ERR_LD_ST+T_USER)
+ ksi.ksi_code = BUS_OBJERR;
+ else
+ ksi.ksi_code = BUS_ADRALN;
+ }
break; /* SIGNAL */
case T_BREAK: