Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Add hw.printfataltraps sysctl. Always print fa...
details: https://anonhg.NetBSD.org/src/rev/da3d48e2caab
branches: trunk
changeset: 325920:da3d48e2caab
user: matt <matt%NetBSD.org@localhost>
date: Sat Jan 11 17:32:20 2014 +0000
description:
Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.
diffstat:
sys/arch/arm/arm32/arm32_machdep.c | 11 +++++++++--
sys/arch/arm/arm32/fault.c | 18 ++++++++++++++++--
sys/arch/arm/include/locore.h | 1 +
3 files changed, 26 insertions(+), 4 deletions(-)
diffs (89 lines):
diff -r 648cdcaf5875 -r da3d48e2caab sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c Sat Jan 11 17:14:00 2014 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c Sat Jan 11 17:32:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.98 2013/09/10 21:30:21 matt Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.99 2014/01/11 17:32:20 matt Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.98 2013/09/10 21:30:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.99 2014/01/11 17:32:20 matt Exp $");
#include "opt_modular.h"
#include "opt_md.h"
@@ -99,6 +99,7 @@
extern paddr_t msgbufphys;
int kernel_debug = 0;
+int cpu_printfataltraps = 0;
int cpu_fpu_present;
int cpu_hwdiv_present;
int cpu_neon_present;
@@ -489,6 +490,12 @@
CTLTYPE_INT, "simdex_present", NULL,
NULL, 0, &cpu_simdex_present, 0,
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "printfataltraps", NULL,
+ NULL, 0, &cpu_printfataltraps, 0,
+ CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
/*
* We need override the usual CTL_HW HW_MACHINE_ARCH so we
diff -r 648cdcaf5875 -r da3d48e2caab sys/arch/arm/arm32/fault.c
--- a/sys/arch/arm/arm32/fault.c Sat Jan 11 17:14:00 2014 +0000
+++ b/sys/arch/arm/arm32/fault.c Sat Jan 11 17:32:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fault.c,v 1.91 2013/11/06 02:37:58 christos Exp $ */
+/* $NetBSD: fault.c,v 1.92 2014/01/11 17:32:20 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
#include "opt_kgdb.h"
#include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.91 2013/11/06 02:37:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.92 2014/01/11 17:32:20 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -499,6 +499,20 @@
UVMHIST_LOG(maphist, " <- error (%d)", error, 0, 0, 0);
do_trapsignal:
+ if (l->l_proc->p_pid == 1 || cpu_printfataltraps) {
+ printf("%d.%d(%s): trap: signo=%d code=%d addr=%p trap=%#x\n",
+ l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm,
+ ksi.ksi_signo, ksi.ksi_code, ksi.ksi_addr, ksi.ksi_trap);
+ printf("r0=%08x r1=%08x r2=%08x r3=%08x\n",
+ tf->tf_r0, tf->tf_r1, tf->tf_r2, tf->tf_r3);
+ printf("r4=%08x r5=%08x r6=%08x r7=%08x\n",
+ tf->tf_r4, tf->tf_r5, tf->tf_r6, tf->tf_r7);
+ printf("r8=%08x r9=%08x rA=%08x rB=%08x\n",
+ tf->tf_r8, tf->tf_r9, tf->tf_r10, tf->tf_r11);
+ printf("ip=%08x sp=%08x lr=%08x pc=%08x spsr=%08x\n",
+ tf->tf_r12, tf->tf_usr_sp, tf->tf_usr_lr, tf->tf_pc,
+ tf->tf_spsr);
+ }
call_trapsignal(l, &ksi);
out:
/* If returning to user mode, make sure to invoke userret() */
diff -r 648cdcaf5875 -r da3d48e2caab sys/arch/arm/include/locore.h
--- a/sys/arch/arm/include/locore.h Sat Jan 11 17:14:00 2014 +0000
+++ b/sys/arch/arm/include/locore.h Sat Jan 11 17:32:20 2014 +0000
@@ -148,6 +148,7 @@
#endif
/* 1 == use cpu_sleep(), 0 == don't */
+extern int cpu_printfataltraps;
extern int cpu_do_powersave;
extern int cpu_fpu_present;
extern int cpu_hwdiv_present;
Home |
Main Index |
Thread Index |
Old Index