Mon Sep 7 22:06:32 2009 UTC ()
Cleanup fatal trap printfs


(matt)
diff -r1.217.12.8 -r1.217.12.9 src/sys/arch/mips/mips/trap.c

cvs diff -r1.217.12.8 -r1.217.12.9 src/sys/arch/mips/mips/trap.c (expand / switch to unified diff)

--- src/sys/arch/mips/mips/trap.c 2009/09/03 00:10:18 1.217.12.8
+++ src/sys/arch/mips/mips/trap.c 2009/09/07 22:06:32 1.217.12.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap.c,v 1.217.12.8 2009/09/03 00:10:18 matt Exp $ */ 1/* $NetBSD: trap.c,v 1.217.12.9 2009/09/07 22:06:32 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer 8 * the Systems Programming Group of the University of Utah Computer
9 * Science Department and Ralph Campbell. 9 * Science Department and Ralph Campbell.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -68,27 +68,27 @@ @@ -68,27 +68,27 @@
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE. 72 * SUCH DAMAGE.
73 * 73 *
74 * from: Utah Hdr: trap.c 1.32 91/04/06 74 * from: Utah Hdr: trap.c 1.32 91/04/06
75 * 75 *
76 * @(#)trap.c 8.5 (Berkeley) 1/11/94 76 * @(#)trap.c 8.5 (Berkeley) 1/11/94
77 */ 77 */
78 78
79#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 79#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
80 80
81__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.8 2009/09/03 00:10:18 matt Exp $"); 81__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.9 2009/09/07 22:06:32 matt Exp $");
82 82
83#include "opt_cputype.h" /* which mips CPU levels do we support? */ 83#include "opt_cputype.h" /* which mips CPU levels do we support? */
84#include "opt_ddb.h" 84#include "opt_ddb.h"
85#include "opt_kgdb.h" 85#include "opt_kgdb.h"
86 86
87#include <sys/param.h> 87#include <sys/param.h>
88#include <sys/systm.h> 88#include <sys/systm.h>
89#include <sys/kernel.h> 89#include <sys/kernel.h>
90#include <sys/proc.h> 90#include <sys/proc.h>
91#include <sys/ras.h> 91#include <sys/ras.h>
92#include <sys/signalvar.h> 92#include <sys/signalvar.h>
93#include <sys/syscall.h> 93#include <sys/syscall.h>
94#include <sys/user.h> 94#include <sys/user.h>
@@ -217,36 +217,42 @@ trap(unsigned int status, unsigned int c @@ -217,36 +217,42 @@ trap(unsigned int status, unsigned int c
217 if (type != T_BREAK) { 217 if (type != T_BREAK) {
218#ifdef IPL_ICU_MASK 218#ifdef IPL_ICU_MASK
219 spllowersofthigh(); 219 spllowersofthigh();
220#else 220#else
221 _splset((status & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE); 221 _splset((status & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
222#endif 222#endif
223 } 223 }
224 } 224 }
225 225
226 switch (type) { 226 switch (type) {
227 default: 227 default:
228 dopanic: 228 dopanic:
229 (void)splhigh(); 229 (void)splhigh();
 230 printf("pid %d(%s): ", p->p_pid, p->p_comm);
230 printf("trap: %s in %s mode\n", 231 printf("trap: %s in %s mode\n",
231 trap_type[TRAPTYPE(cause)], 232 trap_type[TRAPTYPE(cause)],
232 USERMODE(status) ? "user" : "kernel"); 233 USERMODE(status) ? "user" : "kernel");
233 printf("status=0x%x, cause=0x%x, epc=%#" PRIxVADDR 234 printf("status=0x%x, cause=0x%x, epc=%#" PRIxVADDR
234 ", vaddr=%#" PRIxVADDR "\n", status, cause, opc, vaddr); 235 ", vaddr=%#" PRIxVADDR, status, cause, opc, vaddr);
235 fp = l->l_md.md_regs; 236 if (USERMODE(status)) {
236 printf("pid=%d cmd=%s usp=%#" PRIxREGISTER 237 fp = l->l_md.md_regs;
237 " ksp=%p ra=%#" PRIxREGISTER "\n", 238 printf(" frame=%p usp=%#" PRIxREGISTER
238 p->p_pid, p->p_comm, fp->f_regs[_R_SP], 239 " ra=%#" PRIxREGISTER "\n",
239 &status, fp->f_regs[_R_RA]); 240 fp, fp->f_regs[_R_SP], fp->f_regs[_R_RA]);
 241 } else {
 242 printf(" tf=%p ksp=%p ra=%#" PRIxREGISTER "\n",
 243 frame, frame+1, frame->tf_regs[TF_RA]);
 244 }
 245
240#if defined(DDB) 246#if defined(DDB)
241 kdb_trap(type, frame->tf_regs); 247 kdb_trap(type, frame->tf_regs);
242 /* XXX force halt XXX */ 248 /* XXX force halt XXX */
243#elif defined(KGDB) 249#elif defined(KGDB)
244 { 250 {
245 struct frame *f = (struct frame *)&ddb_regs; 251 struct frame *f = (struct frame *)&ddb_regs;
246 extern mips_reg_t kgdb_cause, kgdb_vaddr; 252 extern mips_reg_t kgdb_cause, kgdb_vaddr;
247 kgdb_cause = cause; 253 kgdb_cause = cause;
248 kgdb_vaddr = vaddr; 254 kgdb_vaddr = vaddr;
249 255
250 /* 256 /*
251 * init global ddb_regs, used in db_interface.c routines 257 * init global ddb_regs, used in db_interface.c routines
252 * shared between ddb and gdb. Send ddb_regs to gdb so 258 * shared between ddb and gdb. Send ddb_regs to gdb so