alpha_trace.h
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (C) 1998 by the Board of Trustees
* of Leland Stanford Junior University.
* Copyright (C) 1998 Digital Equipment Corporation
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
#ifndef TRACE_H
#define TRACE_H
#ifdef TRACING
#define TRACE_ENTRY(_code,_cpu,_val) { \
if (trace.cpuMask[_cpu]) { \
*trace.bufferPtr++ = TRACE_FORMAT(_code,_cpu,_val); \
if (trace.bufferPtr==trace.bufferEnd) TraceDump(); \
} \
}
#define TRACE_LOG(_string) { \
if (trace.active) TraceLog(_string); \
}
#else
#define TRACE_ENTRY(_code,_cpu,_val)
#define TRACE_LOG(_string)
#endif /* TRACING */
#define TRACE_LOAD 1
#define TRACE_STORE 2
#define TRACE_MB 8
#define TRACE_BR_TAKEN 10
#define TRACE_BR_NOTTAKEN 11
#define TRACE_JSR 12 /*JMPRET*/
#define TRACE_BB 13 /*TARGET*/
#define TRACE_ASCII 20
#define TRACE_STORE_PHYS 21
#define TRACE_LOAD_PHYS 22
#define TRACE_TRAP 23
#define TRACE_FORMAT(_code,_cpu,_val) ( (((uint64)_code)<<56)|(((uint64)_cpu)<<52)|((_val)&BITMASK(52)))
#define TRACE_BUFFER_SIZE (32*1024)
typedef struct TracingState {
int active;
char cpuMask[SIM_MAXCPUS];
int fd;
uint64 *buffer;
uint64 *bufferPtr;
uint64 *bufferEnd;
} TracingState;
extern TracingState trace;
extern void TraceDump(void);
extern void TraceLog(char *);
#endif /* TRACE_H */