summaryrefslogtreecommitdiff
path: root/sys/arch/mips64
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-01-21 17:50:45 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-01-21 17:50:45 +0000
commita42361db8096ea82cd1a39161f2d8121d84cb755 (patch)
tree5835ba462e83fa903f77af2a6915de4fe3fb9c0f /sys/arch/mips64
parent95944c72f68b1e822899332709ee1f6d7bf5e639 (diff)
Use db_printf() instead of printf() in db_dump_tlb_cmd() and trapDump(), so
that the output can be paused by ddb if it spans too many lines.
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r--sys/arch/mips64/mips64/db_machdep.c34
-rw-r--r--sys/arch/mips64/mips64/trap.c17
2 files changed, 29 insertions, 22 deletions
diff --git a/sys/arch/mips64/mips64/db_machdep.c b/sys/arch/mips64/mips64/db_machdep.c
index 238aaa57c40..efc37a98fc1 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.26 2010/01/16 23:28:10 miod Exp $ */
+/* $OpenBSD: db_machdep.c,v 1.27 2010/01/21 17:50:44 miod Exp $ */
/*
* Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se)
@@ -373,7 +373,7 @@ char *attr[] = {
if ((tlbp.tlb_hi == tlb.tlb_hi && (tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V)) ||
(pfn_to_pad(tlb.tlb_lo0) == pfn_to_pad(tlbp.tlb_lo0) && tlb.tlb_lo0 & PG_V) ||
(pfn_to_pad(tlb.tlb_lo1) == pfn_to_pad(tlbp.tlb_lo1) && tlb.tlb_lo1 & PG_V)) {
- printf("MATCH:\n");
+ db_printf("MATCH:\n");
db_dump_tlb_cmd(tlbno, 1, 1, "");
db_dump_tlb_cmd(check, 1, 1, "");
}
@@ -397,32 +397,32 @@ if ((tlbp.tlb_hi == tlb.tlb_hi && (tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V)) ||
continue;
if (tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V) {
- printf("%2d v=%16llx", tlbno, tlb.tlb_hi & ~0xffL);
- printf("/%02x ", tlb.tlb_hi & 0xff);
+ db_printf("%2d v=%16llx", tlbno, tlb.tlb_hi & ~0xffL);
+ db_printf("/%02x ", tlb.tlb_hi & 0xff);
if (tlb.tlb_lo0 & PG_V) {
- printf("%16llx ", pfn_to_pad(tlb.tlb_lo0));
- printf("%c", tlb.tlb_lo0 & PG_M ? 'M' : ' ');
- printf("%c", tlb.tlb_lo0 & PG_G ? 'G' : ' ');
- printf("%s ", attr[(tlb.tlb_lo0 >> 3) & 7]);
+ db_printf("%16llx ", pfn_to_pad(tlb.tlb_lo0));
+ db_printf("%c", tlb.tlb_lo0 & PG_M ? 'M' : ' ');
+ db_printf("%c", tlb.tlb_lo0 & PG_G ? 'G' : ' ');
+ db_printf("%s ", attr[(tlb.tlb_lo0 >> 3) & 7]);
} else {
- printf("invalid ");
+ db_printf("invalid ");
}
if (tlb.tlb_lo1 & PG_V) {
- printf("%16llx ", pfn_to_pad(tlb.tlb_lo1));
- printf("%c", tlb.tlb_lo1 & PG_M ? 'M' : ' ');
- printf("%c", tlb.tlb_lo1 & PG_G ? 'G' : ' ');
- printf("%s ", attr[(tlb.tlb_lo1 >> 3) & 7]);
+ db_printf("%16llx ", pfn_to_pad(tlb.tlb_lo1));
+ db_printf("%c", tlb.tlb_lo1 & PG_M ? 'M' : ' ');
+ db_printf("%c", tlb.tlb_lo1 & PG_G ? 'G' : ' ');
+ db_printf("%s ", attr[(tlb.tlb_lo1 >> 3) & 7]);
} else {
- printf("invalid ");
+ db_printf("invalid ");
}
- printf(" sz=%x", tlb.tlb_mask);
+ db_printf(" sz=%x", tlb.tlb_mask);
}
else if (pid < 0) {
- printf("%2d v=invalid ", tlbno);
+ db_printf("%2d v=invalid ", tlbno);
}
- printf("\n");
+ db_printf("\n");
}
}
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 0681879dced..0812e3928cf 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.62 2010/01/18 18:27:32 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.63 2010/01/21 17:50:44 miod Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -78,6 +78,7 @@
#ifdef DDB
#include <mips64/db_machdep.h>
+#include <ddb/db_output.h>
#include <ddb/db_sym.h>
#endif
@@ -866,9 +867,15 @@ trapDump(char *msg)
int i;
uint pos;
int s;
+ int (*pr)(const char*, ...);
+#ifdef DDB
+ pr = db_printf;
+#else
+ pr = printf;
+#endif
s = splhigh();
- printf("trapDump(%s)\n", msg);
+ (*pr)("trapDump(%s)\n", msg);
#ifndef MULTIPROCESSOR
ci = curcpu();
#else
@@ -876,7 +883,7 @@ trapDump(char *msg)
#endif
{
#ifdef MULTIPROCESSOR
- printf("cpu%d\n", ci->ci_cpuid);
+ (*pr)("cpu%d\n", ci->ci_cpuid);
#endif
/* walk in reverse order */
pos = trppos[ci->ci_cpuid];
@@ -890,11 +897,11 @@ trapDump(char *msg)
if (ptrp->cause == 0)
break;
- printf("%s: PC %p CR 0x%08x SR 0x%08x\n",
+ (*pr)("%s: PC %p CR 0x%08x SR 0x%08x\n",
trap_type[(ptrp->cause & CR_EXC_CODE) >>
CR_EXC_CODE_SHIFT],
ptrp->pc, ptrp->cause, ptrp->status);
- printf(" RA %p SP %p ADR %p\n",
+ (*pr)(" RA %p SP %p ADR %p\n",
ptrp->ra, ptrp->sp, ptrp->vadr);
}
}