Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / system / blaze / include / stracer.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: stracer.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 ============================================
*/
////////////////////////////////////////////////////////////
//
// File: stracer.h
//
// Copyright (C) 2007 Sun Microsystems, Inc.
// All rights reserved.
//
#ifndef _STRACER_H
#define _STRACER_H
#include "vtracer.h"
#include "symbols.h"
//////////////////////////////////////////////////////////
//
// debug tracer to output instructions to the ui console
// or file
class STracer : public VTracer
{
friend class STracerContainer;
public:
int attach(VTracer_SAM_intf * intf);
int instr ( VCPU_Instruction *i );
int trap ( VCPU_Trap *t );
int tlb ( VCPU_TLB *s );
int hwop ( VCPU_HwOp *s );
int async (VCPU_AsyncData *) { return 1; }
int sync (VCPU_Sync *) { return 1; }
int put_string(int cpuid, const char * str);
char * get_trace_name() { return trace_name; }
private:
STracer (const char *fname=NULL, SymTable *symtable=NULL);
~STracer();
FILE *stream;
char *trace_name;
SymTable *sym_table;
int ref; // reference counter
STracer *next;
VTracer *save_vtracer;
int save_trace_on;
};
class STracerContainer
{
STracer *head;
public:
STracerContainer() { head = NULL; }
~STracerContainer()
{
while(head)
{
STracer *s = head;
head = s->next;
delete s;
}
}
STracer *alloc(const char *fname, SymTable *symtable);
int dealloc (STracer *s);
int display(FILE *out);
bool is_found(STracer *s);
};
typedef enum { STRACER_OFF, STRACER_ON, STRACER_STATUS } trace_cmd_t;
extern int tracer_cmd ( trace_cmd_t cmd, int *vid = NULL, const char *fname = NULL, bool separate = false );
#endif // _STRACER_H