VBoxTpG.h revision 23d8f7aff045c2bade1b168fee79a3e4749e2345
/* $Id$ */
/** @file
* VBox Tracepoint Generator Structures.
*/
/*
* Copyright (C) 2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_VTG_h___
#define ___VBox_VTG_h___
/**
* 32-bit probe location.
*/
typedef struct VTGPROBELOC32
{
/** Pointer to a 32-bit probe location. */
typedef VTGPROBELOC32 *PVTGPROBELOC32;
/** Pointer to a const 32-bit probe location. */
typedef VTGPROBELOC32 const *PCVTGPROBELOC32;
/**
* 64-bit probe location.
*/
typedef struct VTGPROBELOC64
{
/** Pointer to a 64-bit probe location. */
typedef VTGPROBELOC64 *PVTGPROBELOC64;
/** Pointer to a const 64-bit probe location. */
typedef VTGPROBELOC64 const *PCVTGPROBELOC64;
/**
* Probe location.
*/
typedef struct VTGPROBELOC
{
const char *pszFunction;
#if ARCH_BITS == 64
#endif
} VTGPROBELOC;
/** Pointer to a probe location. */
typedef VTGPROBELOC *PVTGPROBELOC;
/** Pointer to a const probe location. */
typedef VTGPROBELOC const *PCVTGPROBELOC;
/** @def VTG_OBJ_SECT
* The name of the section containing the other probe data provided by the
* assembly / object generated by VBoxTpG. */
/** @def VTG_LOC_SECT
* The name of the section containing the VTGPROBELOC structures. This is
* filled by the probe macros, @see VTG_DECL_VTGPROBELOC. */
/** @def VTG_DECL_VTGPROBELOC
* Declares a static variable, @a a_VarName, of type VTGPROBELOC in the section
* indicated by VTG_LOC_SECT. */
#if defined(RT_OS_WINDOWS)
# define VTG_OBJ_SECT "VTGObj"
# define VTG_LOC_SECT "VTGPrLc.Data"
# ifdef _MSC_VER
# define VTG_DECL_VTGPROBELOC(a_VarName) \
# define VTG_DECL_VTGPROBELOC(a_VarName) \
# else
# error "Unsupported Windows compiler!"
# endif
#elif defined(RT_OS_DARWIN)
# define VTG_OBJ_SECT "__VTGObj"
# define VTG_LOC_SECT "__VTGPrLc"
# define VTG_LOC_SEG "__VTG"
# ifdef __GNUC__
# define VTG_DECL_VTGPROBELOC(a_VarName) \
static VTGPROBELOC __attribute__((section(VTG_LOC_SEG "," VTG_LOC_SECT ",regular")/*, aligned(16)*/)) a_VarName
# else
# error "Unsupported Darwin compiler!"
# endif
# error "OS/2 is not supported"
#else /* Assume the rest uses ELF. */
# define VTG_OBJ_SECT ".VTGObj"
# define VTG_LOC_SECT ".VTGPrLc"
# ifdef __GNUC__
# define VTG_DECL_VTGPROBELOC(a_VarName) \
# else
# error "Unsupported compiler!"
# endif
#endif
/** VTG string table offset. */
/** @name VTG type flags
* @{ */
/** Masking out the fixed size if given. */
/** Indicates that VTG_TYPE_SIZE_MASK can be applied, UNSIGNED or SIGNED is
* usually set as well, so may PHYS. */
/** It's a pointer type, the size is given by the context the probe fired in. */
/** A context specfic pointer or address, consult VTG_TYPE_CTX_XXX. */
/** The type has the same size as the host architecture. */
/** The type applies to ring-3 context. */
/** The type applies to ring-0 context. */
/** The type applies to raw-mode context. */
/** The type applies to guest context. */
/** The type context mask. */
/** The type is a physical address. */
/** The type is unsigned. */
/** The type is signed. */
/** Mask of valid bits (for simple validation). */
/** @} */
/**
* Checks if the VTG type flags indicates a large fixed size argument.
*/
#define VTG_TYPE_IS_LARGE(a_fType) \
/**
* VTG argument descriptor.
*/
typedef struct VTGDESCARG
{
} VTGDESCARG;
/** Pointer to an argument descriptor. */
typedef VTGDESCARG *PVTGDESCARG;
/** Pointer to a const argument descriptor. */
typedef VTGDESCARG const *PCVTGDESCARG;
/**
* VTG argument list descriptor.
*/
typedef struct VTGDESCARGLIST
{
/** Pointer to a VTG argument list descriptor. */
typedef VTGDESCARGLIST *PVTGDESCARGLIST;
/** Pointer to a const VTG argument list descriptor. */
typedef VTGDESCARGLIST const *PCVTGDESCARGLIST;
/**
* VTG probe descriptor.
*/
typedef struct VTGDESCPROBE
{
/** The distance from this structure to the VTG object header. */
} VTGDESCPROBE;
/** Pointer to a VTG probe descriptor. */
typedef VTGDESCPROBE *PVTGDESCPROBE;
/** Pointer to a const VTG probe descriptor. */
typedef VTGDESCPROBE const *PCVTGDESCPROBE;
/**
*/
typedef enum kVTGStability
{
/**
* Data dependency.
*/
typedef enum kVTGClass
{
kVTGClass_Invalid = 0,
} kVTGClass;
/**
* VTG attributes.
*/
typedef struct VTGDESCATTR
{
} VTGDESCATTR;
/** Pointer to a const VTG attribute. */
typedef VTGDESCATTR const *PCVTGDESCATTR;
/**
* VTG provider descriptor.
*/
typedef struct VTGDESCPROVIDER
{
/** Pointer to a VTG provider descriptor. */
typedef VTGDESCPROVIDER *PVTGDESCPROVIDER;
/** Pointer to a const VTG provider descriptor. */
typedef VTGDESCPROVIDER const *PCVTGDESCPROVIDER;
/**
* VTG data object header.
*/
typedef struct VTGOBJHDR
{
/** Magic value (VTGOBJHDR_MAGIC). */
char szMagic[24];
/** The bitness of the structures.
* This only affects the probe location pointers and structures. */
/** The size of the VTG object. This excludes the probe locations. */
/** @name Area Descriptors
* @remarks The offsets are relative to the header. The members are
* ordered by ascending offset (maybe with the exception of the
* probe locations). No overlaps, though there might be zero
* filled gaps between them due to alignment.
* @{ */
/* 32: */
/** Offset of the string table (char) relative to this header. */
/** The size of the string table, in bytes. */
/** Offset of the argument lists (VTGDESCARGLIST - variable size) relative
* to this header. */
/** The size of the argument lists, in bytes. */
/* 48: */
/** Offset of the probe array (VTGDESCPROBE) relative to this header. */
/** The size of the probe array, in bytes. */
/** Offset of the provider array (VTGDESCPROVIDER) relative to this
* header. */
/** The size of the provider array, in bytes. */
/* 64: */
/** Offset of the probe-enabled array (uint32_t) relative to this
* header. */
/** The size of the probe-enabled array, in bytes. */
/** Offset of the probe location array (VTGPROBELOC) relative to this
* header.
* @remarks This is filled in by the first VTG user using uProbeLocs. */
/** The size of the probe location array, in bytes.
* @remarks This is filled in by the first VTG user using uProbeLocs. */
/** @} */
/* 80: */
/**
* The probe location array is generated by C code and lives in a
* different section/subsection/segment than the rest of the data.
*
* The assembler cannot generate offsets across sections for most (if not
* all) object formats, so we have to store pointers here. The first user
* of the data will convert these two members into offset and size and fill
* in the offProbeLocs and cbProbeLocs members above.
*
* @remarks Converting these members to offset+size and reusing the members
* to store the converted values isn't possible because of
* raw-mode context modules having relocations associated with the
* fields.
*/
union
{
PVTGPROBELOC p;
}
/** Pointer to the probe location array. */
/** Pointer to the end of the probe location array. */
/** UUID for making sharing ring-0 structures for the same ring-3
* modules easier. */
/** Reserved / alignment. */
} VTGOBJHDR;
/** Pointer to a VTG data object header. */
typedef VTGOBJHDR *PVTGOBJHDR;
/** Pointer to a const VTG data object header. */
typedef VTGOBJHDR const *PCVTGOBJHDR;
/** The current VTGOBJHDR::szMagic value. */
#define VTGOBJHDR_MAGIC "VTG Object Header v1.5\0"
/** The name of the VTG data object header symbol in the object file. */
extern VTGOBJHDR g_VTGObjHeader;
#endif