add trap tracing to cpu mondo handler and tsb miss handler

This commit is contained in:
Kip Macy 2006-11-15 03:16:30 +00:00
parent 597d4fe47d
commit f30d482097
3 changed files with 49 additions and 3 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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