Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Clean up excessive #ifdef'age of NMI trap handling for a...
details: https://anonhg.NetBSD.org/src/rev/d438f55ce9a6
branches: trunk
changeset: 763768:d438f55ce9a6
user: dyoung <dyoung%NetBSD.org@localhost>
date: Sun Apr 03 22:29:25 2011 +0000
description:
Clean up excessive #ifdef'age of NMI trap handling for amd64/i386/xen.
Handle NMI in all Xen kernels.
diffstat:
sys/arch/amd64/amd64/db_interface.c | 8 +++-
sys/arch/amd64/amd64/kgdb_machdep.c | 11 +++++-
sys/arch/amd64/amd64/trap.c | 46 ++++++-----------------------
sys/arch/amd64/conf/files.amd64 | 5 ++-
sys/arch/i386/i386/db_interface.c | 8 +++-
sys/arch/i386/i386/kgdb_machdep.c | 11 +++++-
sys/arch/i386/i386/trap.c | 57 ++++++------------------------------
sys/arch/i386/include/mca_machdep.h | 4 +-
sys/arch/i386/mca/mca_machdep.c | 11 +++---
sys/arch/x86/include/intr.h | 4 +-
sys/arch/x86/x86/intr.c | 7 +--
sys/arch/x86/x86/x86_stub.c | 28 ++++++++++++++++++
sys/arch/xen/conf/files.xen | 6 +++-
sys/kern/kgdb_stub.c | 22 ++++++++++++-
sys/sys/kgdb.h | 4 +-
15 files changed, 120 insertions(+), 112 deletions(-)
diffs (truncated from 608 to 300 lines):
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/amd64/amd64/db_interface.c
--- a/sys/arch/amd64/amd64/db_interface.c Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/amd64/amd64/db_interface.c Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.22 2010/12/20 00:25:24 matt Exp $ */
+/* $NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $ */
/*
* Mach Operating System
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.22 2010/12/20 00:25:24 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -173,9 +173,11 @@
db_regs_t dbreg;
switch (type) {
+ case T_NMI: /* NMI */
+ printf("NMI ... going to debugger\n");
+ /*FALLTHROUGH*/
case T_BPTFLT: /* breakpoint */
case T_TRCTRAP: /* single_step */
- case T_NMI: /* NMI */
case -1: /* keyboard interrupt */
break;
default:
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/amd64/amd64/kgdb_machdep.c
--- a/sys/arch/amd64/amd64/kgdb_machdep.c Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/amd64/amd64/kgdb_machdep.c Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kgdb_machdep.c,v 1.7 2010/12/20 00:25:24 matt Exp $ */
+/* $NetBSD: kgdb_machdep.c,v 1.8 2011/04/03 22:29:25 dyoung Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.7 2010/12/20 00:25:24 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.8 2011/04/03 22:29:25 dyoung Exp $");
#include "opt_ddb.h"
@@ -99,6 +99,13 @@
return (1);
}
+void
+kgdb_entry_notice(int type, db_regs_t *regs)
+{
+ if (type == T_NMI)
+ printf("NMI ... going to debugger\n");
+}
+
/*
* Translate a trap number into a unix compatible signal value.
* (gdb only understands unix signal numbers).
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/amd64/amd64/trap.c Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.65 2010/12/20 00:25:24 matt Exp $ */
+/* $NetBSD: trap.c,v 1.66 2011/04/03 22:29:25 dyoung 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.65 2010/12/20 00:25:24 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2011/04/03 22:29:25 dyoung Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -98,9 +98,7 @@
#include <machine/reg.h>
#include <machine/trap.h>
#include <machine/userret.h>
-#ifdef DDB
#include <machine/db_machdep.h>
-#endif
#include <x86/nmi.h>
@@ -108,9 +106,7 @@
#include "isa.h"
#endif
-#ifdef KGDB
#include <sys/kgdb.h>
-#endif
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
@@ -283,24 +279,17 @@
" %lx cpl %x rsp %lx\n",
type, frame->tf_err, (u_long)frame->tf_rip, frame->tf_cs,
frame->tf_rflags, rcr2(), curcpu()->ci_ilevel, frame->tf_rsp);
-#ifdef DDB
if (kdb_trap(type, 0, frame))
return;
-#endif
-#ifdef KGDB
if (kgdb_trap(type, frame))
return;
- else {
- /*
- * If this is a breakpoint, don't panic
- * if we're not connected.
- */
- if (type == T_BPTFLT) {
- printf("kgdb: ignored %s\n", trap_type[type]);
- return;
- }
+ /*
+ * If this is a breakpoint, don't panic if we're not connected.
+ */
+ if (type == T_BPTFLT && kgdb_disconnected()) {
+ printf("kgdb: ignored %s\n", trap_type[type]);
+ return;
}
-#endif
panic("trap");
/*NOTREACHED*/
@@ -675,32 +664,17 @@
break;
case T_NMI:
-#if !defined(XEN)
if (nmi_dispatch(frame))
return;
-#endif /* !defined(XEN) */
-#if NISA > 0
-#if defined(KGDB) || defined(DDB)
/* NMI can be hooked up to a pushbutton for debugging */
- printf ("NMI ... going to debugger\n");
-#ifdef KGDB
-
if (kgdb_trap(type, frame))
return;
-#endif
-#ifdef DDB
if (kdb_trap(type, 0, frame))
return;
-#endif
-#endif /* KGDB || DDB */
/* machine/parity/power fail/"kitchen sink" faults */
- if (x86_nmi() != 0)
- goto we_re_toast;
- else
- return;
-#endif /* NISA > 0 */
- ; /* avoid a label at end of compound statement */
+ x86_nmi();
+ return;
}
if ((type & T_USER) == 0)
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/amd64/conf/files.amd64
--- a/sys/arch/amd64/conf/files.amd64 Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/amd64/conf/files.amd64 Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amd64,v 1.69 2010/07/08 11:24:59 rmind Exp $
+# $NetBSD: files.amd64,v 1.70 2011/04/03 22:29:26 dyoung Exp $
#
# new style config file for amd64 architecture
#
@@ -111,6 +111,9 @@
# TSC timecounter support
file arch/x86/x86/tsc.c
+# Stubs for x86 routines not included in the system
+file arch/x86/x86/x86_stub.c
+
# attribute used to represent the "keyboard controller"
# XXX should be a real device
define pckbcport { [irq = -1], [port = -1] }
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/i386/i386/db_interface.c
--- a/sys/arch/i386/i386/db_interface.c Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/i386/i386/db_interface.c Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.65 2010/06/09 02:48:52 mrg Exp $ */
+/* $NetBSD: db_interface.c,v 1.66 2011/04/03 22:29:26 dyoung Exp $ */
/*
* Mach Operating System
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.65 2010/06/09 02:48:52 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.66 2011/04/03 22:29:26 dyoung Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -182,9 +182,11 @@
regs->tf_err &= ~TC_FLAGMASK;
switch (type) {
+ case T_NMI: /* NMI */
+ printf("NMI ... going to debugger\n");
+ /*FALLTHROUGH*/
case T_BPTFLT: /* breakpoint */
case T_TRCTRAP: /* single_step */
- case T_NMI: /* NMI */
case -1: /* keyboard interrupt */
break;
default:
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/i386/i386/kgdb_machdep.c
--- a/sys/arch/i386/i386/kgdb_machdep.c Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/i386/i386/kgdb_machdep.c Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kgdb_machdep.c,v 1.21 2009/10/18 18:14:00 snj Exp $ */
+/* $NetBSD: kgdb_machdep.c,v 1.22 2011/04/03 22:29:26 dyoung Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.21 2009/10/18 18:14:00 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.22 2011/04/03 22:29:26 dyoung Exp $");
#include "opt_ddb.h"
@@ -105,6 +105,13 @@
return (1);
}
+void
+kgdb_entry_notice(int type, db_regs_t *regs)
+{
+ if (type == T_NMI)
+ printf("NMI ... going to debugger\n");
+}
+
/*
* Translate a trap number into a unix compatible signal value.
* (gdb only understands unix signal numbers).
diff -r 5c6ba24b9e90 -r d438f55ce9a6 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sun Apr 03 22:14:15 2011 +0000
+++ b/sys/arch/i386/i386/trap.c Sun Apr 03 22:29:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.260 2010/12/20 00:25:35 matt Exp $ */
+/* $NetBSD: trap.c,v 1.261 2011/04/03 22:29:26 dyoung Exp $ */
/*-
* Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.260 2010/12/20 00:25:35 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.261 2011/04/03 22:29:26 dyoung Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -102,22 +102,16 @@
#include <machine/reg.h>
#include <machine/trap.h>
#include <machine/userret.h>
-#ifdef DDB
#include <machine/db_machdep.h>
-#endif
#include "mca.h"
-#if NMCA > 0
#include <machine/mca_machdep.h>
-#endif
#include <x86/nmi.h>
#include "isa.h"
-#ifdef KGDB
#include <sys/kgdb.h>
-#endif
#include "npx.h"
@@ -388,24 +382,17 @@
check_dr0();
else
trap_print(type, frame);
-#ifdef DDB
if (kdb_trap(type, 0, frame))
return;
-#endif
-#ifdef KGDB
if (kgdb_trap(type, frame))
Home |
Main Index |
Thread Index |
Old Index