types.h revision e6dddefe0a0a7b4be93b2692b2e956852fa8cb9c
/** @file
* IPRT - Types.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___iprt_types_h
#define ___iprt_types_h
/*
* Include standard C types.
*/
#ifndef IPRT_NO_CRT
# if defined(RT_OS_DARWIN) && defined(KERNEL)
/*
* Kludge for the darwin kernel:
* stddef.h is missing IIRC.
*/
# ifndef _PTRDIFF_T
# define _PTRDIFF_T
typedef __darwin_ptrdiff_t ptrdiff_t;
# endif
/*
* Kludge for the FreeBSD kernel:
* when compiling in kernel mode. This is just to make GCC shut up.
*/
# ifndef _STDDEF_H_
# endif
# ifndef _SYS_TYPES_H_
# endif
# ifndef offsetof
# error "offsetof is not defined..."
# endif
/*
* Kludge for compiling 32-bit code on a 64-bit FreeBSD:
* FreeBSD declares uint64_t and int64_t wrong (long unsigned and long int
* though they need to be long long unsigned and long long int). These
* defines conflict with our decleration in stdint.h. Adding the defines
* below omits the definitions in the system header.
*/
# include <stddef.h>
# define _UINT64_T_DECLARED
# define _INT64_T_DECLARED
/*
* Kludge for the linux kernel:
* declares false and true as enum values.
* We work around these issues here and nowhere else.
*/
# include <stddef.h>
# if defined(__cplusplus)
typedef bool _Bool;
# endif
# define bool linux_bool
# define true linux_true
# define false linux_false
# define uintptr_t linux_uintptr_t
# include <linux/autoconf.h>
# undef false
# undef true
# undef bool
# else
# include <stddef.h>
# endif
# ifdef _MSC_VER
# endif
#else /* no crt */
#endif /* no crt */
/** @defgroup grp_rt_types IPRT Base Types
* @{
*/
/* define wchar_t, we don't wanna include all the wcsstuff to get this. */
#ifdef _MSC_VER
# ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
# define _WCHAR_T_DEFINED
# endif
#endif
#ifdef __GNUC__
/** @todo wchar_t on GNUC */
#endif
/*
* C doesn't have bool.
*/
#ifndef __cplusplus
# if defined(__GNUC__)
typedef uint8_t bool;
# else
# if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
# undef bool
# endif
typedef _Bool bool;
# endif
# else
typedef unsigned char bool;
# endif
# ifndef true
# define true (1)
# endif
# ifndef false
# define false (0)
# endif
#endif
/**
* 128-bit unsigned integer.
*/
#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
typedef __uint128_t uint128_t;
#else
typedef struct uint128_s
{
} uint128_t;
#endif
/**
* 128-bit signed integer.
*/
#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
typedef __int128_t int128_t;
#else
typedef struct int128_s
{
} int128_t;
#endif
/**
* 16-bit unsigned integer union.
*/
typedef union RTUINT16U
{
/** natural view. */
uint16_t u;
/** 16-bit view. */
/** 8-bit view. */
struct
{
} s;
} RTUINT16U;
/** Pointer to a 16-bit unsigned integer union. */
typedef RTUINT16U *PRTUINT16U;
/** Pointer to a const 32-bit unsigned integer union. */
typedef const RTUINT16U *PCRTUINT16U;
/**
* 32-bit unsigned integer union.
*/
typedef union RTUINT32U
{
/** natural view. */
uint32_t u;
struct
{
} s;
/** Word view. */
struct
{
} Words;
/** 32-bit view. */
/** 16-bit view. */
/** 8-bit view. */
} RTUINT32U;
/** Pointer to a 32-bit unsigned integer union. */
typedef RTUINT32U *PRTUINT32U;
/** Pointer to a const 32-bit unsigned integer union. */
typedef const RTUINT32U *PCRTUINT32U;
/**
* 64-bit unsigned integer union.
*/
typedef union RTUINT64U
{
/** Natural view. */
uint64_t u;
struct
{
} s;
/** Double-Word view. */
struct
{
} DWords;
/** Word view. */
struct
{
} Words;
/** 64-bit view. */
/** 32-bit view. */
/** 16-bit view. */
/** 8-bit view. */
} RTUINT64U;
/** Pointer to a 64-bit unsigned integer union. */
typedef RTUINT64U *PRTUINT64U;
/** Pointer to a const 64-bit unsigned integer union. */
typedef const RTUINT64U *PCRTUINT64U;
/**
* 128-bit unsigned integer union.
*/
typedef union RTUINT128U
{
/** Natural view.
* WARNING! This member depends on the compiler supporting 128-bit stuff. */
uint128_t u;
struct
{
} s;
/** Quad-Word view. */
struct
{
} QWords;
/** Double-Word view. */
struct
{
} DWords;
/** Word view. */
struct
{
} Words;
/** 64-bit view. */
/** 32-bit view. */
/** 16-bit view. */
/** 8-bit view. */
} RTUINT128U;
/** Pointer to a 64-bit unsigned integer union. */
typedef RTUINT128U *PRTUINT128U;
/** Pointer to a const 64-bit unsigned integer union. */
typedef const RTUINT128U *PCRTUINT128U;
/** Generic function type.
* @see PFNRT
*/
typedef DECLCALLBACK(void) FNRT(void);
/** Generic function pointer.
* With -pedantic, gcc-4 complains when casting a function to a data object, for example
*
* @code
* void foo(void)
* {
* }
*
* void *bar = (void *)foo;
* @endcode
*
* The compiler would warn with "ISO C++ forbids casting between pointer-to-function and
* pointer-to-object". The purpose of this warning is not to bother the programmer but to
* point out that he is probably doing something dangerous, assigning a pointer to executable
* code to a data object.
*/
/** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
* @ingroup grp_rt_types
* @{
*/
/** Signed integer which can contain both GC and HC pointers. */
#else
#endif
/** Pointer to signed integer which can contain both GC and HC pointers. */
/** Pointer const to signed integer which can contain both GC and HC pointers. */
typedef const RTINTPTR *PCRTINTPTR;
/** Unsigned integer which can contain both GC and HC pointers. */
#else
#endif
/** Pointer to unsigned integer which can contain both GC and HC pointers. */
typedef RTUINTPTR *PRTUINTPTR;
/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
typedef const RTUINTPTR *PCRTUINTPTR;
/** The maximum value the RTUINTPTR type can hold. */
# define RTUINTPTR_MAX UINT32_MAX
# define RTUINTPTR_MAX UINT64_MAX
#else
#endif
/** Signed integer. */
/** Pointer to signed integer. */
/** Pointer to const signed integer. */
/** Unsigned integer. */
/** Pointer to unsigned integer. */
/** Pointer to const unsigned integer. */
/** A file offset / size (off_t). */
/** Pointer to a file offset / size. */
/** The max value for RTFOFF. */
#define RTFOFF_MAX INT64_MAX
/** The min value for RTFOFF. */
#define RTFOFF_MIN INT64_MIN
/** Pointer to file mode. */
/** Device unix number. */
/** Pointer to a device unix number. */
/** i-node number. */
/** Pointer to a i-node number. */
/** User id. */
/** Pointer to a user id. */
/** NIL user id.
* @todo check this for portability! */
/** Group id. */
/** Pointer to a group id. */
/** NIL group id.
* @todo check this for portability! */
/** I/O Port. */
/** Pointer to I/O Port. */
/** Pointer to const I/O Port. */
typedef const RTIOPORT *PCRTIOPORT;
/** Selector. */
/** Pointer to selector. */
/** Pointer to const selector. */
/** Max selector value. */
#define RTSEL_MAX UINT16_MAX
/** Far 16-bit pointer. */
#pragma pack(1)
typedef struct RTFAR16
{
} RTFAR16;
#pragma pack()
/** Pointer to Far 16-bit pointer. */
/** Pointer to const Far 16-bit pointer. */
/** Far 32-bit pointer. */
#pragma pack(1)
typedef struct RTFAR32
{
} RTFAR32;
#pragma pack()
/** Pointer to Far 32-bit pointer. */
/** Pointer to const Far 32-bit pointer. */
/** Far 64-bit pointer. */
#pragma pack(1)
typedef struct RTFAR64
{
} RTFAR64;
#pragma pack()
/** Pointer to Far 64-bit pointer. */
/** Pointer to const Far 64-bit pointer. */
/** @} */
/** @defgroup grp_rt_types_hc Host Context Basic Types
* @ingroup grp_rt_types
* @{
*/
/** HC Natural signed integer.
* @deprecated silly type. */
/** Pointer to HC Natural signed integer.
* @deprecated silly type. */
/** Pointer to const HC Natural signed integer.
* @deprecated silly type. */
/** HC Natural unsigned integer.
* @deprecated silly type. */
/** Pointer to HC Natural unsigned integer.
* @deprecated silly type. */
/** Pointer to const HC Natural unsigned integer.
* @deprecated silly type. */
typedef const RTHCUINT *PCRTHCUINT;
/** Signed integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32
typedef int32_t RTHCINTPTR;
typedef int64_t RTHCINTPTR;
#else
#endif
/** Pointer to signed integer which can contain a HC pointer. */
typedef RTHCINTPTR *PRTHCINTPTR;
/** Pointer to const signed integer which can contain a HC pointer. */
typedef const RTHCINTPTR *PCRTHCINTPTR;
/** Max RTHCINTPTR value. */
#if HC_ARCH_BITS == 32
# define RTHCINTPTR_MAX INT32_MAX
#else
# define RTHCINTPTR_MAX INT64_MAX
#endif
/** Min RTHCINTPTR value. */
#if HC_ARCH_BITS == 32
# define RTHCINTPTR_MIN INT32_MIN
#else
# define RTHCINTPTR_MIN INT64_MIN
#endif
/** Signed integer which can contain a HC ring-3 pointer. */
#if R3_ARCH_BITS == 32
typedef int32_t RTR3INTPTR;
typedef int64_t RTR3INTPTR;
#else
#endif
/** Pointer to signed integer which can contain a HC ring-3 pointer. */
typedef RTR3INTPTR *PRTR3INTPTR;
/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
typedef const RTR3INTPTR *PCRTR3INTPTR;
/** Max RTR3INTPTR value. */
#if R3_ARCH_BITS == 32
# define RTR3INTPTR_MAX INT32_MAX
#else
# define RTR3INTPTR_MAX INT64_MAX
#endif
/** Min RTR3INTPTR value. */
#if R3_ARCH_BITS == 32
# define RTR3INTPTR_MIN INT32_MIN
#else
# define RTR3INTPTR_MIN INT64_MIN
#endif
/** Signed integer which can contain a HC ring-0 pointer. */
#if R0_ARCH_BITS == 32
typedef int32_t RTR0INTPTR;
typedef int64_t RTR0INTPTR;
#else
#endif
/** Pointer to signed integer which can contain a HC ring-0 pointer. */
typedef RTR0INTPTR *PRTR0INTPTR;
/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
typedef const RTR0INTPTR *PCRTR0INTPTR;
/** Max RTR0INTPTR value. */
#if R0_ARCH_BITS == 32
# define RTR0INTPTR_MAX INT32_MAX
#else
# define RTR0INTPTR_MAX INT64_MAX
#endif
/** Min RTHCINTPTR value. */
#if R0_ARCH_BITS == 32
# define RTR0INTPTR_MIN INT32_MIN
#else
# define RTR0INTPTR_MIN INT64_MIN
#endif
/** Unsigned integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32
typedef uint32_t RTHCUINTPTR;
typedef uint64_t RTHCUINTPTR;
#else
#endif
/** Pointer to unsigned integer which can contain a HC pointer. */
typedef RTHCUINTPTR *PRTHCUINTPTR;
/** Pointer to unsigned integer which can contain a HC pointer. */
typedef const RTHCUINTPTR *PCRTHCUINTPTR;
/** Max RTHCUINTTPR value. */
#if HC_ARCH_BITS == 32
# define RTHCUINTPTR_MAX UINT32_MAX
#else
# define RTHCUINTPTR_MAX UINT64_MAX
#endif
/** Unsigned integer which can contain a HC ring-3 pointer. */
#if R3_ARCH_BITS == 32
typedef uint32_t RTR3UINTPTR;
typedef uint64_t RTR3UINTPTR;
#else
#endif
/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
typedef RTR3UINTPTR *PRTR3UINTPTR;
/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
typedef const RTR3UINTPTR *PCRTR3UINTPTR;
/** Max RTHCUINTTPR value. */
#if R3_ARCH_BITS == 32
# define RTR3UINTPTR_MAX UINT32_MAX
#else
# define RTR3UINTPTR_MAX UINT64_MAX
#endif
/** Unsigned integer which can contain a HC ring-0 pointer. */
#if R0_ARCH_BITS == 32
typedef uint32_t RTR0UINTPTR;
typedef uint64_t RTR0UINTPTR;
#else
#endif
/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
typedef RTR0UINTPTR *PRTR0UINTPTR;
/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
typedef const RTR0UINTPTR *PCRTR0UINTPTR;
/** Max RTR0UINTTPR value. */
#if HC_ARCH_BITS == 32
# define RTR0UINTPTR_MAX UINT32_MAX
#else
# define RTR0UINTPTR_MAX UINT64_MAX
#endif
/** Host Physical Memory Address. */
/** Pointer to Host Physical Memory Address. */
/** Pointer to const Host Physical Memory Address. */
typedef const RTHCPHYS *PCRTHCPHYS;
/** @def NIL_RTHCPHYS
* NIL HC Physical Address.
* NIL_RTHCPHYS is used to signal an invalid physical address, similar
* to the NULL pointer.
*/
#define NIL_RTHCPHYS (~(RTHCPHYS)0)
/** Max RTHCPHYS value. */
#define RTHCPHYS_MAX UINT64_MAX
/** HC pointer. */
#ifndef IN_RC
typedef void * RTHCPTR;
#else
typedef RTHCUINTPTR RTHCPTR;
#endif
/** Pointer to HC pointer. */
/** Pointer to const HC pointer. */
/** @def NIL_RTHCPTR
* NIL HC pointer.
*/
#define NIL_RTHCPTR ((RTHCPTR)0)
/** Max RTHCPTR value. */
/** HC ring-3 pointer. */
#ifdef IN_RING3
typedef void * RTR3PTR;
#else
typedef RTR3UINTPTR RTR3PTR;
#endif
/** Pointer to HC ring-3 pointer. */
/** Pointer to const HC ring-3 pointer. */
/** @def NIL_RTR3PTR
* NIL HC ring-3 pointer.
*/
#define NIL_RTR3PTR ((RTR3PTR)0)
/** Max RTR3PTR value. */
/** HC ring-0 pointer. */
#ifdef IN_RING0
typedef void * RTR0PTR;
#else
typedef RTR0UINTPTR RTR0PTR;
#endif
/** Pointer to HC ring-0 pointer. */
/** Pointer to const HC ring-0 pointer. */
/** @def NIL_RTR0PTR
* NIL HC ring-0 pointer.
*/
#define NIL_RTR0PTR ((RTR0PTR)0)
/** Max RTR3PTR value. */
/** Unsigned integer register in the host context. */
#if HC_ARCH_BITS == 32
typedef uint32_t RTHCUINTREG;
typedef uint64_t RTHCUINTREG;
#else
# error "Unsupported HC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host context. */
typedef RTHCUINTREG *PRTHCUINTREG;
/** Pointer to a const unsigned integer register in the host context. */
typedef const RTHCUINTREG *PCRTHCUINTREG;
/** Unsigned integer register in the host ring-3 context. */
#if R3_ARCH_BITS == 32
typedef uint32_t RTR3UINTREG;
typedef uint64_t RTR3UINTREG;
#else
# error "Unsupported R3_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host ring-3 context. */
typedef RTR3UINTREG *PRTR3UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
typedef const RTR3UINTREG *PCRTR3UINTREG;
/** Unsigned integer register in the host ring-3 context. */
#if R0_ARCH_BITS == 32
typedef uint32_t RTR0UINTREG;
typedef uint64_t RTR0UINTREG;
#else
# error "Unsupported R3_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host ring-3 context. */
typedef RTR0UINTREG *PRTR0UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
typedef const RTR0UINTREG *PCRTR0UINTREG;
/** @} */
/** @defgroup grp_rt_types_gc Guest Context Basic Types
* @ingroup grp_rt_types
* @{
*/
/** Natural signed integer in the GC.
* @deprecated silly type. */
#if GC_ARCH_BITS == 32
#endif
/** Pointer to natural signed integer in GC.
* @deprecated silly type. */
/** Pointer to const natural signed integer in GC.
* @deprecated silly type. */
/** Natural unsigned integer in the GC.
* @deprecated silly type. */
#if GC_ARCH_BITS == 32
#endif
/** Pointer to natural unsigned integer in GC.
* @deprecated silly type. */
/** Pointer to const natural unsigned integer in GC.
* @deprecated silly type. */
typedef const RTGCUINT *PCRTGCUINT;
/** Signed integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
typedef int32_t RTGCINTPTR;
typedef int64_t RTGCINTPTR;
#endif
/** Pointer to signed integer which can contain a GC pointer. */
typedef RTGCINTPTR *PRTGCINTPTR;
/** Pointer to const signed integer which can contain a GC pointer. */
typedef const RTGCINTPTR *PCRTGCINTPTR;
/** Unsigned integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
typedef uint32_t RTGCUINTPTR;
typedef uint64_t RTGCUINTPTR;
#else
#endif
/** Pointer to unsigned integer which can contain a GC pointer. */
typedef RTGCUINTPTR *PRTGCUINTPTR;
/** Pointer to unsigned integer which can contain a GC pointer. */
typedef const RTGCUINTPTR *PCRTGCUINTPTR;
/** Unsigned integer which can contain a 32 bits GC pointer. */
typedef uint32_t RTGCUINTPTR32;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;
/** Unsigned integer which can contain a 64 bits GC pointer. */
typedef uint64_t RTGCUINTPTR64;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
/** Guest Physical Memory Address.*/
/** Pointer to Guest Physical Memory Address. */
/** Pointer to const Guest Physical Memory Address. */
typedef const RTGCPHYS *PCRTGCPHYS;
/** @def NIL_RTGCPHYS
* NIL GC Physical Address.
* NIL_RTGCPHYS is used to signal an invalid physical address, similar
* to the NULL pointer. Note that this value may actually be valid in
* some contexts.
*/
#define NIL_RTGCPHYS (~(RTGCPHYS)0U)
/** Max guest physical memory address value. */
#define RTGCPHYS_MAX UINT64_MAX
/** Guest Physical Memory Address; limited to 32 bits.*/
typedef uint32_t RTGCPHYS32;
/** Pointer to Guest Physical Memory Address. */
typedef RTGCPHYS32 *PRTGCPHYS32;
/** Pointer to const Guest Physical Memory Address. */
typedef const RTGCPHYS32 *PCRTGCPHYS32;
/** @def NIL_RTGCPHYS32
* NIL GC Physical Address.
* NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
* to the NULL pointer. Note that this value may actually be valid in
* some contexts.
*/
#define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
/** Guest Physical Memory Address; limited to 64 bits.*/
typedef uint64_t RTGCPHYS64;
/** Pointer to Guest Physical Memory Address. */
typedef RTGCPHYS64 *PRTGCPHYS64;
/** Pointer to const Guest Physical Memory Address. */
typedef const RTGCPHYS64 *PCRTGCPHYS64;
/** @def NIL_RTGCPHYS64
* NIL GC Physical Address.
* NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
* to the NULL pointer. Note that this value may actually be valid in
* some contexts.
*/
#define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
/** Guest context pointer, 32 bits.
* Keep in mind that this type is an unsigned integer in
* HC and void pointer in GC.
*/
typedef RTGCUINTPTR32 RTGCPTR32;
/** Pointer to a guest context pointer. */
typedef RTGCPTR32 *PRTGCPTR32;
/** Pointer to a const guest context pointer. */
typedef const RTGCPTR32 *PCRTGCPTR32;
/** @def NIL_RTGCPTR32
* NIL GC pointer.
*/
#define NIL_RTGCPTR32 ((RTGCPTR32)0)
/** Guest context pointer, 64 bits.
*/
typedef RTGCUINTPTR64 RTGCPTR64;
/** Pointer to a guest context pointer. */
typedef RTGCPTR64 *PRTGCPTR64;
/** Pointer to a const guest context pointer. */
typedef const RTGCPTR64 *PCRTGCPTR64;
/** @def NIL_RTGCPTR64
* NIL GC pointer.
*/
#define NIL_RTGCPTR64 ((RTGCPTR64)0)
/** Guest context pointer.
* Keep in mind that this type is an unsigned integer in
* HC and void pointer in GC.
*/
#if GC_ARCH_BITS == 64
/** Pointer to a guest context pointer. */
typedef PRTGCPTR64 PRTGCPTR;
/** Pointer to a const guest context pointer. */
typedef PCRTGCPTR64 PCRTGCPTR;
/** @def NIL_RTGCPTR
* NIL GC pointer.
*/
# define NIL_RTGCPTR NIL_RTGCPTR64
/** Max RTGCPTR value. */
# define RTGCPTR_MAX UINT64_MAX
/** Pointer to a guest context pointer. */
typedef PRTGCPTR32 PRTGCPTR;
/** Pointer to a const guest context pointer. */
typedef PCRTGCPTR32 PCRTGCPTR;
/** @def NIL_RTGCPTR
* NIL GC pointer.
*/
# define NIL_RTGCPTR NIL_RTGCPTR32
/** Max RTGCPTR value. */
# define RTGCPTR_MAX UINT32_MAX
#else
# error "Unsupported GC_ARCH_BITS!"
#endif
/** Unsigned integer register in the guest context. */
typedef uint32_t RTGCUINTREG32;
/** Pointer to an unsigned integer register in the guest context. */
typedef RTGCUINTREG32 *PRTGCUINTREG32;
/** Pointer to a const unsigned integer register in the guest context. */
typedef const RTGCUINTREG32 *PCRTGCUINTREG32;
typedef uint64_t RTGCUINTREG64;
/** Pointer to an unsigned integer register in the guest context. */
typedef RTGCUINTREG64 *PRTGCUINTREG64;
/** Pointer to a const unsigned integer register in the guest context. */
typedef const RTGCUINTREG64 *PCRTGCUINTREG64;
#if GC_ARCH_BITS == 64
typedef RTGCUINTREG64 RTGCUINTREG;
typedef RTGCUINTREG32 RTGCUINTREG;
#else
# error "Unsupported GC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the guest context. */
typedef RTGCUINTREG *PRTGCUINTREG;
/** Pointer to a const unsigned integer register in the guest context. */
typedef const RTGCUINTREG *PCRTGCUINTREG;
/** @} */
/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
* @ingroup grp_rt_types
* @{
*/
/** Raw mode context pointer; a 32 bits guest context pointer.
* Keep in mind that this type is an unsigned integer in
* HC and void pointer in RC.
*/
#ifdef IN_RC
typedef void * RTRCPTR;
#else
#endif
/** Pointer to a raw mode context pointer. */
/** Pointer to a const raw mode context pointer. */
/** @def NIL_RTGCPTR
* NIL RC pointer.
*/
#define NIL_RTRCPTR ((RTRCPTR)0)
/** @def RTRCPTR_MAX
* The maximum value a RTRCPTR can have. Mostly used as INVALID value.
*/
/** Raw mode context pointer, unsigned integer variant. */
typedef int32_t RTRCINTPTR;
/** @def RTRCUINPTR_MAX
* The maximum value a RTRCUINPTR can have.
*/
/** Raw mode context pointer, signed integer variant. */
typedef uint32_t RTRCUINTPTR;
/** @def RTRCINPTR_MIN
* The minimum value a RTRCINPTR can have.
*/
/** @def RTRCINPTR_MAX
* The maximum value a RTRCINPTR can have.
*/
/** @} */
/** @defgroup grp_rt_types_cc Current Context Basic Types
* @ingroup grp_rt_types
* @{
*/
/** Current Context Physical Memory Address.*/
#ifdef IN_RC
#else
#endif
/** Pointer to Current Context Physical Memory Address. */
/** Pointer to const Current Context Physical Memory Address. */
typedef const RTCCPHYS *PCRTCCPHYS;
/** @def NIL_RTCCPHYS
* NIL CC Physical Address.
* NIL_RTCCPHYS is used to signal an invalid physical address, similar
* to the NULL pointer.
*/
#ifdef IN_RC
# define NIL_RTCCPHYS NIL_RTGCPHYS
#else
# define NIL_RTCCPHYS NIL_RTHCPHYS
#endif
/** Unsigned integer register in the current context. */
#if ARCH_BITS == 32
typedef uint32_t RTCCUINTREG;
typedef uint64_t RTCCUINTREG;
#else
# error "Unsupported ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the current context. */
typedef RTCCUINTREG *PRTCCUINTREG;
/** Pointer to a const unsigned integer register in the current context. */
typedef RTCCUINTREG const *PCRTCCUINTREG;
/** Signed integer register in the current context. */
#if ARCH_BITS == 32
typedef int32_t RTCCINTREG;
typedef int64_t RTCCINTREG;
#endif
/** Pointer to a signed integer register in the current context. */
typedef RTCCINTREG *PRTCCINTREG;
/** Pointer to a const signed integer register in the current context. */
typedef RTCCINTREG const *PCRTCCINTREG;
/** @} */
/** File handle. */
/** Pointer to file handle. */
/** Nil file handle. */
#define NIL_RTFILE (~(RTFILE)0)
/** Async I/O request handle. */
/** Pointer to a async I/O request handle. */
typedef RTFILEAIOREQ *PRTFILEAIOREQ;
/** Nil request handle. */
#define NIL_RTFILEAIOREQ 0
/** Async I/O completion context handle. */
/** Pointer to a async I/O completion context handle. */
typedef RTFILEAIOCTX *PRTFILEAIOCTX;
/** Nil context handle. */
#define NIL_RTFILEAIOCTX 0
/** Loader module handle. */
/** Pointer to a loader module handle. */
/** Nil loader module handle. */
#define NIL_RTLDRMOD 0
/** Ring-0 memory object handle. */
/** Pointer to a Ring-0 memory object handle. */
typedef RTR0MEMOBJ *PRTR0MEMOBJ;
/** Nil ring-0 memory object handle. */
#define NIL_RTR0MEMOBJ 0
/** Native thread handle. */
typedef RTHCUINTPTR RTNATIVETHREAD;
/** Pointer to an native thread handle. */
typedef RTNATIVETHREAD *PRTNATIVETHREAD;
/** Nil native thread handle. */
#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
/** Process identifier. */
/** Pointer to a process identifier. */
typedef RTPROCESS *PRTPROCESS;
/** Nil process identifier. */
#define NIL_RTPROCESS (~(RTPROCESS)0)
/** Process ring-0 handle. */
typedef RTR0UINTPTR RTR0PROCESS;
/** Pointer to a ring-0 process handle. */
typedef RTR0PROCESS *PRTR0PROCESS;
/** Nil ring-0 process handle. */
#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
/** @typedef RTSEMEVENT
* Event Semaphore handle. */
/** Pointer to an event semaphore handle. */
typedef RTSEMEVENT *PRTSEMEVENT;
/** Nil event semaphore handle. */
#define NIL_RTSEMEVENT 0
/** @typedef RTSEMEVENTMULTI
* Event Multiple Release Semaphore handle. */
/** Pointer to an event multiple release semaphore handle. */
typedef RTSEMEVENTMULTI *PRTSEMEVENTMULTI;
/** Nil multiple release event semaphore handle. */
#define NIL_RTSEMEVENTMULTI 0
/** @typedef RTSEMFASTMUTEX
* Fast mutex Semaphore handle. */
/** Pointer to a fast mutex semaphore handle. */
typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
/** Nil fast mutex semaphore handle. */
#define NIL_RTSEMFASTMUTEX 0
/** @typedef RTSEMMUTEX
* Mutex Semaphore handle. */
/** Pointer to a mutex semaphore handle. */
typedef RTSEMMUTEX *PRTSEMMUTEX;
/** Nil mutex semaphore handle. */
#define NIL_RTSEMMUTEX 0
/** @typedef RTSEMSPINMUTEX
* Spinning mutex Semaphore handle. */
/** Pointer to a spinning mutex semaphore handle. */
typedef RTSEMSPINMUTEX *PRTSEMSPINMUTEX;
/** Nil spinning mutex semaphore handle. */
#define NIL_RTSEMSPINMUTEX 0
/** @typedef RTSEMRW
#define NIL_RTSEMRW 0
/** Spinlock handle. */
/** Pointer to a spinlock handle. */
typedef RTSPINLOCK *PRTSPINLOCK;
/** Nil spinlock handle. */
#define NIL_RTSPINLOCK 0
/** Socket handle. */
typedef int RTSOCKET;
/** Pointer to socket handle. */
/** Nil socket handle. */
#define NIL_RTSOCKET (~(RTSOCKET)0)
/** Thread handle.*/
/** Pointer to thread handle. */
/** Nil thread handle. */
#define NIL_RTTHREAD 0
/** A TLS index. */
typedef RTHCINTPTR RTTLS;
/** Pointer to a TLS index. */
/** Pointer to a const TLS index. */
/** NIL TLS index value. */
#define NIL_RTTLS (-1)
/** Handle to a simple heap. */
/** Pointer to a handle to a simple heap. */
typedef RTHEAPSIMPLE *PRTHEAPSIMPLE;
/** NIL simple heap handle. */
#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
/** Handle to an environment block. */
/** Pointer to a handle to an environment block. */
/** NIL simple heap handle. */
/** A CPU identifier.
* does it have to correspond to the bits in the affinity mask, at
* least not until we've sorted out Windows NT. */
/** Pointer to a CPU identifier. */
/** Pointer to a const CPU identifier. */
/** Nil CPU Id. */
#define NIL_RTCPUID ((RTCPUID)~0)
/** A CPU set.
* Treat this as an opaque type and always use RTCpuSet* for manupulating it.
* @remarks Subject to change. */
/** Pointer to a CPU set. */
/** Pointer to a const CPU set. */
typedef RTCPUSET const *PCRTCPUSET;
/** A handle table handle. */
/** A pointer to a handle table handle. */
typedef RTHANDLETABLE *PRTHANDLETABLE;
/** @def NIL_RTHANDLETABLE
* NIL handle table handle. */
#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
/** A handle to a low resolution timer. */
/** A pointer to a low resolution timer handle. */
typedef RTTIMERLR *PRTTIMERLR;
/** @def NIL_RTTIMERLR
* NIL low resolution timer handle value. */
#define NIL_RTTIMERLR ((RTTIMERLR)0)
/** Handle to a random number generator. */
/** Pointer to a random number generator handle. */
/** NIL random number genrator handle value. */
#define NIL_RTRAND ((RTRAND)0)
/** Debug address space handle. */
/** Pointer to a debug address space handle. */
/** NIL debug address space handle. */
#define NIL_RTDBGAS ((RTDBGAS)0)
/** Debug module handle. */
/** Pointer to a debug module handle. */
/** NIL debug module handle. */
#define NIL_RTDBGMOD ((RTDBGMOD)0)
/** Memory pool handle. */
/** Pointer to a memory pool handle. */
typedef RTMEMPOOL *PRTMEMPOOL;
/** NIL memory pool handle. */
#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
/** The default memory pool handle. */
/** String cache handle. */
/** Pointer to a string cache handle. */
typedef RTSTRCACHE *PRTSTRCACHE;
/** NIL string cache handle. */
#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
/** The default string cache handle. */
/**
* UUID data type.
*
* @note IPRT defines that the first three integers in the @c Gen struct
* interpretation are in little endian representation. This is different to
* many other UUID implementation, and requires conversion if you need to
* achieve consistent results.
*/
typedef union RTUUID
{
/** 8-bit view. */
/** 16-bit view. */
/** 32-bit view. */
/** 64-bit view. */
/** The way the UUID is declared by the DCE specification. */
struct
{
} Gen;
} RTUUID;
/** Pointer to UUID data. */
/** Pointer to readonly UUID data. */
/**
* UUID string maximum length.
*/
#define RTUUID_STR_LENGTH 37
/** Compression handle. */
typedef struct RTZIPCOMP *PRTZIPCOMP;
/** Decompressor handle. */
typedef struct RTZIPDECOMP *PRTZIPDECOMP;
/**
* Unicode Code Point.
*/
/** Pointer to an Unicode Code Point. */
/** Pointer to an Unicode Code Point. */
/**
* UTF-16 character.
* @remark wchar_t is not usable since it's compiler defined.
* @remark When we use the term character we're not talking about unicode code point, but
* the basic unit of the string encoding. Thus cwc - count of wide chars - means
* count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
* and cch means count of the typedef 'char', which is assumed to be an octet.
*/
/** Pointer to a UTF-16 character. */
/** Pointer to a const UTF-16 character. */
/**
* Wait for ever if we have to.
*/
#define RT_INDEFINITE_WAIT (~0U)
/**
* Generic process callback.
*
* @returns VBox status code. Failure will cancel the operation.
* @param uPercentage The percentage of the operation which has been completed.
* @param pvUser The user specified argument.
*/
/** Pointer to a generic progress callback function, FNRTPROCESS(). */
typedef FNRTPROGRESS *PFNRTPROGRESS;
/**
* Rectangle data type.
*/
typedef struct RTRECT
{
/** left X coordinate. */
/** top Y coordinate. */
/** right X coordinate. (exclusive) */
/** bottom Y coordinate. (exclusive) */
} RTRECT;
/** Pointer to a rectangle. */
/** Pointer to a const rectangle. */
/**
* Ethernet MAC address.
*
* The first 24 bits make up the Organisationally Unique Identifier (OUI),
* where the first bit (little endian) indicates multicast (set) / unicast,
* and the second bit indicates locally (set) / global administered. If all
* bits are set, it's a broadcast.
*/
typedef union RTMAC
{
/** @todo add a bitfield view of this stuff. */
/** 8-bit view. */
/** 16-bit view. */
} RTMAC;
/** Pointer to a MAC address. */
/** Pointer to a readonly MAC address. */
#ifdef __cplusplus
/**
* Strict type validation helper class.
*
* See RTErrStrictType and RT_SUCCESS_NP.
*/
{
/** The status code. */
/**
* Constructor.
* @param rc IPRT style status code.
*/
{
}
/**
* Get the status code.
* @returns IPRT style status code.
*/
{
return m_rc;
}
};
#endif /* __cplusplus */
/** @} */
#endif