diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-04-09 21:10:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-04-09 21:10:36 +0000 |
commit | 4799b8ee9f1e55dc9dabeae39c883d40b5fd93e7 (patch) | |
tree | cd5c39bcef766c2b1d9ef4742dfe02956e3777d5 /sys | |
parent | 7fe20220626c1c4fdde7fdcfbdca140a646a787c (diff) |
Make trapDump() take the printf-like function as a 2nd parameter.
No functional change; helps non-released kernels with extra debugging code (-:
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mips64/include/trap.h | 4 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/db_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/exception_tfp.S | 3 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/tlbhandler.S | 6 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 12 |
5 files changed, 13 insertions, 16 deletions
diff --git a/sys/arch/mips64/include/trap.h b/sys/arch/mips64/include/trap.h index 9213df4d738..4e087910aa2 100644 --- a/sys/arch/mips64/include/trap.h +++ b/sys/arch/mips64/include/trap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.h,v 1.15 2012/09/29 19:24:31 miod Exp $ */ +/* $OpenBSD: trap.h,v 1.16 2014/04/09 21:10:34 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -118,7 +118,7 @@ do { \ extern struct trapdebug trapdebug[MAXCPUS * TRAPSIZE]; extern uint trppos[MAXCPUS]; -void trapDump(const char *msg); +void trapDump(const char *, int (*)(const char *, ...)); #else #define trapdebug_enter(ci, frame, code) diff --git a/sys/arch/mips64/mips64/db_machdep.c b/sys/arch/mips64/mips64/db_machdep.c index 2646400b31f..18f5a46c550 100644 --- a/sys/arch/mips64/mips64/db_machdep.c +++ b/sys/arch/mips64/mips64/db_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.c,v 1.37 2014/03/21 23:05:41 miod Exp $ */ +/* $OpenBSD: db_machdep.c,v 1.38 2014/04/09 21:10:35 miod Exp $ */ /* * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) @@ -387,7 +387,7 @@ next_instr_address(db_addr_t pc, boolean_t bd) void db_trap_trace_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *m) { - trapDump("ddb trap trace"); + trapDump("ddb trap trace", db_printf); } void diff --git a/sys/arch/mips64/mips64/exception_tfp.S b/sys/arch/mips64/mips64/exception_tfp.S index f1727d88026..5beeb62c808 100644 --- a/sys/arch/mips64/mips64/exception_tfp.S +++ b/sys/arch/mips64/mips64/exception_tfp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception_tfp.S,v 1.2 2012/10/03 11:18:23 miod Exp $ */ +/* $OpenBSD: exception_tfp.S,v 1.3 2014/04/09 21:10:35 miod Exp $ */ /* * Copyright (c) 2012 Miodrag Vallat. @@ -363,6 +363,7 @@ k_intr: LA sp, start-FRAMESZ(CF_SZ) #ifdef DDB + LA a1, db_printf LA a0, 2f jal trapDump NOP diff --git a/sys/arch/mips64/mips64/tlbhandler.S b/sys/arch/mips64/mips64/tlbhandler.S index 9253b9047f9..c5c4c123ba7 100644 --- a/sys/arch/mips64/mips64/tlbhandler.S +++ b/sys/arch/mips64/mips64/tlbhandler.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tlbhandler.S,v 1.42 2014/03/24 17:12:01 miod Exp $ */ +/* $OpenBSD: tlbhandler.S,v 1.43 2014/04/09 21:10:35 miod Exp $ */ /* * Copyright (c) 1995-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -350,16 +350,18 @@ sys_stk_chk: REG_S a3, CF_ARGSZ+1*REGSZ(sp) PTR_S sp, CF_ARGSZ+2*REGSZ(a0) #endif + move sp, a0 dmfc0 a3, COP_0_BAD_VADDR move a2, ra dmfc0 a1, COP_0_EXC_PC LA a0, 1f jal printf - move sp, a0 + nop LA sp, start-FRAMESZ(CF_SZ) # set sp to a valid place #ifdef DDB + LA a1, db_printf LA a0, 2f jal trapDump nop diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index 376dfe08d55..8f20faf0563 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.91 2014/03/26 19:38:18 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.92 2014/04/09 21:10:35 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -791,7 +791,7 @@ fault_common_no_miss: err: disableintr(); #if !defined(DDB) && defined(DEBUG) - trapDump("trap"); + trapDump("trap", printf); #endif printf("\nTrap cause = %d Frame %p\n", type, trapframe); printf("Trap PC %p RA %p fault %p\n", @@ -841,7 +841,7 @@ child_return(arg) #if defined(DDB) || defined(DEBUG) void -trapDump(const char *msg) +trapDump(const char *msg, int (*pr)(const char *, ...)) { #ifdef MULTIPROCESSOR CPU_INFO_ITERATOR cii; @@ -851,13 +851,7 @@ trapDump(const char *msg) int i; uint pos; int s; - int (*pr)(const char*, ...); -#ifdef DDB - pr = db_printf; -#else - pr = printf; -#endif s = splhigh(); (*pr)("trapDump(%s)\n", msg); #ifndef MULTIPROCESSOR |