Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / system / blaze / include / stracer.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: stracer.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23////////////////////////////////////////////////////////////
24//
25// File: stracer.h
26//
27// Copyright (C) 2007 Sun Microsystems, Inc.
28// All rights reserved.
29//
30
31#ifndef _STRACER_H
32#define _STRACER_H
33
34#include "vtracer.h"
35#include "symbols.h"
36
37
38
39//////////////////////////////////////////////////////////
40//
41// debug tracer to output instructions to the ui console
42// or file
43
44class STracer : public VTracer
45{
46friend class STracerContainer;
47
48public:
49
50 int attach(VTracer_SAM_intf * intf);
51 int instr ( VCPU_Instruction *i );
52 int trap ( VCPU_Trap *t );
53 int tlb ( VCPU_TLB *s );
54 int hwop ( VCPU_HwOp *s );
55
56 int async (VCPU_AsyncData *) { return 1; }
57 int sync (VCPU_Sync *) { return 1; }
58 int put_string(int cpuid, const char * str);
59
60 char * get_trace_name() { return trace_name; }
61
62private:
63 STracer (const char *fname=NULL, SymTable *symtable=NULL);
64 ~STracer();
65
66 FILE *stream;
67 char *trace_name;
68 SymTable *sym_table;
69
70 int ref; // reference counter
71 STracer *next;
72
73 VTracer *save_vtracer;
74 int save_trace_on;
75};
76
77
78class STracerContainer
79{
80 STracer *head;
81
82public:
83
84 STracerContainer() { head = NULL; }
85 ~STracerContainer()
86 {
87 while(head)
88 {
89 STracer *s = head;
90 head = s->next;
91 delete s;
92 }
93 }
94
95
96 STracer *alloc(const char *fname, SymTable *symtable);
97 int dealloc (STracer *s);
98 int display(FILE *out);
99 bool is_found(STracer *s);
100};
101
102typedef enum { STRACER_OFF, STRACER_ON, STRACER_STATUS } trace_cmd_t;
103extern int tracer_cmd ( trace_cmd_t cmd, int *vid = NULL, const char *fname = NULL, bool separate = false );
104
105#endif // _STRACER_H