Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 Improve TRAPTRACE. Add FLTRACE tha...
details: https://anonhg.NetBSD.org/src/rev/0ea1f505dae9
branches: trunk
changeset: 473896:0ea1f505dae9
user: eeh <eeh%NetBSD.org@localhost>
date: Mon Jun 21 01:39:06 1999 +0000
description:
Improve TRAPTRACE. Add FLTRACE that only tracks MMU faults.
diffstat:
sys/arch/sparc64/sparc64/db_interface.c | 62 ++++++++++++++++++--------------
sys/arch/sparc64/sparc64/locore.s | 49 ++++++++++++++++++++++---
2 files changed, 77 insertions(+), 34 deletions(-)
diffs (266 lines):
diff -r 6fa778a90397 -r 0ea1f505dae9 sys/arch/sparc64/sparc64/db_interface.c
--- a/sys/arch/sparc64/sparc64/db_interface.c Mon Jun 21 01:19:36 1999 +0000
+++ b/sys/arch/sparc64/sparc64/db_interface.c Mon Jun 21 01:39:06 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.19 1999/04/12 20:38:20 pk Exp $ */
+/* $NetBSD: db_interface.c,v 1.20 1999/06/21 01:39:06 eeh Exp $ */
/*
* Mach Operating System
@@ -52,6 +52,7 @@
#include <ddb/db_output.h>
#include <ddb/db_interface.h>
+#include <machine/cpu.h>
#include <machine/openfirm.h>
#include <machine/ctlreg.h>
#include <machine/pmap.h>
@@ -260,7 +261,6 @@
{
register char *src;
- addr = addr & 0x0ffffffffL; /* XXXXX */
src = (char *)addr;
while (size-- > 0) {
if (src >= (char *)VM_MIN_KERNEL_ADDRESS)
@@ -692,38 +692,45 @@
char *modif;
{
extern struct traptrace {
- unsigned short tl:3, ns:4, tt:9;
- unsigned short pid;
- u_int tstate;
- u_int tsp;
- u_int tpc;
+ unsigned short tl:3, /* Trap level */
+ ns:4, /* PCB nsaved */
+ tt:9; /* Trap type */
+ unsigned short pid; /* PID */
+ u_int tstate; /* tstate */
+ u_int tsp; /* sp */
+ u_int tpc; /* pc */
+ u_int tfault; /* MMU tag access */
} trap_trace[], trap_trace_end[];
- int i;
+ int i, start, full = 0;
+ struct traptrace *end;
+
+ start = 0;
+ end = &trap_trace_end[0];
+
+ {
+ register char c, *cp = modif;
+ if (modif)
+ while ((c = *cp++) != 0)
+ if (c == 'f')
+ full = 1;
+ }
if (have_addr) {
- i=addr;
- db_printf("%d:%d p:%d:%d tt:%x ts:%lx sp:%p tpc:%p ", i,
+ start=addr;
+ if (!full) end = &trap_trace[start+1];
+ }
+
+ for (i=start; &trap_trace[i] < end ; i++) {
+ db_printf("%d:%d p:%d tt:%x:%lx:%p %p:%p", i,
(int)trap_trace[i].tl, (int)trap_trace[i].pid,
- (int)trap_trace[i].ns, (int)trap_trace[i].tt,
- (u_long)trap_trace[i].tstate, (u_long)trap_trace[i].tsp,
+ (int)trap_trace[i].tt, (u_long)trap_trace[i].tstate,
+ (u_long)trap_trace[i].tfault, (u_long)trap_trace[i].tsp,
(u_long)trap_trace[i].tpc);
db_printsym((u_long)trap_trace[i].tpc, DB_STGY_PROC);
db_printf(": ");
- if (trap_trace[i].tpc && !(trap_trace[i].tpc&0x3)) {
- db_disasm((u_long)trap_trace[i].tpc, 0);
- } else db_printf("\n");
- return;
- }
-
- for (i=0; &trap_trace[i] < &trap_trace_end[0] ; i++) {
- db_printf("%d:%d p:%d:%d tt:%x ts:%lx sp:%p tpc:%p ", i,
- (int)trap_trace[i].tl, (int)trap_trace[i].pid,
- (int)trap_trace[i].ns, (int)trap_trace[i].tt,
- (u_long)trap_trace[i].tstate, (u_long)trap_trace[i].tsp,
- (u_long)trap_trace[i].tpc);
- db_printsym((u_long)trap_trace[i].tpc, DB_STGY_PROC);
- db_printf(": ");
- if (trap_trace[i].tpc && !(trap_trace[i].tpc&0x3)) {
+ if ((trap_trace[i].tpc && !(trap_trace[i].tpc&0x3)) &&
+ curproc &&
+ (curproc->p_pid == trap_trace[i].pid)) {
db_disasm((u_long)trap_trace[i].tpc, 0);
} else db_printf("\n");
}
@@ -822,6 +829,7 @@
db_expr_t count;
char *modif;
{
+ int full = 0;
extern void uvmhist_dump __P((struct uvm_history *));
extern struct uvm_history_head uvm_histories;
diff -r 6fa778a90397 -r 0ea1f505dae9 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Mon Jun 21 01:19:36 1999 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Mon Jun 21 01:39:06 1999 +0000
@@ -1,6 +1,6 @@
-/* $NetBSD: locore.s,v 1.41 1999/06/05 21:58:18 eeh Exp $ */
-/*
- * Copyright (c) 1996, 1997, 1998 Eduardo Horvath
+/* $NetBSD: locore.s,v 1.42 1999/06/21 01:39:06 eeh Exp $ */
+/*
+ * Copyright (c) 1996-1999 Eduardo Horvath
* Copyright (c) 1996 Paul Kranenburg
* Copyright (c) 1996
* The President and Fellows of Harvard College. All rights reserved.
@@ -52,6 +52,7 @@
#undef NO_VCACHE /* Map w/D$ disabled */
#undef TRAPTRACE /* Keep history of all traps (may watchdog) */
+#define FLTRACE /* Keep history of all page faults only */
#define TRAPSTATS /* Count traps */
#undef TRAPS_USE_IG /* Use Interrupt Globals for trap handling */
#undef LOCKED_PCB /* Lock current proc's PCB in MMU */
@@ -430,7 +431,11 @@
#define TRACEWIN TRACEME
#define TRACERELOAD32
#define TRACERELOAD64
+#ifdef FLTRACE
+#define TRACEFLT sethi %hi(1f), %g1; ba,pt %icc,traceit; or %g1, %lo(1f), %g1; 1:
+#else
#define TRACEFLT TRACEME
+#endif
#define VTRAP(type, label) \
set KERNBASE+0x28, %g1; rdpr %tt, %g2; b label; stx %g2, [%g1]; NOTREACHED; TA8
#endif
@@ -455,7 +460,11 @@
#define TRACEWIN TRACEME
#define TRACERELOAD32
#define TRACERELOAD64
+#ifdef FLTRACE
+#define TRACEFLT sethi %hi(1f), %g1; ba,pt %icc,traceit; or %g1, %lo(1f), %g1; 1:
+#else
#define TRACEFLT TRACEME
+#endif
#define VTRAP(type, label) \
ba,a,pt %icc,label; nop; NOTREACHED; TA8
#endif
@@ -1381,7 +1390,7 @@
.space TRACESIZ
_C_LABEL(trap_trace_end):
.space 0x20 ! safety margin
-#ifdef TRAPTRACE
+#if defined(TRAPTRACE)||defined(FLTRACE)
#define TRACEPTR (_C_LABEL(trap_trace_ptr)-_C_LABEL(trap_trace))
#define TRACEDIS (_C_LABEL(trap_trace_dis)-_C_LABEL(trap_trace))
traceit:
@@ -1401,13 +1410,13 @@
brz,pn %g6, 2f
andncc %g3, (TRACESIZ-1), %g0
! LDPTR [%g6+P_PID], %g5 ! Load PID
-2:
set _C_LABEL(cpcb), %g6 ! Load up nsaved
LDPTR [%g6], %g6
ldub [%g6 + PCB_NSAVED], %g6
sllx %g6, 9, %g6
or %g6, %g4, %g4
+2:
rdpr %tstate, %g6
movnz %icc, %g0, %g3
@@ -1422,6 +1431,10 @@
inc 4, %g3
stw %g7, [%g2+%g3]
inc 4, %g3
+ mov TLB_TAG_ACCESS, %g7
+ ldxa [%g7] ASI_DMMU, %g7
+ stw %g7, [%g2+%g3]
+ inc 4, %g3
1:
jmpl %g1, %g0
stw %g3, [%g2+TRACEPTR]
@@ -1454,6 +1467,8 @@
inc 4, %l3
stw %l7, [%l2+%l3]
inc 4, %l3
+ stw %g0, [%l2+%l3]
+ inc 4, %l3
stw %l3, [%l2+TRACEPTR]
1:
jmpl %l6, %g0
@@ -2343,6 +2358,10 @@
inc 4, %g3
stw %g7, [%g2+%g3]
inc 4, %g3
+ mov TLB_TAG_ACCESS, %g7
+ ldxa [%g7] ASI_DMMU, %g7
+ stw %g7, [%g2+%g3]
+ inc 4, %g3
stw %g3, [%g2+TRACEPTR]
1:
ba datafault
@@ -2691,6 +2710,10 @@
inc 4, %g3
stw %g7, [%g2+%g3]
inc 4, %g3
+ mov TLB_TAG_ACCESS, %g7
+ ldxa [%g7] ASI_DMMU, %g7
+ stw %g7, [%g2+%g3]
+ inc 4, %g3
stw %g3, [%g2+TRACEPTR]
1:
#endif
@@ -4316,6 +4339,10 @@
inc 4, %g3
stw %g7, [%g2+%g3]
inc 4, %g3
+ mov TLB_TAG_ACCESS, %g7
+ ldxa [%g7] ASI_DMMU, %g7
+ stw %g7, [%g2+%g3]
+ inc 4, %g3
stw %g3, [%g2+TRACEPTR]
1:
#endif
@@ -4635,6 +4662,10 @@
inc 4, %g3
stw %g7, [%g2+%g3]
inc 4, %g3
+ mov TLB_TAG_ACCESS, %g7
+ ldxa [%g7] ASI_DMMU, %g7
+ stw %g7, [%g2+%g3]
+ inc 4, %g3
stw %g3, [%g2+TRACEPTR]
1:
#endif
@@ -7407,6 +7438,10 @@
inc 4, %o3
stw %o7, [%o2+%o3]
inc 4, %o3
+ mov TLB_TAG_ACCESS, %o4
+ ldxa [%o4] ASI_DMMU, %o4
+ stw %o4, [%o2+%o3]
+ inc 4, %o3
stw %o3, [%o2+TRACEPTR]
1:
#endif
@@ -7706,7 +7741,7 @@
! %o0 = asi, %o1 = addr, %o2 = (1,2,4)
sethi %hi(_C_LABEL(cpcb)), %o3
LDPTR [%o3 + %lo(_C_LABEL(cpcb))], %o3 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o5
+ set _C_LABEL(Lfsbail), %o5
STPTR %o5, [%o3 + PCB_ONFAULT]
btst 1, %o2
wr %o0, 0, %asi
@@ -7757,7 +7792,7 @@
! %o0 = asi, %o1 = addr, %o2 = (1,2,4), %o3 = val
sethi %hi(_C_LABEL(cpcb)), %o4
LDPTR [%o4 + %lo(_C_LABEL(cpcb))], %o4 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o5
+ set _C_LABEL(Lfsbail), %o5
STPTR %o5, [%o4 + PCB_ONFAULT]
btst 1, %o2
wr %o0, 0, %asi
Home |
Main Index |
Thread Index |
Old Index