[40594] | 1 | /* $Id: VBoxTpG.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VBox Tracepoint Generator Structures.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2012-2023 Oracle and/or its affiliates.
|
---|
[40594] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
[40986] | 11 | *
|
---|
[96407] | 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
[40986] | 25 | * The contents of this file may alternatively be used under the terms
|
---|
| 26 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[40986] | 29 | * CDDL are applicable instead of those of the GPL.
|
---|
| 30 | *
|
---|
| 31 | * You may elect to license modified versions of this file under the
|
---|
| 32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 33 | *
|
---|
| 34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[40594] | 35 | */
|
---|
| 36 |
|
---|
[76558] | 37 | #ifndef VBOX_INCLUDED_VBoxTpG_h
|
---|
| 38 | #define VBOX_INCLUDED_VBoxTpG_h
|
---|
[76507] | 39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 40 | # pragma once
|
---|
| 41 | #endif
|
---|
[40594] | 42 |
|
---|
| 43 | #include <iprt/types.h>
|
---|
| 44 | #include <iprt/assert.h>
|
---|
| 45 |
|
---|
| 46 | RT_C_DECLS_BEGIN
|
---|
| 47 |
|
---|
[41117] | 48 | /**
|
---|
| 49 | * 32-bit probe location.
|
---|
| 50 | */
|
---|
| 51 | typedef struct VTGPROBELOC32
|
---|
| 52 | {
|
---|
| 53 | uint32_t uLine : 31;
|
---|
| 54 | uint32_t fEnabled : 1;
|
---|
| 55 | uint32_t idProbe;
|
---|
| 56 | uint32_t pszFunction;
|
---|
[41130] | 57 | uint32_t pProbe;
|
---|
[41117] | 58 | } VTGPROBELOC32;
|
---|
| 59 | AssertCompileSize(VTGPROBELOC32, 16);
|
---|
| 60 | /** Pointer to a 32-bit probe location. */
|
---|
| 61 | typedef VTGPROBELOC32 *PVTGPROBELOC32;
|
---|
| 62 | /** Pointer to a const 32-bit probe location. */
|
---|
| 63 | typedef VTGPROBELOC32 const *PCVTGPROBELOC32;
|
---|
[40594] | 64 |
|
---|
| 65 | /**
|
---|
[41117] | 66 | * 64-bit probe location.
|
---|
| 67 | */
|
---|
| 68 | typedef struct VTGPROBELOC64
|
---|
| 69 | {
|
---|
| 70 | uint32_t uLine : 31;
|
---|
| 71 | uint32_t fEnabled : 1;
|
---|
| 72 | uint32_t idProbe;
|
---|
| 73 | uint64_t pszFunction;
|
---|
[41130] | 74 | uint64_t pProbe;
|
---|
[41117] | 75 | uint64_t uAlignment;
|
---|
| 76 | } VTGPROBELOC64;
|
---|
| 77 | AssertCompileSize(VTGPROBELOC64, 32);
|
---|
| 78 | /** Pointer to a 64-bit probe location. */
|
---|
| 79 | typedef VTGPROBELOC64 *PVTGPROBELOC64;
|
---|
| 80 | /** Pointer to a const 64-bit probe location. */
|
---|
| 81 | typedef VTGPROBELOC64 const *PCVTGPROBELOC64;
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
[40594] | 85 | * Probe location.
|
---|
| 86 | */
|
---|
| 87 | typedef struct VTGPROBELOC
|
---|
| 88 | {
|
---|
[41130] | 89 | uint32_t uLine : 31;
|
---|
| 90 | uint32_t fEnabled : 1;
|
---|
| 91 | uint32_t idProbe;
|
---|
| 92 | const char *pszFunction;
|
---|
| 93 | struct VTGDESCPROBE *pProbe;
|
---|
[40851] | 94 | #if ARCH_BITS == 64
|
---|
[41130] | 95 | uintptr_t uAlignment;
|
---|
[40851] | 96 | #endif
|
---|
[40594] | 97 | } VTGPROBELOC;
|
---|
[40851] | 98 | AssertCompileSizeAlignment(VTGPROBELOC, 16);
|
---|
[40594] | 99 | /** Pointer to a probe location. */
|
---|
| 100 | typedef VTGPROBELOC *PVTGPROBELOC;
|
---|
[41117] | 101 | /** Pointer to a const probe location. */
|
---|
| 102 | typedef VTGPROBELOC const *PCVTGPROBELOC;
|
---|
[40594] | 103 |
|
---|
| 104 | /** @def VTG_OBJ_SECT
|
---|
| 105 | * The name of the section containing the other probe data provided by the
|
---|
| 106 | * assembly / object generated by VBoxTpG. */
|
---|
| 107 | /** @def VTG_LOC_SECT
|
---|
| 108 | * The name of the section containing the VTGPROBELOC structures. This is
|
---|
| 109 | * filled by the probe macros, @see VTG_DECL_VTGPROBELOC. */
|
---|
| 110 | /** @def VTG_DECL_VTGPROBELOC
|
---|
| 111 | * Declares a static variable, @a a_VarName, of type VTGPROBELOC in the section
|
---|
| 112 | * indicated by VTG_LOC_SECT. */
|
---|
| 113 | #if defined(RT_OS_WINDOWS)
|
---|
[40826] | 114 | # define VTG_OBJ_SECT "VTGObj"
|
---|
| 115 | # define VTG_LOC_SECT "VTGPrLc.Data"
|
---|
[40594] | 116 | # ifdef _MSC_VER
|
---|
| 117 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
| 118 | __declspec(allocate(VTG_LOC_SECT)) static VTGPROBELOC a_VarName
|
---|
[58106] | 119 | # elif defined(__GNUC__) || defined(DOXYGEN_RUNNING)
|
---|
[40594] | 120 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
| 121 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
| 122 | # else
|
---|
| 123 | # error "Unsupported Windows compiler!"
|
---|
| 124 | # endif
|
---|
| 125 |
|
---|
| 126 | #elif defined(RT_OS_DARWIN)
|
---|
| 127 | # define VTG_OBJ_SECT "__VTGObj"
|
---|
| 128 | # define VTG_LOC_SECT "__VTGPrLc"
|
---|
| 129 | # define VTG_LOC_SEG "__VTG"
|
---|
[58106] | 130 | # if defined(__GNUC__) || defined(DOXYGEN_RUNNING)
|
---|
[40594] | 131 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
[40857] | 132 | static VTGPROBELOC __attribute__((section(VTG_LOC_SEG "," VTG_LOC_SECT ",regular")/*, aligned(16)*/)) a_VarName
|
---|
[40594] | 133 | # else
|
---|
| 134 | # error "Unsupported Darwin compiler!"
|
---|
| 135 | # endif
|
---|
| 136 |
|
---|
[44424] | 137 | #elif defined(RT_OS_OS2) /** @todo This doesn't actually work, but it makes the code compile. */
|
---|
| 138 | # define VTG_OBJ_SECT "__DATA"
|
---|
| 139 | # define VTG_LOC_SECT "__VTGPrLc"
|
---|
| 140 | # define VTG_LOC_SET "__VTGPrLcSet"
|
---|
[58106] | 141 | # if defined(__GNUC__) || defined(DOXYGEN_RUNNING)
|
---|
[44424] | 142 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
| 143 | static VTGPROBELOC a_VarName; \
|
---|
| 144 | __asm__ (".stabs \"__VTGPrLcSet\", 23, 0, 0, _" #a_VarName );
|
---|
[48934] | 145 |
|
---|
[44424] | 146 | # else
|
---|
| 147 | # error "Unsupported Darwin compiler!"
|
---|
| 148 | # endif
|
---|
[40594] | 149 |
|
---|
| 150 | #else /* Assume the rest uses ELF. */
|
---|
| 151 | # define VTG_OBJ_SECT ".VTGObj"
|
---|
| 152 | # define VTG_LOC_SECT ".VTGPrLc"
|
---|
[58106] | 153 | # if defined(__GNUC__) || defined(DOXYGEN_RUNNING)
|
---|
[40594] | 154 | # define VTG_DECL_VTGPROBELOC(a_VarName) \
|
---|
| 155 | static VTGPROBELOC __attribute__((section(VTG_LOC_SECT))) a_VarName
|
---|
| 156 | # else
|
---|
| 157 | # error "Unsupported compiler!"
|
---|
| 158 | # endif
|
---|
| 159 | #endif
|
---|
| 160 |
|
---|
| 161 | /** VTG string table offset. */
|
---|
| 162 | typedef uint32_t VTGSTROFF;
|
---|
| 163 |
|
---|
| 164 |
|
---|
[40878] | 165 | /** @name VTG type flags
|
---|
| 166 | * @{ */
|
---|
| 167 | /** Masking out the fixed size if given. */
|
---|
| 168 | #define VTG_TYPE_SIZE_MASK UINT32_C(0x000000ff)
|
---|
| 169 | /** Indicates that VTG_TYPE_SIZE_MASK can be applied, UNSIGNED or SIGNED is
|
---|
| 170 | * usually set as well, so may PHYS. */
|
---|
| 171 | #define VTG_TYPE_FIXED_SIZED RT_BIT_32(8)
|
---|
| 172 | /** It's a pointer type, the size is given by the context the probe fired in. */
|
---|
| 173 | #define VTG_TYPE_POINTER RT_BIT_32(9)
|
---|
| 174 | /** A context specfic pointer or address, consult VTG_TYPE_CTX_XXX. */
|
---|
| 175 | #define VTG_TYPE_CTX_POINTER RT_BIT_32(10)
|
---|
| 176 | /** The type has the same size as the host architecture. */
|
---|
| 177 | #define VTG_TYPE_HC_ARCH_SIZED RT_BIT_32(11)
|
---|
[54068] | 178 | /** Const char pointer, requires casting in wrapper headers. */
|
---|
| 179 | #define VTG_TYPE_CONST_CHAR_PTR RT_BIT_32(12)
|
---|
[40878] | 180 | /** The type applies to ring-3 context. */
|
---|
| 181 | #define VTG_TYPE_CTX_R3 RT_BIT_32(24)
|
---|
| 182 | /** The type applies to ring-0 context. */
|
---|
| 183 | #define VTG_TYPE_CTX_R0 RT_BIT_32(25)
|
---|
| 184 | /** The type applies to raw-mode context. */
|
---|
| 185 | #define VTG_TYPE_CTX_RC RT_BIT_32(26)
|
---|
| 186 | /** The type applies to guest context. */
|
---|
| 187 | #define VTG_TYPE_CTX_GST RT_BIT_32(27)
|
---|
| 188 | /** The type context mask. */
|
---|
| 189 | #define VTG_TYPE_CTX_MASK UINT32_C(0x0f000000)
|
---|
[41338] | 190 | /** The type is automatically converted to a ring-0 pointer. */
|
---|
| 191 | #define VTG_TYPE_AUTO_CONV_PTR RT_BIT_32(28)
|
---|
[40878] | 192 | /** The type is a physical address. */
|
---|
| 193 | #define VTG_TYPE_PHYS RT_BIT_32(29)
|
---|
| 194 | /** The type is unsigned. */
|
---|
| 195 | #define VTG_TYPE_UNSIGNED RT_BIT_32(30)
|
---|
| 196 | /** The type is signed. */
|
---|
| 197 | #define VTG_TYPE_SIGNED RT_BIT_32(31)
|
---|
[40886] | 198 | /** Mask of valid bits (for simple validation). */
|
---|
[59035] | 199 | #define VTG_TYPE_VALID_MASK UINT32_C(0xff001fff)
|
---|
[40878] | 200 | /** @} */
|
---|
| 201 |
|
---|
[40594] | 202 | /**
|
---|
[40878] | 203 | * Checks if the VTG type flags indicates a large fixed size argument.
|
---|
| 204 | */
|
---|
| 205 | #define VTG_TYPE_IS_LARGE(a_fType) \
|
---|
| 206 | ( ((a_fType) & VTG_TYPE_SIZE_MASK) > 4 && ((a_fType) & VTG_TYPE_FIXED_SIZED) )
|
---|
| 207 |
|
---|
| 208 |
|
---|
| 209 | /**
|
---|
[40594] | 210 | * VTG argument descriptor.
|
---|
| 211 | */
|
---|
| 212 | typedef struct VTGDESCARG
|
---|
| 213 | {
|
---|
| 214 | VTGSTROFF offType;
|
---|
[40878] | 215 | uint32_t fType;
|
---|
[40594] | 216 | } VTGDESCARG;
|
---|
| 217 | /** Pointer to an argument descriptor. */
|
---|
| 218 | typedef VTGDESCARG *PVTGDESCARG;
|
---|
[41117] | 219 | /** Pointer to a const argument descriptor. */
|
---|
| 220 | typedef VTGDESCARG const *PCVTGDESCARG;
|
---|
[40594] | 221 |
|
---|
| 222 |
|
---|
| 223 | /**
|
---|
| 224 | * VTG argument list descriptor.
|
---|
| 225 | */
|
---|
| 226 | typedef struct VTGDESCARGLIST
|
---|
| 227 | {
|
---|
| 228 | uint8_t cArgs;
|
---|
[40878] | 229 | uint8_t fHaveLargeArgs;
|
---|
| 230 | uint8_t abReserved[2];
|
---|
[40594] | 231 | VTGDESCARG aArgs[1];
|
---|
| 232 | } VTGDESCARGLIST;
|
---|
| 233 | /** Pointer to a VTG argument list descriptor. */
|
---|
| 234 | typedef VTGDESCARGLIST *PVTGDESCARGLIST;
|
---|
[41117] | 235 | /** Pointer to a const VTG argument list descriptor. */
|
---|
| 236 | typedef VTGDESCARGLIST const *PCVTGDESCARGLIST;
|
---|
[40594] | 237 |
|
---|
| 238 |
|
---|
| 239 | /**
|
---|
| 240 | * VTG probe descriptor.
|
---|
| 241 | */
|
---|
| 242 | typedef struct VTGDESCPROBE
|
---|
| 243 | {
|
---|
| 244 | VTGSTROFF offName;
|
---|
| 245 | uint32_t offArgList;
|
---|
| 246 | uint16_t idxEnabled;
|
---|
| 247 | uint16_t idxProvider;
|
---|
[40892] | 248 | /** The distance from this structure to the VTG object header. */
|
---|
| 249 | int32_t offObjHdr;
|
---|
[40594] | 250 | } VTGDESCPROBE;
|
---|
[41117] | 251 | AssertCompileSize(VTGDESCPROBE, 16);
|
---|
[40594] | 252 | /** Pointer to a VTG probe descriptor. */
|
---|
| 253 | typedef VTGDESCPROBE *PVTGDESCPROBE;
|
---|
[41117] | 254 | /** Pointer to a const VTG probe descriptor. */
|
---|
| 255 | typedef VTGDESCPROBE const *PCVTGDESCPROBE;
|
---|
[40594] | 256 |
|
---|
| 257 |
|
---|
| 258 | /**
|
---|
[40601] | 259 | * Code/data stability.
|
---|
| 260 | */
|
---|
| 261 | typedef enum kVTGStability
|
---|
| 262 | {
|
---|
| 263 | kVTGStability_Invalid = 0,
|
---|
| 264 | kVTGStability_Internal,
|
---|
| 265 | kVTGStability_Private,
|
---|
| 266 | kVTGStability_Obsolete,
|
---|
| 267 | kVTGStability_External,
|
---|
| 268 | kVTGStability_Unstable,
|
---|
| 269 | kVTGStability_Evolving,
|
---|
| 270 | kVTGStability_Stable,
|
---|
| 271 | kVTGStability_Standard,
|
---|
| 272 | kVTGStability_End
|
---|
| 273 | } kVTGStability;
|
---|
| 274 |
|
---|
| 275 | /**
|
---|
| 276 | * Data dependency.
|
---|
| 277 | */
|
---|
| 278 | typedef enum kVTGClass
|
---|
| 279 | {
|
---|
| 280 | kVTGClass_Invalid = 0,
|
---|
| 281 | kVTGClass_Unknown,
|
---|
| 282 | kVTGClass_Cpu,
|
---|
| 283 | kVTGClass_Platform,
|
---|
| 284 | kVTGClass_Group,
|
---|
| 285 | kVTGClass_Isa,
|
---|
| 286 | kVTGClass_Common,
|
---|
| 287 | kVTGClass_End
|
---|
| 288 | } kVTGClass;
|
---|
| 289 |
|
---|
| 290 |
|
---|
| 291 | /**
|
---|
[40603] | 292 | * VTG attributes.
|
---|
[40594] | 293 | */
|
---|
| 294 | typedef struct VTGDESCATTR
|
---|
| 295 | {
|
---|
[40601] | 296 | uint8_t u8Code;
|
---|
[40594] | 297 | uint8_t u8Data;
|
---|
| 298 | uint8_t u8DataDep;
|
---|
| 299 | } VTGDESCATTR;
|
---|
| 300 | AssertCompileSize(VTGDESCATTR, 3);
|
---|
[40603] | 301 | /** Pointer to a const VTG attribute. */
|
---|
| 302 | typedef VTGDESCATTR const *PCVTGDESCATTR;
|
---|
[40594] | 303 |
|
---|
| 304 |
|
---|
| 305 | /**
|
---|
| 306 | * VTG provider descriptor.
|
---|
| 307 | */
|
---|
| 308 | typedef struct VTGDESCPROVIDER
|
---|
| 309 | {
|
---|
[58976] | 310 | VTGSTROFF offName;
|
---|
| 311 | uint16_t iFirstProbe;
|
---|
| 312 | uint16_t cProbes;
|
---|
| 313 | VTGDESCATTR AttrSelf;
|
---|
| 314 | VTGDESCATTR AttrModules;
|
---|
| 315 | VTGDESCATTR AttrFunctions;
|
---|
| 316 | VTGDESCATTR AttrNames;
|
---|
| 317 | VTGDESCATTR AttrArguments;
|
---|
| 318 | uint8_t bReserved;
|
---|
| 319 | uint32_t volatile cProbesEnabled;
|
---|
| 320 | /** This increases every time a probe is enabled or disabled.
|
---|
| 321 | * Can be used in non-ring-3 context via PROVIDER_GET_SETTINGS_SEQ_NO() in
|
---|
| 322 | * order to only configure probes related stuff when actually required. */
|
---|
| 323 | uint32_t volatile uSettingsSerialNo;
|
---|
[40594] | 324 | } VTGDESCPROVIDER;
|
---|
[58976] | 325 | AssertCompileSize(VTGDESCPROVIDER, 32);
|
---|
[40594] | 326 | /** Pointer to a VTG provider descriptor. */
|
---|
| 327 | typedef VTGDESCPROVIDER *PVTGDESCPROVIDER;
|
---|
[41117] | 328 | /** Pointer to a const VTG provider descriptor. */
|
---|
| 329 | typedef VTGDESCPROVIDER const *PCVTGDESCPROVIDER;
|
---|
[40594] | 330 |
|
---|
| 331 |
|
---|
| 332 | /**
|
---|
| 333 | * VTG data object header.
|
---|
| 334 | */
|
---|
| 335 | typedef struct VTGOBJHDR
|
---|
| 336 | {
|
---|
[41117] | 337 | /** Magic value (VTGOBJHDR_MAGIC). */
|
---|
[40594] | 338 | char szMagic[24];
|
---|
[41117] | 339 | /** The bitness of the structures.
|
---|
| 340 | * This only affects the probe location pointers and structures. */
|
---|
[40594] | 341 | uint32_t cBits;
|
---|
[41117] | 342 | /** The size of the VTG object. This excludes the probe locations. */
|
---|
| 343 | uint32_t cbObj;
|
---|
| 344 |
|
---|
| 345 | /** @name Area Descriptors
|
---|
| 346 | * @remarks The offsets are relative to the header. The members are
|
---|
| 347 | * ordered by ascending offset (maybe with the exception of the
|
---|
| 348 | * probe locations). No overlaps, though there might be zero
|
---|
| 349 | * filled gaps between them due to alignment.
|
---|
| 350 | * @{ */
|
---|
| 351 | /* 32: */
|
---|
| 352 | /** Offset of the string table (char) relative to this header. */
|
---|
| 353 | uint32_t offStrTab;
|
---|
| 354 | /** The size of the string table, in bytes. */
|
---|
| 355 | uint32_t cbStrTab;
|
---|
| 356 | /** Offset of the argument lists (VTGDESCARGLIST - variable size) relative
|
---|
| 357 | * to this header. */
|
---|
| 358 | uint32_t offArgLists;
|
---|
| 359 | /** The size of the argument lists, in bytes. */
|
---|
| 360 | uint32_t cbArgLists;
|
---|
| 361 | /* 48: */
|
---|
| 362 | /** Offset of the probe array (VTGDESCPROBE) relative to this header. */
|
---|
| 363 | uint32_t offProbes;
|
---|
| 364 | /** The size of the probe array, in bytes. */
|
---|
| 365 | uint32_t cbProbes;
|
---|
| 366 | /** Offset of the provider array (VTGDESCPROVIDER) relative to this
|
---|
| 367 | * header. */
|
---|
| 368 | uint32_t offProviders;
|
---|
| 369 | /** The size of the provider array, in bytes. */
|
---|
| 370 | uint32_t cbProviders;
|
---|
| 371 | /* 64: */
|
---|
| 372 | /** Offset of the probe-enabled array (uint32_t) relative to this
|
---|
| 373 | * header. */
|
---|
| 374 | uint32_t offProbeEnabled;
|
---|
| 375 | /** The size of the probe-enabled array, in bytes. */
|
---|
| 376 | uint32_t cbProbeEnabled;
|
---|
| 377 | /** Offset of the probe location array (VTGPROBELOC) relative to this
|
---|
| 378 | * header.
|
---|
| 379 | * @remarks This is filled in by the first VTG user using uProbeLocs. */
|
---|
| 380 | int32_t offProbeLocs;
|
---|
| 381 | /** The size of the probe location array, in bytes.
|
---|
| 382 | * @remarks This is filled in by the first VTG user using uProbeLocs. */
|
---|
| 383 | uint32_t cbProbeLocs;
|
---|
| 384 | /** @} */
|
---|
| 385 | /* 80: */
|
---|
| 386 | /**
|
---|
| 387 | * The probe location array is generated by C code and lives in a
|
---|
| 388 | * different section/subsection/segment than the rest of the data.
|
---|
| 389 | *
|
---|
| 390 | * The assembler cannot generate offsets across sections for most (if not
|
---|
| 391 | * all) object formats, so we have to store pointers here. The first user
|
---|
| 392 | * of the data will convert these two members into offset and size and fill
|
---|
| 393 | * in the offProbeLocs and cbProbeLocs members above.
|
---|
| 394 | *
|
---|
| 395 | * @remarks Converting these members to offset+size and reusing the members
|
---|
| 396 | * to store the converted values isn't possible because of
|
---|
| 397 | * raw-mode context modules having relocations associated with the
|
---|
| 398 | * fields.
|
---|
| 399 | */
|
---|
| 400 | union
|
---|
| 401 | {
|
---|
| 402 | PVTGPROBELOC p;
|
---|
| 403 | uintptr_t uPtr;
|
---|
| 404 | uint32_t u32;
|
---|
| 405 | uint64_t u64;
|
---|
| 406 | }
|
---|
| 407 | /** Pointer to the probe location array. */
|
---|
| 408 | uProbeLocs,
|
---|
| 409 | /** Pointer to the end of the probe location array. */
|
---|
| 410 | uProbeLocsEnd;
|
---|
| 411 | /** UUID for making sharing ring-0 structures for the same ring-3
|
---|
| 412 | * modules easier. */
|
---|
| 413 | RTUUID Uuid;
|
---|
[41311] | 414 | /** Mac 10.6.x load workaround.
|
---|
| 415 | * The linker or/and load messes up the uProbeLocs and uProbeLocsEnd fields
|
---|
| 416 | * so that they will be link addresses instead of load addresses. To be
|
---|
| 417 | * able to work around it we store the start address of the __VTGObj section
|
---|
| 418 | * here and uses it to validate the probe location addresses. */
|
---|
| 419 | uint64_t u64VtgObjSectionStart;
|
---|
[41117] | 420 | /** Reserved / alignment. */
|
---|
[41311] | 421 | uint32_t au32Reserved1[2];
|
---|
[40594] | 422 | } VTGOBJHDR;
|
---|
[41117] | 423 | AssertCompileSize(VTGOBJHDR, 128);
|
---|
| 424 | AssertCompileMemberAlignment(VTGOBJHDR, uProbeLocs, 8);
|
---|
| 425 | AssertCompileMemberAlignment(VTGOBJHDR, uProbeLocsEnd, 8);
|
---|
[40594] | 426 | /** Pointer to a VTG data object header. */
|
---|
| 427 | typedef VTGOBJHDR *PVTGOBJHDR;
|
---|
[41117] | 428 | /** Pointer to a const VTG data object header. */
|
---|
| 429 | typedef VTGOBJHDR const *PCVTGOBJHDR;
|
---|
[40594] | 430 |
|
---|
| 431 | /** The current VTGOBJHDR::szMagic value. */
|
---|
[58976] | 432 | #define VTGOBJHDR_MAGIC "VTG Object Header v1.7\0"
|
---|
[40594] | 433 |
|
---|
| 434 | /** The name of the VTG data object header symbol in the object file. */
|
---|
| 435 | extern VTGOBJHDR g_VTGObjHeader;
|
---|
| 436 |
|
---|
[41338] | 437 |
|
---|
| 438 | /** @name Macros for converting typical pointer arguments to ring-0 pointers.
|
---|
| 439 | * @{ */
|
---|
| 440 | #ifdef IN_RING0
|
---|
| 441 | # define VTG_VM_TO_R0(a_pVM) (a_pVM)
|
---|
| 442 | # define VTG_VMCPU_TO_R0(a_pVCpu) (a_pVCpu)
|
---|
| 443 | # define VTG_CPUMCTX_TO_R0(a_pVCpu, a_pCtx) (a_pCtx)
|
---|
[80338] | 444 | #else
|
---|
[80319] | 445 | # define VTG_VM_TO_R0(a_pVM) ((a_pVM) ? (a_pVM)->pVMR0ForCall : NIL_RTR0PTR)
|
---|
| 446 | # define VTG_VMCPU_TO_R0(a_pVCpu) ((a_pVCpu) ? (a_pVCpu)->pVCpuR0ForVtg : NIL_RTR0PTR)
|
---|
| 447 | # define VTG_CPUMCTX_TO_R0(a_pVCpu, a_pCtx) ((a_pVCpu) ? (a_pVCpu)->pVCpuR0ForVtg + ((uintptr_t)(a_pCtx) - (uintptr_t)(a_pVCpu)) : NIL_RTR0PTR)
|
---|
[41338] | 448 | #endif
|
---|
| 449 | /** @} */
|
---|
| 450 |
|
---|
| 451 |
|
---|
[40594] | 452 | RT_C_DECLS_END
|
---|
| 453 |
|
---|
[76585] | 454 | #endif /* !VBOX_INCLUDED_VBoxTpG_h */
|
---|
[40594] | 455 |
|
---|