VirtualBox

source: vbox/trunk/include/VBox/VBoxTpG.h@ 40886

Last change on this file since 40886 was 40886, checked in by vboxsync, 13 years ago

SUPDrvTracing: display more info on argument list bugs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.5 KB
Line 
1/* $Id: VBoxTpG.h 40886 2012-04-12 00:13:37Z 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
25RT_C_DECLS_BEGIN
26
27
28/**
29 * Probe location.
30 */
31typedef 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;
42AssertCompileSizeAlignment(VTGPROBELOC, 16);
43/** Pointer to a probe location. */
44typedef 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_SEG "," VTG_LOC_SECT ",regular")/*, aligned(16)*/)) 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. */
94typedef uint32_t VTGSTROFF;
95
96
97/** @name VTG type flags
98 * @{ */
99/** Masking out the fixed size if given. */
100#define VTG_TYPE_SIZE_MASK UINT32_C(0x000000ff)
101/** Indicates that VTG_TYPE_SIZE_MASK can be applied, UNSIGNED or SIGNED is
102 * usually set as well, so may PHYS. */
103#define VTG_TYPE_FIXED_SIZED RT_BIT_32(8)
104/** It's a pointer type, the size is given by the context the probe fired in. */
105#define VTG_TYPE_POINTER RT_BIT_32(9)
106/** A context specfic pointer or address, consult VTG_TYPE_CTX_XXX. */
107#define VTG_TYPE_CTX_POINTER RT_BIT_32(10)
108/** The type has the same size as the host architecture. */
109#define VTG_TYPE_HC_ARCH_SIZED RT_BIT_32(11)
110/** The type applies to ring-3 context. */
111#define VTG_TYPE_CTX_R3 RT_BIT_32(24)
112/** The type applies to ring-0 context. */
113#define VTG_TYPE_CTX_R0 RT_BIT_32(25)
114/** The type applies to raw-mode context. */
115#define VTG_TYPE_CTX_RC RT_BIT_32(26)
116/** The type applies to guest context. */
117#define VTG_TYPE_CTX_GST RT_BIT_32(27)
118/** The type context mask. */
119#define VTG_TYPE_CTX_MASK UINT32_C(0x0f000000)
120/** The type is a physical address. */
121#define VTG_TYPE_PHYS RT_BIT_32(29)
122/** The type is unsigned. */
123#define VTG_TYPE_UNSIGNED RT_BIT_32(30)
124/** The type is signed. */
125#define VTG_TYPE_SIGNED RT_BIT_32(31)
126/** Mask of valid bits (for simple validation). */
127#define VTG_TYPE_VALID_MASK UINT32_C(0xef000fff)
128/** @} */
129
130/**
131 * Checks if the VTG type flags indicates a large fixed size argument.
132 */
133#define VTG_TYPE_IS_LARGE(a_fType) \
134 ( ((a_fType) & VTG_TYPE_SIZE_MASK) > 4 && ((a_fType) & VTG_TYPE_FIXED_SIZED) )
135
136
137/**
138 * VTG argument descriptor.
139 */
140typedef struct VTGDESCARG
141{
142 VTGSTROFF offType;
143 uint32_t fType;
144} VTGDESCARG;
145/** Pointer to an argument descriptor. */
146typedef VTGDESCARG *PVTGDESCARG;
147
148
149/**
150 * VTG argument list descriptor.
151 */
152typedef struct VTGDESCARGLIST
153{
154 uint8_t cArgs;
155 uint8_t fHaveLargeArgs;
156 uint8_t abReserved[2];
157 VTGDESCARG aArgs[1];
158} VTGDESCARGLIST;
159/** Pointer to a VTG argument list descriptor. */
160typedef VTGDESCARGLIST *PVTGDESCARGLIST;
161
162
163/**
164 * VTG probe descriptor.
165 */
166typedef struct VTGDESCPROBE
167{
168 VTGSTROFF offName;
169 uint32_t offArgList;
170 uint16_t idxEnabled;
171 uint16_t idxProvider;
172 uint32_t u32User;
173} VTGDESCPROBE;
174AssertCompileSize(VTGDESCPROBE, 16);
175/** Pointer to a VTG probe descriptor. */
176typedef VTGDESCPROBE *PVTGDESCPROBE;
177
178
179/**
180 * Code/data stability.
181 */
182typedef enum kVTGStability
183{
184 kVTGStability_Invalid = 0,
185 kVTGStability_Internal,
186 kVTGStability_Private,
187 kVTGStability_Obsolete,
188 kVTGStability_External,
189 kVTGStability_Unstable,
190 kVTGStability_Evolving,
191 kVTGStability_Stable,
192 kVTGStability_Standard,
193 kVTGStability_End
194} kVTGStability;
195
196/**
197 * Data dependency.
198 */
199typedef enum kVTGClass
200{
201 kVTGClass_Invalid = 0,
202 kVTGClass_Unknown,
203 kVTGClass_Cpu,
204 kVTGClass_Platform,
205 kVTGClass_Group,
206 kVTGClass_Isa,
207 kVTGClass_Common,
208 kVTGClass_End
209} kVTGClass;
210
211
212/**
213 * VTG attributes.
214 */
215typedef struct VTGDESCATTR
216{
217 uint8_t u8Code;
218 uint8_t u8Data;
219 uint8_t u8DataDep;
220} VTGDESCATTR;
221AssertCompileSize(VTGDESCATTR, 3);
222/** Pointer to a const VTG attribute. */
223typedef VTGDESCATTR const *PCVTGDESCATTR;
224
225
226/**
227 * VTG provider descriptor.
228 */
229typedef struct VTGDESCPROVIDER
230{
231 VTGSTROFF offName;
232 uint16_t iFirstProbe;
233 uint16_t cProbes;
234 VTGDESCATTR AttrSelf;
235 VTGDESCATTR AttrModules;
236 VTGDESCATTR AttrFunctions;
237 VTGDESCATTR AttrNames;
238 VTGDESCATTR AttrArguments;
239 uint8_t bReserved;
240} VTGDESCPROVIDER;
241/** Pointer to a VTG provider descriptor. */
242typedef VTGDESCPROVIDER *PVTGDESCPROVIDER;
243
244
245/**
246 * VTG data object header.
247 */
248typedef struct VTGOBJHDR
249{
250 char szMagic[24];
251 uint32_t cBits;
252 uint32_t u32Reserved0;
253 PVTGDESCPROVIDER paProviders;
254 uintptr_t cbProviders;
255 PVTGDESCPROBE paProbes;
256 uintptr_t cbProbes;
257 bool *pafProbeEnabled;
258 uintptr_t cbProbeEnabled;
259 char *pachStrTab;
260 uintptr_t cbStrTab;
261 PVTGDESCARGLIST paArgLists;
262 uintptr_t cbArgLists;
263 PVTGPROBELOC paProbLocs;
264 PVTGPROBELOC paProbLocsEnd;
265 uintptr_t auReserved1[4];
266} VTGOBJHDR;
267/** Pointer to a VTG data object header. */
268typedef VTGOBJHDR *PVTGOBJHDR;
269
270/** The current VTGOBJHDR::szMagic value. */
271#define VTGOBJHDR_MAGIC "VTG Object Header v1.3\0"
272
273/** The name of the VTG data object header symbol in the object file. */
274extern VTGOBJHDR g_VTGObjHeader;
275
276RT_C_DECLS_END
277
278#endif
279
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette