* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: rstracer.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
#ifndef _rstracer_h_9ecb7c16_
#define _rstracer_h_9ecb7c16_
static const int max_ncpu
= 1024;
static const char id
[] = "SAM.rstracer";
// the per-cpu-tracer structure
state_DELAY
, // skipping "delay" insts
state_WAIT_SYNC_START
, // skipped delay insts; waiting to sync up with other cpus
state_WAIT_START
, // not all cpus have reached sync point. waiting for last one to flag me
state_TRACE_START
, // will start trace at the next instr callback
state_TRACING
, // actively tracing
state_WAIT_SYNC_STOP
, // traced specified # of insts. waiting to sync up with other cpus
state_WAIT_STOP
, // not all cpus have reached sync point. waiting for last one to flag me
// we check the pcontext and scontext values at each pavadiff record
// If they have changed, we output a regval record
int64_t dinsts
; // delay inst count (#insts since trace_on)
uint8_t hpr
; // hpstate.hpriv
uint8_t pr
; // pstate.priv
void init(int arg_cpuid
, const char * tmp_tracefilename
);
void emit_trace_preamble();
void add_regval(int rstregtype
, int rstregid
, uint64_t v64
);
void addrec(rstf_unionT
* ru
);
void string2rst(const char * str
);
int memcache_ref(uint64_t pa
); // returns hit(1) or miss(0)
class rstracer
: public VTracer
{
rstracer(const char * tmp_modname
);
int process_ui_cmd(int argc
, char **tmp_argv
);
int attach(VTracer_SAM_intf
* sam_intf
);
int instr(VCPU_Instruction
* ii
);
int trap ( VCPU_Trap
* ti
);
int tlb ( VCPU_TLB
* ti
);
int async ( VCPU_AsyncData
* di
);
int sync ( VCPU_Sync
* si
);
int hwop (VCPU_HwOp
* hi
);
// the parse_args_*() methods return 0 if success, error code otherwise
int parse_args_v4(int argc
, const char * tmp_argv
[]);
int parse_args_v5(int argc
, const char * tmp_argv
[]);
void trace_on(); // initialize a new trace
VTracer_SAM_intf
* SAM_intf
;
int ncpus
; // total number of vcpu's
int first_vcpu_id
; // id of the first vcpu
int last_vcpu_id
; // id of the last vcpu
int64_t trace_period
; // >= insts_per_cpu. the interval between starting points of periodic traces
char tracefilename
[PATH_MAX
];
int64_t delay
; // starts with initial_delay, then equal to (trace_period-insts_per_cpu)
// for synchronized start/stop
#endif // _rstracer_h_9ecb7c16_