summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2006-11-15 03:16:30 +0000
committerkmacy <kmacy@FreeBSD.org>2006-11-15 03:16:30 +0000
commitb5d64aeac05aa667cee7f044d3db73f5cfd4d5fd (patch)
treef454f4890eb8245ceea6e5dd0343decc9edb5005
parent44a4b480da7a8d94fc03bfbb5cd597e2b7663d01 (diff)
downloadFreeBSD-src-b5d64aeac05aa667cee7f044d3db73f5cfd4d5fd.zip
FreeBSD-src-b5d64aeac05aa667cee7f044d3db73f5cfd4d5fd.tar.gz
add trap tracing to cpu mondo handler and tsb miss handler
-rw-r--r--sys/sun4v/include/asmacros.h31
-rw-r--r--sys/sun4v/sun4v/exception.S8
-rw-r--r--sys/sun4v/sun4v/interrupt.S13
3 files changed, 49 insertions, 3 deletions
diff --git a/sys/sun4v/include/asmacros.h b/sys/sun4v/include/asmacros.h
index 107aab0..884dc5c 100644
--- a/sys/sun4v/include/asmacros.h
+++ b/sys/sun4v/include/asmacros.h
@@ -302,6 +302,37 @@ name:
ldxa [SBP + (6*8)]%asi, %l6; \
ldxa [SBP + (7*8)]%asi, %l7;
+#define SAVE_OUTS_ASI(SBP) \
+ stxa %o0, [SBP + (0*8)]%asi; \
+ stxa %o1, [SBP + (1*8)]%asi; \
+ stxa %o2, [SBP + (2*8)]%asi; \
+ stxa %o3, [SBP + (3*8)]%asi; \
+ stxa %o4, [SBP + (4*8)]%asi; \
+ stxa %o5, [SBP + (5*8)]%asi; \
+ stxa %o6, [SBP + (6*8)]%asi; \
+ stxa %o7, [SBP + (7*8)]%asi;
+
+#define RESTORE_OUTS_ASI(SBP) \
+ ldxa [SBP + (0*8)]%asi, %o0; \
+ ldxa [SBP + (1*8)]%asi, %o1; \
+ ldxa [SBP + (2*8)]%asi, %o2; \
+ ldxa [SBP + (3*8)]%asi, %o3; \
+ ldxa [SBP + (4*8)]%asi, %o4; \
+ ldxa [SBP + (5*8)]%asi, %o5; \
+ ldxa [SBP + (6*8)]%asi, %o6; \
+ ldxa [SBP + (7*8)]%asi, %o7;
+
+
+#define TTRACE_ADD_SAFE(SBP, arg0, arg1, arg2, arg3, arg4) \
+ SAVE_OUTS_ASI(SBP); \
+ mov arg0, %o0; \
+ mov arg1, %o1; \
+ mov arg2, %o2; \
+ mov arg3, %o3; \
+ mov arg4, %o4; \
+ RESTORE_OUTS_ASI(SBP);
+
+
#endif /* LOCORE */
#endif /* _KERNEL */
diff --git a/sys/sun4v/sun4v/exception.S b/sys/sun4v/sun4v/exception.S
index e3b3179..f77b24b 100644
--- a/sys/sun4v/sun4v/exception.S
+++ b/sys/sun4v/sun4v/exception.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006 Kip Macy
+ * Copyright (c) 2006 Kip Macy <kmacy@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,8 @@ __FBSDID("$FreeBSD$")
#include "opt_compat.h"
#include "opt_ddb.h"
#include "opt_simulator.h"
-
+#include "opt_trap_trace.h"
+
#include <machine/asi.h>
#include <machine/asmacros.h>
#include <machine/ktr.h>
@@ -1659,6 +1660,9 @@ ENTRY(tsb_miss_handler)
sll %g1, RW_SHIFT, %g1
add %g1, PC_TSBWBUF, %g1
add PCPU_REG, %g1, %g1
+#ifdef TRAP_TRACING
+ TTRACE_ADD_SAFE(%g1, 0, 0, 0, 0, 0)
+#endif
SAVE_LOCALS_ASI(%g1)
mov 0, %g1 ! cansave is 0
! %g1 == %cansave
diff --git a/sys/sun4v/sun4v/interrupt.S b/sys/sun4v/sun4v/interrupt.S
index 0470e16..5281409 100644
--- a/sys/sun4v/sun4v/interrupt.S
+++ b/sys/sun4v/sun4v/interrupt.S
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2002 Jake Burkholder.
- * Copyright (c) 2006 Kip Macy kmacy@FreeBSD.org
+ * Copyright (c) 2006 Kip Macy <kmacy@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include "opt_simulator.h"
#include "opt_trap_trace.h"
+
#include <machine/hypervisorvar.h>
#include <machine/asi.h>
#include <machine/asmacros.h>
@@ -146,6 +147,16 @@ cpu_mondo(void)
*
*/
ENTRY(cpu_mondo)
+#ifdef TRAP_TRACING
+ GET_PCPU_PHYS_SCRATCH(%g1)
+ rdpr %tl, %g1
+ dec %g1
+ sll %g1, RW_SHIFT, %g1
+ add %g1, PC_TSBWBUF, %g1
+ add PCPU_REG, %g1, %g1
+ wr %g0, ASI_REAL, %asi
+ TTRACE_ADD_SAFE(%g1, 0, 0, 0, 0, 0)
+#endif
!
! Register Usage:-
! %g5 PC for fasttrap TL>0 handler
OpenPOWER on IntegriCloud