1 | /* $Id: VBoxTpG.h 40851 2012-04-10 14:13:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Tracepoint Generator Structures.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | #ifndef ___VBox_VTG_h___
|
---|
20 | #define ___VBox_VTG_h___
|
---|
21 |
|
---|
22 | #include <iprt/types.h>
|
---|
23 | #include <iprt/assert.h>
|
---|
24 |
|
---|
25 | RT_C_DECLS_BEGIN
|
---|
26 |
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Probe location.
|
---|
30 | */
|
---|
31 | typedef struct VTGPROBELOC
|
---|
32 | {
|
---|
33 | uint32_t uLine : 31;
|
---|
34 | uint32_t fEnabled : 1;
|
---|
35 | uint32_t idProbe;
|
---|
36 | const char *pszFunction;
|
---|
37 | uint8_t *pbProbe;
|
---|
38 | #if ARCH_BITS == 64
|
---|
39 | uintptr_t uAlignment;
|
---|
40 | #endif
|
---|
41 | } VTGPROBELOC;
|
---|
42 | AssertCompileSizeAlignment(VTGPROBELOC, 16);
|
---|
43 | /** Pointer to a probe location. */
|
---|
44 | typedef VTGPROBELOC *PVTGPROBELOC;
|
---|
45 |
|
---|
46 | /** @def VTG_OBJ_SECT
|
---|
47 | * The name of the section containing the other probe data provided by the
|
---|
48 | * assembly / object generated by VBoxTpG. */
|
---|
49 | /** @def VTG_LOC_SECT
|
---|
50 | * The name of the section containing the VTGPROBELOC structures. This is
|
---|
51 | * filled by the probe macros, @see VTG_DECL_VTGPROBELOC. */
|
---|
52 | /** @def VTG_DECL_VTGPROBELOC
|
---|
53 | * Declares a static variable, @a a_VarName, of type VTGPROBELOC in the section
|
---|
54 | * indicated by VTG_LOC_SECT. */
|
---|
55 | #if defined(RT_OS_WINDOWS)
|
---|
56 | # define VTG_OBJ_SECT "VTGObj"
|
---|
57 | # define VTG_LOC_SECT "VTGPrLc.Data"
|
---|
58 | # ifdef _MSC_VER
|
---|
59 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
60 | __declspec(allocate(VTG_LOC_SECT)) static VTGPROBELOC a_VarName
|
---|
61 | # elif defined(__GNUC__)
|
---|
62 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
63 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
64 | # else
|
---|
65 | # error "Unsupported Windows compiler!"
|
---|
66 | # endif
|
---|
67 |
|
---|
68 | #elif defined(RT_OS_DARWIN)
|
---|
69 | # define VTG_OBJ_SECT "__VTGObj"
|
---|
70 | # define VTG_LOC_SECT "__VTGPrLc"
|
---|
71 | # define VTG_LOC_SEG "__VTG"
|
---|
72 | # ifdef __GNUC__
|
---|
73 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
74 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
75 | # else
|
---|
76 | # error "Unsupported Darwin compiler!"
|
---|
77 | # endif
|
---|
78 |
|
---|
79 | #elif defined(RT_OS_OS2)
|
---|
80 | # error "OS/2 is not supported"
|
---|
81 |
|
---|
82 | #else /* Assume the rest uses ELF. */
|
---|
83 | # define VTG_OBJ_SECT ".VTGObj"
|
---|
84 | # define VTG_LOC_SECT ".VTGPrLc"
|
---|
85 | # ifdef __GNUC__
|
---|
86 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
87 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
88 | # else
|
---|
89 | # error "Unsupported compiler!"
|
---|
90 | # endif
|
---|
91 | #endif
|
---|
92 |
|
---|
93 | /** VTG string table offset. */
|
---|
94 | typedef uint32_t VTGSTROFF;
|
---|
95 |
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * VTG argument descriptor.
|
---|
99 | */
|
---|
100 | typedef struct VTGDESCARG
|
---|
101 | {
|
---|
102 | VTGSTROFF offType;
|
---|
103 | VTGSTROFF offName;
|
---|
104 | } VTGDESCARG;
|
---|
105 | /** Pointer to an argument descriptor. */
|
---|
106 | typedef VTGDESCARG *PVTGDESCARG;
|
---|
107 |
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * VTG argument list descriptor.
|
---|
111 | */
|
---|
112 | typedef struct VTGDESCARGLIST
|
---|
113 | {
|
---|
114 | uint8_t cArgs;
|
---|
115 | uint8_t abReserved[3];
|
---|
116 | VTGDESCARG aArgs[1];
|
---|
117 | } VTGDESCARGLIST;
|
---|
118 | /** Pointer to a VTG argument list descriptor. */
|
---|
119 | typedef VTGDESCARGLIST *PVTGDESCARGLIST;
|
---|
120 |
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * VTG probe descriptor.
|
---|
124 | */
|
---|
125 | typedef struct VTGDESCPROBE
|
---|
126 | {
|
---|
127 | VTGSTROFF offName;
|
---|
128 | uint32_t offArgList;
|
---|
129 | uint16_t idxEnabled;
|
---|
130 | uint16_t idxProvider;
|
---|
131 | uint32_t u32User;
|
---|
132 | } VTGDESCPROBE;
|
---|
133 | AssertCompileSize(VTGDESCPROBE, 16);
|
---|
134 | /** Pointer to a VTG probe descriptor. */
|
---|
135 | typedef VTGDESCPROBE *PVTGDESCPROBE;
|
---|
136 |
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * Code/data stability.
|
---|
140 | */
|
---|
141 | typedef enum kVTGStability
|
---|
142 | {
|
---|
143 | kVTGStability_Invalid = 0,
|
---|
144 | kVTGStability_Internal,
|
---|
145 | kVTGStability_Private,
|
---|
146 | kVTGStability_Obsolete,
|
---|
147 | kVTGStability_External,
|
---|
148 | kVTGStability_Unstable,
|
---|
149 | kVTGStability_Evolving,
|
---|
150 | kVTGStability_Stable,
|
---|
151 | kVTGStability_Standard,
|
---|
152 | kVTGStability_End
|
---|
153 | } kVTGStability;
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * Data dependency.
|
---|
157 | */
|
---|
158 | typedef enum kVTGClass
|
---|
159 | {
|
---|
160 | kVTGClass_Invalid = 0,
|
---|
161 | kVTGClass_Unknown,
|
---|
162 | kVTGClass_Cpu,
|
---|
163 | kVTGClass_Platform,
|
---|
164 | kVTGClass_Group,
|
---|
165 | kVTGClass_Isa,
|
---|
166 | kVTGClass_Common,
|
---|
167 | kVTGClass_End
|
---|
168 | } kVTGClass;
|
---|
169 |
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * VTG attributes.
|
---|
173 | */
|
---|
174 | typedef struct VTGDESCATTR
|
---|
175 | {
|
---|
176 | uint8_t u8Code;
|
---|
177 | uint8_t u8Data;
|
---|
178 | uint8_t u8DataDep;
|
---|
179 | } VTGDESCATTR;
|
---|
180 | AssertCompileSize(VTGDESCATTR, 3);
|
---|
181 | /** Pointer to a const VTG attribute. */
|
---|
182 | typedef VTGDESCATTR const *PCVTGDESCATTR;
|
---|
183 |
|
---|
184 |
|
---|
185 | /**
|
---|
186 | * VTG provider descriptor.
|
---|
187 | */
|
---|
188 | typedef struct VTGDESCPROVIDER
|
---|
189 | {
|
---|
190 | VTGSTROFF offName;
|
---|
191 | uint16_t iFirstProbe;
|
---|
192 | uint16_t cProbes;
|
---|
193 | VTGDESCATTR AttrSelf;
|
---|
194 | VTGDESCATTR AttrModules;
|
---|
195 | VTGDESCATTR AttrFunctions;
|
---|
196 | VTGDESCATTR AttrNames;
|
---|
197 | VTGDESCATTR AttrArguments;
|
---|
198 | uint8_t bReserved;
|
---|
199 | } VTGDESCPROVIDER;
|
---|
200 | /** Pointer to a VTG provider descriptor. */
|
---|
201 | typedef VTGDESCPROVIDER *PVTGDESCPROVIDER;
|
---|
202 |
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * VTG data object header.
|
---|
206 | */
|
---|
207 | typedef struct VTGOBJHDR
|
---|
208 | {
|
---|
209 | char szMagic[24];
|
---|
210 | uint32_t cBits;
|
---|
211 | uint32_t u32Reserved0;
|
---|
212 | PVTGDESCPROVIDER paProviders;
|
---|
213 | uintptr_t cbProviders;
|
---|
214 | PVTGDESCPROBE paProbes;
|
---|
215 | uintptr_t cbProbes;
|
---|
216 | bool *pafProbeEnabled;
|
---|
217 | uintptr_t cbProbeEnabled;
|
---|
218 | char *pachStrTab;
|
---|
219 | uintptr_t cbStrTab;
|
---|
220 | PVTGDESCARGLIST paArgLists;
|
---|
221 | uintptr_t cbArgLists;
|
---|
222 | PVTGPROBELOC paProbLocs;
|
---|
223 | PVTGPROBELOC paProbLocsEnd;
|
---|
224 | uintptr_t auReserved1[4];
|
---|
225 | } VTGOBJHDR;
|
---|
226 | /** Pointer to a VTG data object header. */
|
---|
227 | typedef VTGOBJHDR *PVTGOBJHDR;
|
---|
228 |
|
---|
229 | /** The current VTGOBJHDR::szMagic value. */
|
---|
230 | #define VTGOBJHDR_MAGIC "VTG Object Header v1.2\0"
|
---|
231 |
|
---|
232 | /** The name of the VTG data object header symbol in the object file. */
|
---|
233 | extern VTGOBJHDR g_VTGObjHeader;
|
---|
234 |
|
---|
235 | RT_C_DECLS_END
|
---|
236 |
|
---|
237 | #endif
|
---|
238 |
|
---|