Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

types.h

Go to the documentation of this file.
/** @file
 * IPRT - Types.
 */

/*
 * Copyright (C) 2006-2007 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * 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 ___iprt_types_h
#define ___iprt_types_h

#include <iprt/cdefs.h>
#include <iprt/stdint.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
#  include <sys/types.h>

# elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
    /*
     * Kludge for the FreeBSD kernel:
     *  stddef.h and sys/types.h have slightly different offsetof definitions
     *  when compiling in kernel mode. This is just to make GCC shut up.
     */
#  ifndef _STDDEF_H_
#   undef offsetof
#  endif
#  include <sys/stddef.h>
#  ifndef _SYS_TYPES_H_
#   undef offsetof
#  endif
#  include <sys/types.h>
#  ifndef offsetof
#   error "offsetof is not defined..."
#  endif

# elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
    /*
     * 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
#  include <sys/types.h>

# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
    /*
     * Kludge for the linux kernel:
     *   1. sys/types.h doesn't mix with the kernel.
     *   2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
     *      declares false and true as enum values.
     *   3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
     * 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
#  ifndef AUTOCONF_INCLUDED
#   include <linux/autoconf.h>
#  endif
#  include <linux/types.h>
#  include <linux/stddef.h>
#  undef uintptr_t
#  undef false
#  undef true
#  undef bool

# else
#  include <stddef.h>
#  include <sys/types.h>
# endif

/* Define any types missing from sys/types.h on windows. */
# ifdef _MSC_VER
#  undef ssize_t
   typedef intptr_t ssize_t;
# endif

#else  /* no crt */
# include <iprt/nocrt/compiler/compiler.h>
#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__)
#  if defined(RT_OS_LINUX) && __GNUC__ < 3
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
00168 typedef struct uint128_s
{
# ifdef RT_BIG_ENDIAN
    uint64_t    Hi;
    uint64_t    Lo;
# else
    uint64_t    Lo;
    uint64_t    Hi;
# endif
} uint128_t;
#endif


/**
 * 128-bit signed integer.
 */
#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
typedef __int128_t int128_t;
#else
00187 typedef struct int128_s
{
# ifdef RT_BIG_ENDIAN
    int64_t     Hi;
    uint64_t    Lo;
# else
    uint64_t    Lo;
    int64_t     Hi;
# endif
} int128_t;
#endif


/**
 * 16-bit unsigned integer union.
 */
00203 typedef union RTUINT16U
{
    /** natural view. */
00206     uint16_t    u;

    /** 16-bit view. */
00209     uint16_t    au16[1];
    /** 8-bit view. */
00211     uint8_t     au8[2];
    /** 16-bit hi/lo view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint8_t    Hi;
        uint8_t    Lo;
#else
        uint8_t    Lo;
        uint8_t    Hi;
#endif
    } s;
} RTUINT16U;
/** Pointer to a 16-bit unsigned integer union. */
00225 typedef RTUINT16U *PRTUINT16U;
/** Pointer to a const 32-bit unsigned integer union. */
00227 typedef const RTUINT16U *PCRTUINT16U;


/**
 * 32-bit unsigned integer union.
 */
00233 typedef union RTUINT32U
{
    /** natural view. */
00236     uint32_t    u;
    /** Hi/Low view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint16_t    Hi;
        uint16_t    Lo;
#else
        uint16_t    Lo;
        uint16_t    Hi;
#endif
    } s;
    /** Word view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint16_t    w1;
        uint16_t    w0;
#else
        uint16_t    w0;
        uint16_t    w1;
#endif
    } Words;

    /** 32-bit view. */
00261     uint32_t    au32[1];
    /** 16-bit view. */
00263     uint16_t    au16[2];
    /** 8-bit view. */
00265     uint8_t     au8[4];
} RTUINT32U;
/** Pointer to a 32-bit unsigned integer union. */
00268 typedef RTUINT32U *PRTUINT32U;
/** Pointer to a const 32-bit unsigned integer union. */
00270 typedef const RTUINT32U *PCRTUINT32U;


/**
 * 64-bit unsigned integer union.
 */
00276 typedef union RTUINT64U
{
    /** Natural view. */
00279     uint64_t    u;
    /** Hi/Low view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint32_t    Hi;
        uint32_t    Lo;
#else
        uint32_t    Lo;
        uint32_t    Hi;
#endif
    } s;
    /** Double-Word view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint32_t    dw1;
        uint32_t    dw0;
#else
        uint32_t    dw0;
        uint32_t    dw1;
#endif
    } DWords;
    /** Word view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint16_t    w3;
        uint16_t    w2;
        uint16_t    w1;
        uint16_t    w0;
#else
        uint16_t    w0;
        uint16_t    w1;
        uint16_t    w2;
        uint16_t    w3;
#endif
    } Words;

    /** 64-bit view. */
00319     uint64_t    au64[1];
    /** 32-bit view. */
00321     uint32_t    au32[2];
    /** 16-bit view. */
00323     uint16_t    au16[4];
    /** 8-bit view. */
00325     uint8_t     au8[8];
} RTUINT64U;
/** Pointer to a 64-bit unsigned integer union. */
00328 typedef RTUINT64U *PRTUINT64U;
/** Pointer to a const 64-bit unsigned integer union. */
00330 typedef const RTUINT64U *PCRTUINT64U;


/**
 * 128-bit unsigned integer union.
 */
00336 typedef union RTUINT128U
{
    /** Natural view.
     * WARNING! This member depends on the compiler supporting 128-bit stuff. */
00340     uint128_t   u;
    /** Hi/Low view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint64_t    Hi;
        uint64_t    Lo;
#else
        uint64_t    Lo;
        uint64_t    Hi;
#endif
    } s;
    /** Quad-Word view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint64_t    qw1;
        uint64_t    qw0;
#else
        uint64_t    qw0;
        uint64_t    qw1;
#endif
    } QWords;
    /** Double-Word view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint32_t    dw3;
        uint32_t    dw2;
        uint32_t    dw1;
        uint32_t    dw0;
#else
        uint32_t    dw0;
        uint32_t    dw1;
        uint32_t    dw2;
        uint32_t    dw3;
#endif
    } DWords;
    /** Word view. */
    struct
    {
#ifdef RT_BIG_ENDIAN
        uint16_t    w7;
        uint16_t    w6;
        uint16_t    w5;
        uint16_t    w4;
        uint16_t    w3;
        uint16_t    w2;
        uint16_t    w1;
        uint16_t    w0;
#else
        uint16_t    w0;
        uint16_t    w1;
        uint16_t    w2;
        uint16_t    w3;
        uint16_t    w4;
        uint16_t    w5;
        uint16_t    w6;
        uint16_t    w7;
#endif
    } Words;

    /** 64-bit view. */
00403     uint64_t    au64[2];
    /** 32-bit view. */
00405     uint32_t    au32[4];
    /** 16-bit view. */
00407     uint16_t    au16[8];
    /** 8-bit view. */
00409     uint8_t     au8[16];
} RTUINT128U;
/** Pointer to a 64-bit unsigned integer union. */
00412 typedef RTUINT128U *PRTUINT128U;
/** Pointer to a const 64-bit unsigned integer union. */
00414 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.
 */
00439 typedef FNRT *PFNRT;

/** Millisecond interval. */
00442 typedef uint32_t            RTMSINTERVAL;
/** Pointer to a millisecond interval. */
00444 typedef RTMSINTERVAL       *PRTMSINTERVAL;
/** Pointer to a const millisecond interval. */
00446 typedef const RTMSINTERVAL *PCRTMSINTERVAL;


/** @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. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
00456 typedef int32_t         RTINTPTR;
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
typedef int64_t         RTINTPTR;
#else
#  error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** Pointer to signed integer which can contain both GC and HC pointers. */
00463 typedef RTINTPTR       *PRTINTPTR;
/** Pointer const to signed integer which can contain both GC and HC pointers. */
00465 typedef const RTINTPTR *PCRTINTPTR;
/** The maximum value the RTINTPTR type can hold. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
00468 # define RTINTPTR_MAX   INT32_MAX
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
# define RTINTPTR_MAX   INT64_MAX
#else
#  error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** The minimum value the RTINTPTR type can hold. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
00476 # define RTINTPTR_MIN   INT32_MIN
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
# define RTINTPTR_MIN   INT64_MIN
#else
#  error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif

/** Unsigned integer which can contain both GC and HC pointers. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
00485 typedef uint32_t        RTUINTPTR;
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
typedef uint64_t        RTUINTPTR;
#else
#  error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** Pointer to unsigned integer which can contain both GC and HC pointers. */
00492 typedef RTUINTPTR      *PRTUINTPTR;
/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
00494 typedef const RTUINTPTR *PCRTUINTPTR;
/** The maximum value the RTUINTPTR type can hold. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
00497 # define RTUINTPTR_MAX  UINT32_MAX
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
# define RTUINTPTR_MAX  UINT64_MAX
#else
#  error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif

/** Signed integer. */
00505 typedef int32_t         RTINT;
/** Pointer to signed integer. */
00507 typedef RTINT          *PRTINT;
/** Pointer to const signed integer. */
00509 typedef const RTINT    *PCRTINT;

/** Unsigned integer. */
00512 typedef uint32_t        RTUINT;
/** Pointer to unsigned integer. */
00514 typedef RTUINT         *PRTUINT;
/** Pointer to const unsigned integer. */
00516 typedef const RTUINT   *PCRTUINT;

/** A file offset / size (off_t). */
00519 typedef int64_t         RTFOFF;
/** Pointer to a file offset / size. */
00521 typedef RTFOFF         *PRTFOFF;
/** The max value for RTFOFF. */
00523 #define RTFOFF_MAX      INT64_MAX
/** The min value for RTFOFF. */
00525 #define RTFOFF_MIN      INT64_MIN

/** File mode (see iprt/fs.h). */
00528 typedef uint32_t        RTFMODE;
/** Pointer to file mode. */
00530 typedef RTFMODE        *PRTFMODE;

/** Device unix number. */
00533 typedef uint32_t        RTDEV;
/** Pointer to a device unix number. */
00535 typedef RTDEV          *PRTDEV;

/** i-node number. */
00538 typedef uint64_t        RTINODE;
/** Pointer to a i-node number. */
00540 typedef RTINODE        *PRTINODE;

/** User id. */
00543 typedef uint32_t        RTUID;
/** Pointer to a user id. */
00545 typedef RTUID          *PRTUID;
/** NIL user id.
 * @todo check this for portability! */
00548 #define NIL_RTUID       (~(RTUID)0);

/** Group id. */
00551 typedef uint32_t        RTGID;
/** Pointer to a group id. */
00553 typedef RTGID          *PRTGID;
/** NIL group id.
 * @todo check this for portability! */
00556 #define NIL_RTGID       (~(RTGID)0);

/** I/O Port. */
00559 typedef uint16_t        RTIOPORT;
/** Pointer to I/O Port. */
00561 typedef RTIOPORT       *PRTIOPORT;
/** Pointer to const I/O Port. */
00563 typedef const RTIOPORT *PCRTIOPORT;

/** Selector. */
00566 typedef uint16_t        RTSEL;
/** Pointer to selector. */
00568 typedef RTSEL          *PRTSEL;
/** Pointer to const selector. */
00570 typedef const RTSEL    *PCRTSEL;
/** Max selector value. */
00572 #define RTSEL_MAX       UINT16_MAX

/** Far 16-bit pointer. */
#pragma pack(1)
00576 typedef struct RTFAR16
{
    uint16_t        off;
    RTSEL           sel;
} RTFAR16;
#pragma pack()
/** Pointer to Far 16-bit pointer. */
00583 typedef RTFAR16 *PRTFAR16;
/** Pointer to const Far 16-bit pointer. */
00585 typedef const RTFAR16 *PCRTFAR16;

/** Far 32-bit pointer. */
#pragma pack(1)
00589 typedef struct RTFAR32
{
    uint32_t        off;
    RTSEL           sel;
} RTFAR32;
#pragma pack()
/** Pointer to Far 32-bit pointer. */
00596 typedef RTFAR32 *PRTFAR32;
/** Pointer to const Far 32-bit pointer. */
00598 typedef const RTFAR32 *PCRTFAR32;

/** Far 64-bit pointer. */
#pragma pack(1)
00602 typedef struct RTFAR64
{
    uint64_t        off;
    RTSEL           sel;
} RTFAR64;
#pragma pack()
/** Pointer to Far 64-bit pointer. */
00609 typedef RTFAR64 *PRTFAR64;
/** Pointer to const Far 64-bit pointer. */
00611 typedef const RTFAR64 *PCRTFAR64;

/** @} */


/** @defgroup grp_rt_types_hc  Host Context Basic Types
 * @ingroup grp_rt_types
 * @{
 */

/** HC Natural signed integer.
 * @deprecated silly type. */
00623 typedef int32_t             RTHCINT;
/** Pointer to HC Natural signed integer.
 * @deprecated silly type. */
00626 typedef RTHCINT            *PRTHCINT;
/** Pointer to const HC Natural signed integer.
 * @deprecated silly type. */
00629 typedef const RTHCINT      *PCRTHCINT;

/** HC Natural unsigned integer.
 * @deprecated silly type. */
00633 typedef uint32_t            RTHCUINT;
/** Pointer to HC Natural unsigned integer.
 * @deprecated silly type. */
00636 typedef RTHCUINT           *PRTHCUINT;
/** Pointer to const HC Natural unsigned integer.
 * @deprecated silly type. */
00639 typedef const RTHCUINT     *PCRTHCUINT;


/** Signed integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32
00644 typedef int32_t             RTHCINTPTR;
#elif HC_ARCH_BITS == 64
typedef int64_t             RTHCINTPTR;
#else
# error Unsupported HC_ARCH_BITS value.
#endif
/** Pointer to signed integer which can contain a HC pointer. */
00651 typedef RTHCINTPTR         *PRTHCINTPTR;
/** Pointer to const signed integer which can contain a HC pointer. */
00653 typedef const RTHCINTPTR   *PCRTHCINTPTR;
/** Max RTHCINTPTR value. */
#if HC_ARCH_BITS == 32
00656 # define RTHCINTPTR_MAX     INT32_MAX
#else
# define RTHCINTPTR_MAX     INT64_MAX
#endif
/** Min RTHCINTPTR value. */
#if HC_ARCH_BITS == 32
00662 # 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
00669 typedef int32_t             RTR3INTPTR;
#elif R3_ARCH_BITS == 64
typedef int64_t             RTR3INTPTR;
#else
#  error Unsupported R3_ARCH_BITS value.
#endif
/** Pointer to signed integer which can contain a HC ring-3 pointer. */
00676 typedef RTR3INTPTR         *PRTR3INTPTR;
/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
00678 typedef const RTR3INTPTR   *PCRTR3INTPTR;
/** Max RTR3INTPTR value. */
#if R3_ARCH_BITS == 32
00681 # define RTR3INTPTR_MAX     INT32_MAX
#else
# define RTR3INTPTR_MAX     INT64_MAX
#endif
/** Min RTR3INTPTR value. */
#if R3_ARCH_BITS == 32
00687 # 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
00694 typedef int32_t             RTR0INTPTR;
#elif R0_ARCH_BITS == 64
typedef int64_t             RTR0INTPTR;
#else
# error Unsupported R0_ARCH_BITS value.
#endif
/** Pointer to signed integer which can contain a HC ring-0 pointer. */
00701 typedef RTR0INTPTR         *PRTR0INTPTR;
/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
00703 typedef const RTR0INTPTR   *PCRTR0INTPTR;
/** Max RTR0INTPTR value. */
#if R0_ARCH_BITS == 32
00706 # define RTR0INTPTR_MAX     INT32_MAX
#else
# define RTR0INTPTR_MAX     INT64_MAX
#endif
/** Min RTHCINTPTR value. */
#if R0_ARCH_BITS == 32
00712 # 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
00720 typedef uint32_t            RTHCUINTPTR;
#elif HC_ARCH_BITS == 64
typedef uint64_t            RTHCUINTPTR;
#else
# error Unsupported HC_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a HC pointer. */
00727 typedef RTHCUINTPTR        *PRTHCUINTPTR;
/** Pointer to unsigned integer which can contain a HC pointer. */
00729 typedef const RTHCUINTPTR  *PCRTHCUINTPTR;
/** Max RTHCUINTTPR value. */
#if HC_ARCH_BITS == 32
00732 # 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
00739 typedef uint32_t            RTR3UINTPTR;
#elif R3_ARCH_BITS == 64
typedef uint64_t            RTR3UINTPTR;
#else
# error Unsupported R3_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
00746 typedef RTR3UINTPTR        *PRTR3UINTPTR;
/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
00748 typedef const RTR3UINTPTR  *PCRTR3UINTPTR;
/** Max RTHCUINTTPR value. */
#if R3_ARCH_BITS == 32
00751 # 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
00758 typedef uint32_t            RTR0UINTPTR;
#elif R0_ARCH_BITS == 64
typedef uint64_t            RTR0UINTPTR;
#else
# error Unsupported R0_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
00765 typedef RTR0UINTPTR        *PRTR0UINTPTR;
/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
00767 typedef const RTR0UINTPTR  *PCRTR0UINTPTR;
/** Max RTR0UINTTPR value. */
#if HC_ARCH_BITS == 32
00770 # define RTR0UINTPTR_MAX    UINT32_MAX
#else
# define RTR0UINTPTR_MAX    UINT64_MAX
#endif


/** Host Physical Memory Address. */
00777 typedef uint64_t            RTHCPHYS;
/** Pointer to Host Physical Memory Address. */
00779 typedef RTHCPHYS           *PRTHCPHYS;
/** Pointer to const Host Physical Memory Address. */
00781 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.
 */
00787 #define NIL_RTHCPHYS        (~(RTHCPHYS)0)
/** Max RTHCPHYS value. */
00789 #define RTHCPHYS_MAX        UINT64_MAX


/** HC pointer. */
#ifndef IN_RC
00794 typedef void *              RTHCPTR;
#else
typedef RTHCUINTPTR         RTHCPTR;
#endif
/** Pointer to HC pointer. */
00799 typedef RTHCPTR            *PRTHCPTR;
/** Pointer to const HC pointer. */
00801 typedef const RTHCPTR      *PCRTHCPTR;
/** @def NIL_RTHCPTR
 * NIL HC pointer.
 */
00805 #define NIL_RTHCPTR         ((RTHCPTR)0)
/** Max RTHCPTR value. */
00807 #define RTHCPTR_MAX         ((RTHCPTR)RTHCUINTPTR_MAX)


/** HC ring-3 pointer. */
#ifdef  IN_RING3
typedef void *              RTR3PTR;
#else
00814 typedef RTR3UINTPTR         RTR3PTR;
#endif
/** Pointer to HC ring-3 pointer. */
00817 typedef RTR3PTR            *PRTR3PTR;
/** Pointer to const HC ring-3 pointer. */
00819 typedef const RTR3PTR      *PCRTR3PTR;
/** @def NIL_RTR3PTR
 * NIL HC ring-3 pointer.
 */
00823 #define NIL_RTR3PTR         ((RTR3PTR)0)
/** Max RTR3PTR value. */
00825 #define RTR3PTR_MAX         ((RTR3PTR)RTR3UINTPTR_MAX)

/** HC ring-0 pointer. */
#ifdef  IN_RING0
typedef void *              RTR0PTR;
#else
00831 typedef RTR0UINTPTR         RTR0PTR;
#endif
/** Pointer to HC ring-0 pointer. */
00834 typedef RTR0PTR            *PRTR0PTR;
/** Pointer to const HC ring-0 pointer. */
00836 typedef const RTR0PTR      *PCRTR0PTR;
/** @def NIL_RTR0PTR
 * NIL HC ring-0 pointer.
 */
00840 #define NIL_RTR0PTR         ((RTR0PTR)0)
/** Max RTR3PTR value. */
00842 #define RTR0PTR_MAX         ((RTR0PTR)RTR0UINTPTR_MAX)


/** Unsigned integer register in the host context. */
#if HC_ARCH_BITS == 32
00847 typedef uint32_t            RTHCUINTREG;
#elif HC_ARCH_BITS == 64
typedef uint64_t            RTHCUINTREG;
#else
# error "Unsupported HC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host context. */
00854 typedef RTHCUINTREG        *PRTHCUINTREG;
/** Pointer to a const unsigned integer register in the host context. */
00856 typedef const RTHCUINTREG  *PCRTHCUINTREG;

/** Unsigned integer register in the host ring-3 context. */
#if R3_ARCH_BITS == 32
00860 typedef uint32_t            RTR3UINTREG;
#elif R3_ARCH_BITS == 64
typedef uint64_t            RTR3UINTREG;
#else
# error "Unsupported R3_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host ring-3 context. */
00867 typedef RTR3UINTREG        *PRTR3UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
00869 typedef const RTR3UINTREG  *PCRTR3UINTREG;

/** Unsigned integer register in the host ring-3 context. */
#if R0_ARCH_BITS == 32
00873 typedef uint32_t            RTR0UINTREG;
#elif R0_ARCH_BITS == 64
typedef uint64_t            RTR0UINTREG;
#else
# error "Unsupported R3_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host ring-3 context. */
00880 typedef RTR0UINTREG        *PRTR0UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
00882 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
00895 typedef int32_t         RTGCINT;
#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
typedef int64_t         RTGCINT;
#endif
/** Pointer to natural signed integer in GC.
 * @deprecated silly type. */
00901 typedef RTGCINT        *PRTGCINT;
/** Pointer to const natural signed integer in GC.
 * @deprecated silly type. */
00904 typedef const RTGCINT  *PCRTGCINT;

/** Natural unsigned integer in the GC.
 * @deprecated silly type. */
#if GC_ARCH_BITS == 32
00909 typedef uint32_t        RTGCUINT;
#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
typedef uint64_t        RTGCUINT;
#endif
/** Pointer to natural unsigned integer in GC.
 * @deprecated silly type. */
00915 typedef RTGCUINT       *PRTGCUINT;
/** Pointer to const natural unsigned integer in GC.
 * @deprecated silly type. */
00918 typedef const RTGCUINT *PCRTGCUINT;

/** Signed integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
00922 typedef int32_t         RTGCINTPTR;
#elif GC_ARCH_BITS == 64
typedef int64_t         RTGCINTPTR;
#endif
/** Pointer to signed integer which can contain a GC pointer. */
00927 typedef RTGCINTPTR     *PRTGCINTPTR;
/** Pointer to const signed integer which can contain a GC pointer. */
00929 typedef const RTGCINTPTR *PCRTGCINTPTR;

/** Unsigned integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
00933 typedef uint32_t        RTGCUINTPTR;
#elif GC_ARCH_BITS == 64
typedef uint64_t        RTGCUINTPTR;
#else
#  error Unsupported GC_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a GC pointer. */
00940 typedef RTGCUINTPTR     *PRTGCUINTPTR;
/** Pointer to unsigned integer which can contain a GC pointer. */
00942 typedef const RTGCUINTPTR *PCRTGCUINTPTR;

/** Unsigned integer which can contain a 32 bits GC pointer. */
00945 typedef uint32_t        RTGCUINTPTR32;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
00947 typedef RTGCUINTPTR32   *PRTGCUINTPTR32;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
00949 typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;

/** Unsigned integer which can contain a 64 bits GC pointer. */
00952 typedef uint64_t        RTGCUINTPTR64;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
00954 typedef RTGCUINTPTR64   *PRTGCUINTPTR64;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
00956 typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;

/** Guest Physical Memory Address.*/
00959 typedef uint64_t            RTGCPHYS;
/** Pointer to Guest Physical Memory Address. */
00961 typedef RTGCPHYS           *PRTGCPHYS;
/** Pointer to const Guest Physical Memory Address. */
00963 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.
 */
00970 #define NIL_RTGCPHYS        (~(RTGCPHYS)0U)
/** Max guest physical memory address value. */
00972 #define RTGCPHYS_MAX        UINT64_MAX


/** Guest Physical Memory Address; limited to 32 bits.*/
00976 typedef uint32_t            RTGCPHYS32;
/** Pointer to Guest Physical Memory Address. */
00978 typedef RTGCPHYS32         *PRTGCPHYS32;
/** Pointer to const Guest Physical Memory Address. */
00980 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.
 */
00987 #define NIL_RTGCPHYS32     (~(RTGCPHYS32)0)


/** Guest Physical Memory Address; limited to 64 bits.*/
00991 typedef uint64_t        RTGCPHYS64;
/** Pointer to Guest Physical Memory Address. */
00993 typedef RTGCPHYS64     *PRTGCPHYS64;
/** Pointer to const Guest Physical Memory Address. */
00995 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.
 */
01002 #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.
 */
01008 typedef RTGCUINTPTR32   RTGCPTR32;
/** Pointer to a guest context pointer. */
01010 typedef RTGCPTR32      *PRTGCPTR32;
/** Pointer to a const guest context pointer. */
01012 typedef const RTGCPTR32 *PCRTGCPTR32;
/** @def NIL_RTGCPTR32
 * NIL GC pointer.
 */
01016 #define NIL_RTGCPTR32   ((RTGCPTR32)0)

/** Guest context pointer, 64 bits.
 */
01020 typedef RTGCUINTPTR64   RTGCPTR64;
/** Pointer to a guest context pointer. */
01022 typedef RTGCPTR64      *PRTGCPTR64;
/** Pointer to a const guest context pointer. */
01024 typedef const RTGCPTR64 *PCRTGCPTR64;
/** @def NIL_RTGCPTR64
 * NIL GC pointer.
 */
01028 #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
typedef RTGCPTR64       RTGCPTR;
/** 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
#elif GC_ARCH_BITS == 32
01047 typedef RTGCPTR32       RTGCPTR;
/** Pointer to a guest context pointer. */
01049 typedef PRTGCPTR32      PRTGCPTR;
/** Pointer to a const guest context pointer. */
01051 typedef PCRTGCPTR32     PCRTGCPTR;
/** @def NIL_RTGCPTR
 * NIL GC pointer.
 */
# define NIL_RTGCPTR     NIL_RTGCPTR32
/** Max RTGCPTR value. */
01057 # define RTGCPTR_MAX    UINT32_MAX
#else
# error "Unsupported GC_ARCH_BITS!"
#endif

/** Unsigned integer register in the guest context. */
01063 typedef uint32_t              RTGCUINTREG32;
/** Pointer to an unsigned integer register in the guest context. */
01065 typedef RTGCUINTREG32        *PRTGCUINTREG32;
/** Pointer to a const unsigned integer register in the guest context. */
01067 typedef const RTGCUINTREG32  *PCRTGCUINTREG32;

typedef uint64_t              RTGCUINTREG64;
/** Pointer to an unsigned integer register in the guest context. */
01071 typedef RTGCUINTREG64        *PRTGCUINTREG64;
/** Pointer to a const unsigned integer register in the guest context. */
01073 typedef const RTGCUINTREG64  *PCRTGCUINTREG64;

#if GC_ARCH_BITS == 64
typedef RTGCUINTREG64           RTGCUINTREG;
#elif GC_ARCH_BITS == 32
typedef RTGCUINTREG32           RTGCUINTREG;
#else
# error "Unsupported GC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the guest context. */
01083 typedef RTGCUINTREG            *PRTGCUINTREG;
/** Pointer to a const unsigned integer register in the guest context. */
01085 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
01101 typedef uint32_t        RTRCPTR;
#endif
/** Pointer to a raw mode context pointer. */
01104 typedef RTRCPTR        *PRTRCPTR;
/** Pointer to a const raw mode context pointer. */
01106 typedef const RTRCPTR  *PCRTRCPTR;
/** @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.
 */
01114 #define RTRCPTR_MAX    ((RTRCPTR)UINT32_MAX)

/** Raw mode context pointer, unsigned integer variant. */
01117 typedef int32_t         RTRCINTPTR;
/** @def RTRCUINTPTR_MAX
 * The maximum value a RTRCUINPTR can have.
 */
01121 #define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)

/** Raw mode context pointer, signed integer variant. */
01124 typedef uint32_t        RTRCUINTPTR;
/** @def RTRCINTPTR_MIN
 * The minimum value a RTRCINPTR can have.
 */
01128 #define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
/** @def RTRCINTPTR_MAX
 * The maximum value a RTRCINPTR can have.
 */
01132 #define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)

/** @} */


/** @defgroup grp_rt_types_cc  Current Context Basic Types
 * @ingroup grp_rt_types
 * @{
 */

/** Current Context Physical Memory Address.*/
#ifdef IN_RC
typedef RTGCPHYS RTCCPHYS;
#else
01146 typedef RTHCPHYS RTCCPHYS;
#endif
/** Pointer to Current Context Physical Memory Address. */
01149 typedef RTCCPHYS       *PRTCCPHYS;
/** Pointer to const Current Context Physical Memory Address. */
01151 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
01160 # define NIL_RTCCPHYS   NIL_RTHCPHYS
#endif

/** Unsigned integer register in the current context. */
#if ARCH_BITS == 32
01165 typedef uint32_t                RTCCUINTREG;
#elif ARCH_BITS == 64
typedef uint64_t                RTCCUINTREG;
#else
# error "Unsupported ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the current context. */
01172 typedef RTCCUINTREG            *PRTCCUINTREG;
/** Pointer to a const unsigned integer register in the current context. */
01174 typedef RTCCUINTREG const      *PCRTCCUINTREG;

/** Signed integer register in the current context. */
#if ARCH_BITS == 32
01178 typedef int32_t                 RTCCINTREG;
#elif ARCH_BITS == 64
typedef int64_t                 RTCCINTREG;
#endif
/** Pointer to a signed integer register in the current context. */
01183 typedef RTCCINTREG             *PRTCCINTREG;
/** Pointer to a const signed integer register in the current context. */
01185 typedef RTCCINTREG const       *PCRTCCINTREG;

/** @} */


/** File handle. */
01191 typedef RTUINT                                      RTFILE;
/** Pointer to file handle. */
01193 typedef RTFILE                                     *PRTFILE;
/** Nil file handle. */
01195 #define NIL_RTFILE                                  (~(RTFILE)0)

/** Async I/O request handle. */
typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL *)    RTFILEAIOREQ;
/** Pointer to a async I/O request handle. */
01200 typedef RTFILEAIOREQ                               *PRTFILEAIOREQ;
/** Nil request handle. */
01202 #define NIL_RTFILEAIOREQ                            0

/** Async I/O completion context handle. */
typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL *)    RTFILEAIOCTX;
/** Pointer to a async I/O completion context handle. */
01207 typedef RTFILEAIOCTX                               *PRTFILEAIOCTX;
/** Nil context handle. */
01209 #define NIL_RTFILEAIOCTX                            0

/** Loader module handle. */
typedef R3PTRTYPE(struct RTLDRMODINTERNAL *)        RTLDRMOD;
/** Pointer to a loader module handle. */
01214 typedef RTLDRMOD                                   *PRTLDRMOD;
/** Nil loader module handle. */
01216 #define NIL_RTLDRMOD                                0

/** Lock validator class handle. */
typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT *)     RTLOCKVALCLASS;
/** Pointer to a lock validator class handle. */
01221 typedef RTLOCKVALCLASS                             *PRTLOCKVALCLASS;
/** Nil lock validator class handle. */
01223 #define NIL_RTLOCKVALCLASS                         ((RTLOCKVALCLASS)0)

/** Ring-0 memory object handle. */
typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *)      RTR0MEMOBJ;
/** Pointer to a Ring-0 memory object handle. */
01228 typedef RTR0MEMOBJ                                 *PRTR0MEMOBJ;
/** Nil ring-0 memory object handle. */
01230 #define NIL_RTR0MEMOBJ                              0

/** Native thread handle. */
01233 typedef RTHCUINTPTR                                 RTNATIVETHREAD;
/** Pointer to an native thread handle. */
01235 typedef RTNATIVETHREAD                             *PRTNATIVETHREAD;
/** Nil native thread handle. */
01237 #define NIL_RTNATIVETHREAD                          (~(RTNATIVETHREAD)0)

/** Pipe handle. */
typedef R3R0PTRTYPE(struct RTPIPEINTERNAL *)        RTPIPE;
/** Pointer to a pipe handle. */
01242 typedef RTPIPE                                     *PRTPIPE;
/** Nil pipe handle.
 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
01245 #define NIL_RTPIPE                                 ((RTPIPE)RTHCUINTPTR_MAX)

/** @typedef RTPOLLSET
 * Poll set handle. */
typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL *)     RTPOLLSET;
/** Pointer to a poll set handle. */
01251 typedef RTPOLLSET                                  *PRTPOLLSET;
/** Nil poll set handle handle. */
01253 #define NIL_RTPOLLSET                               ((RTPOLLSET)0)

/** Process identifier. */
01256 typedef uint32_t                                    RTPROCESS;
/** Pointer to a process identifier. */
01258 typedef RTPROCESS                                  *PRTPROCESS;
/** Nil process identifier. */
01260 #define NIL_RTPROCESS                               (~(RTPROCESS)0)

/** Process ring-0 handle. */
01263 typedef RTR0UINTPTR                                 RTR0PROCESS;
/** Pointer to a ring-0 process handle. */
01265 typedef RTR0PROCESS                                *PRTR0PROCESS;
/** Nil ring-0 process handle. */
01267 #define NIL_RTR0PROCESS                             (~(RTR0PROCESS)0)

/** @typedef RTSEMEVENT
 * Event Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *)    RTSEMEVENT;
/** Pointer to an event semaphore handle. */
01273 typedef RTSEMEVENT                                 *PRTSEMEVENT;
/** Nil event semaphore handle. */
01275 #define NIL_RTSEMEVENT                              0

/** @typedef RTSEMEVENTMULTI
 * Event Multiple Release Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
/** Pointer to an event multiple release semaphore handle. */
01281 typedef RTSEMEVENTMULTI                            *PRTSEMEVENTMULTI;
/** Nil multiple release event semaphore handle. */
01283 #define NIL_RTSEMEVENTMULTI                         0

/** @typedef RTSEMFASTMUTEX
 * Fast mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
/** Pointer to a fast mutex semaphore handle. */
01289 typedef RTSEMFASTMUTEX                             *PRTSEMFASTMUTEX;
/** Nil fast mutex semaphore handle. */
01291 #define NIL_RTSEMFASTMUTEX                          0

/** @typedef RTSEMMUTEX
 * Mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *)    RTSEMMUTEX;
/** Pointer to a mutex semaphore handle. */
01297 typedef RTSEMMUTEX                                 *PRTSEMMUTEX;
/** Nil mutex semaphore handle. */
01299 #define NIL_RTSEMMUTEX                              0

/** @typedef RTSEMSPINMUTEX
 * Spinning mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL *) RTSEMSPINMUTEX;
/** Pointer to a spinning mutex semaphore handle. */
01305 typedef RTSEMSPINMUTEX                             *PRTSEMSPINMUTEX;
/** Nil spinning mutex semaphore handle. */
01307 #define NIL_RTSEMSPINMUTEX                          0

/** @typedef RTSEMRW
 * Read/Write Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *)       RTSEMRW;
/** Pointer to a read/write semaphore handle. */
01313 typedef RTSEMRW                                    *PRTSEMRW;
/** Nil read/write semaphore handle. */
01315 #define NIL_RTSEMRW                                 0

/** @typedef RTSEMXROADS
 * Crossroads semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL *)   RTSEMXROADS;
/** Pointer to a crossroads semaphore handle. */
01321 typedef RTSEMXROADS                                *PRTSEMXROADS;
/** Nil crossroads semaphore handle. */
01323 #define NIL_RTSEMXROADS                             ((RTSEMXROADS)0)

/** Spinlock handle. */
typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *)    RTSPINLOCK;
/** Pointer to a spinlock handle. */
01328 typedef RTSPINLOCK                                 *PRTSPINLOCK;
/** Nil spinlock handle. */
01330 #define NIL_RTSPINLOCK                              0

/** Socket handle. */
typedef R3R0PTRTYPE(struct RTSOCKETINT *)           RTSOCKET;
/** Pointer to socket handle. */
01335 typedef RTSOCKET                                   *PRTSOCKET;
/** Nil socket handle. */
01337 #define NIL_RTSOCKET                                ((RTSOCKET)0)

/** Thread handle.*/
typedef R3R0PTRTYPE(struct RTTHREADINT *)           RTTHREAD;
/** Pointer to thread handle. */
01342 typedef RTTHREAD                                   *PRTTHREAD;
/** Nil thread handle. */
01344 #define NIL_RTTHREAD                                0

/** A TLS index. */
01347 typedef RTHCINTPTR                                  RTTLS;
/** Pointer to a TLS index. */
01349 typedef RTTLS                                      *PRTTLS;
/** Pointer to a const TLS index. */
01351 typedef RTTLS const                                *PCRTTLS;
/** NIL TLS index value. */
01353 #define NIL_RTTLS                                   ((RTTLS)-1)

/** Handle to a simple heap. */
typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *)  RTHEAPSIMPLE;
/** Pointer to a handle to a simple heap. */
01358 typedef RTHEAPSIMPLE                               *PRTHEAPSIMPLE;
/** NIL simple heap handle. */
01360 #define NIL_RTHEAPSIMPLE                            ((RTHEAPSIMPLE)0)

/** Handle to a offset based heap. */
typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL *)  RTHEAPOFFSET;
/** Pointer to a handle to a offset based heap. */
01365 typedef RTHEAPOFFSET                               *PRTHEAPOFFSET;
/** NIL offset based heap handle. */
01367 #define NIL_RTHEAPOFFSET                            ((RTHEAPOFFSET)0)

/** Handle to an environment block. */
typedef R3PTRTYPE(struct RTENVINTERNAL *)           RTENV;
/** Pointer to a handle to an environment block. */
01372 typedef RTENV                                      *PRTENV;
/** NIL simple heap handle. */
01374 #define NIL_RTENV                                   ((RTENV)0)

/** A CPU identifier.
 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
 *          does it have to correspond to the bits in the affinity mask, at
 *          least not until we've sorted out Windows NT. */
01380 typedef uint32_t                                    RTCPUID;
/** Pointer to a CPU identifier. */
01382 typedef RTCPUID                                    *PRTCPUID;
/** Pointer to a const CPU identifier. */
01384 typedef RTCPUID const                              *PCRTCPUID;
/** Nil CPU Id. */
01386 #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. */
01391 typedef uint64_t                                    RTCPUSET;
/** Pointer to a CPU set. */
01393 typedef RTCPUSET                                   *PRTCPUSET;
/** Pointer to a const CPU set. */
01395 typedef RTCPUSET const                             *PCRTCPUSET;

/** A handle table handle. */
typedef R3R0PTRTYPE(struct RTHANDLETABLEINT *)      RTHANDLETABLE;
/** A pointer to a handle table handle. */
01400 typedef RTHANDLETABLE                              *PRTHANDLETABLE;
/** @def NIL_RTHANDLETABLE
 * NIL handle table handle. */
01403 #define NIL_RTHANDLETABLE                           ((RTHANDLETABLE)0)

/** A handle to a low resolution timer. */
typedef R3R0PTRTYPE(struct RTTIMERLRINT *)          RTTIMERLR;
/** A pointer to a low resolution timer handle. */
01408 typedef RTTIMERLR                                  *PRTTIMERLR;
/** @def NIL_RTTIMERLR
 * NIL low resolution timer handle value. */
01411 #define NIL_RTTIMERLR                               ((RTTIMERLR)0)

/** Handle to a random number generator. */
typedef R3R0PTRTYPE(struct RTRANDINT *)             RTRAND;
/** Pointer to a random number generator handle. */
01416 typedef RTRAND                                     *PRTRAND;
/** NIL random number genrator handle value. */
01418 #define NIL_RTRAND                                  ((RTRAND)0)

/** Debug address space handle. */
typedef R3R0PTRTYPE(struct RTDBGASINT *)            RTDBGAS;
/** Pointer to a debug address space handle. */
01423 typedef RTDBGAS                                    *PRTDBGAS;
/** NIL debug address space handle. */
01425 #define NIL_RTDBGAS                                 ((RTDBGAS)0)

/** Debug module handle. */
typedef R3R0PTRTYPE(struct RTDBGMODINT *)           RTDBGMOD;
/** Pointer to a debug module handle. */
01430 typedef RTDBGMOD                                   *PRTDBGMOD;
/** NIL debug module handle. */
01432 #define NIL_RTDBGMOD                                ((RTDBGMOD)0)

/** Memory pool handle. */
typedef R3R0PTRTYPE(struct RTMEMPOOLINT *)          RTMEMPOOL;
/** Pointer to a memory pool handle. */
01437 typedef RTMEMPOOL                                  *PRTMEMPOOL;
/** NIL memory pool handle. */
01439 #define NIL_RTMEMPOOL                               ((RTMEMPOOL)0)
/** The default memory pool handle. */
01441 #define RTMEMPOOL_DEFAULT                           ((RTMEMPOOL)-2)

/** String cache handle. */
typedef R3R0PTRTYPE(struct RTSTRCACHEINT *)         RTSTRCACHE;
/** Pointer to a string cache handle. */
01446 typedef RTSTRCACHE                                 *PRTSTRCACHE;
/** NIL string cache handle. */
01448 #define NIL_RTSTRCACHE                              ((RTSTRCACHE)0)
/** The default string cache handle. */
01450 #define RTSTRCACHE_DEFAULT                          ((RTSTRCACHE)-2)

/**
 * Handle type.
 *
 * This is usually used together with RTHANDLEUNION.
 */
01457 typedef enum RTHANDLETYPE
{
    /** The invalid zero value. */
01460     RTHANDLETYPE_INVALID = 0,
    /** File handle. */
01462     RTHANDLETYPE_FILE,
    /** Pipe handle */
01464     RTHANDLETYPE_PIPE,
    /** Socket handle. */
01466     RTHANDLETYPE_SOCKET,
    /** Thread handle. */
01468     RTHANDLETYPE_THREAD,
    /** The end of the valid values. */
01470     RTHANDLETYPE_END,
    /** The 32-bit type blow up. */
01472     RTHANDLETYPE_32BIT_HACK = 0x7fffffff
} RTHANDLETYPE;
/** Pointer to a handle type. */
01475 typedef RTHANDLETYPE *PRTHANDLETYPE;

/**
 * Handle union.
 *
 * This is usually used together with RTHANDLETYPE or as RTHANDLE.
 */
01482 typedef union RTHANDLEUNION
{
01484     RTFILE          hFile;              /**< File handle. */
01485     RTPIPE          hPipe;              /**< Pipe handle. */
01486     RTSOCKET        hSocket;            /**< Socket handle. */
01487     RTTHREAD        hThread;            /**< Thread handle. */
    /** Generic integer handle value.
     * Note that RTFILE is not yet pointer sized, so accessing it via this member
     * isn't necessarily safe or fully portable. */
01491     RTHCUINTPTR     uInt;
} RTHANDLEUNION;
/** Pointer to a handle union. */
01494 typedef RTHANDLEUNION *PRTHANDLEUNION;
/** Pointer to a const handle union. */
01496 typedef RTHANDLEUNION const *PCRTHANDLEUNION;

/**
 * Generic handle.
 */
01501 typedef struct RTHANDLE
{
    /** The handle type. */
01504     RTHANDLETYPE    enmType;
    /** The handle value. */
01506     RTHANDLEUNION   u;
} RTHANDLE;
/** Pointer to a generic handle. */
01509 typedef RTHANDLE *PRTHANDLE;
/** Pointer to a const generic handle. */
01511 typedef RTHANDLE const *PCRTHANDLE;


/**
 * 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.
 */
01522 typedef union RTUUID
{
    /** 8-bit view. */
01525     uint8_t     au8[16];
    /** 16-bit view. */
01527     uint16_t    au16[8];
    /** 32-bit view. */
01529     uint32_t    au32[4];
    /** 64-bit view. */
01531     uint64_t    au64[2];
    /** The way the UUID is declared by the DCE specification. */
    struct
    {
        uint32_t    u32TimeLow;
        uint16_t    u16TimeMid;
        uint16_t    u16TimeHiAndVersion;
        uint8_t     u8ClockSeqHiAndReserved;
        uint8_t     u8ClockSeqLow;
        uint8_t     au8Node[6];
    } Gen;
} RTUUID;
/** Pointer to UUID data. */
01544 typedef RTUUID *PRTUUID;
/** Pointer to readonly UUID data. */
01546 typedef const RTUUID *PCRTUUID;

/**
 * UUID string maximum length.
 */
01551 #define RTUUID_STR_LENGTH       37


/** Compression handle. */
01555 typedef struct RTZIPCOMP   *PRTZIPCOMP;

/** Decompressor handle. */
01558 typedef struct RTZIPDECOMP *PRTZIPDECOMP;


/**
 * Unicode Code Point.
 */
01564 typedef uint32_t        RTUNICP;
/** Pointer to an Unicode Code Point. */
01566 typedef RTUNICP        *PRTUNICP;
/** Pointer to an Unicode Code Point. */
01568 typedef const RTUNICP  *PCRTUNICP;


/**
 * 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.
 */
01579 typedef uint16_t        RTUTF16;
/** Pointer to a UTF-16 character. */
01581 typedef RTUTF16        *PRTUTF16;
/** Pointer to a const UTF-16 character. */
01583 typedef const RTUTF16  *PCRTUTF16;


/**
 * Wait for ever if we have to.
 */
01589 #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.
 */
typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
/** Pointer to a generic progress callback function, FNRTPROCESS(). */
01601 typedef FNRTPROGRESS *PFNRTPROGRESS;


/**
 * Rectangle data type.
 */
01607 typedef struct RTRECT
{
    /** left X coordinate. */
01610     int32_t     xLeft;
    /** top Y coordinate. */
01612     int32_t     yTop;
    /** right X coordinate. (exclusive) */
01614     int32_t     xRight;
    /** bottom Y coordinate. (exclusive) */
01616     int32_t     yBottom;
} RTRECT;
/** Pointer to a rectangle. */
01619 typedef RTRECT *PRTRECT;
/** Pointer to a const rectangle. */
01621 typedef const RTRECT *PCRTRECT;


/**
 * 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.
 */
01632 typedef union RTMAC
{
    /** @todo add a bitfield view of this stuff. */
    /** 8-bit view. */
01636     uint8_t     au8[6];
    /** 16-bit view. */
01638     uint16_t    au16[3];
} RTMAC;
/** Pointer to a MAC address. */
01641 typedef RTMAC *PRTMAC;
/** Pointer to a readonly MAC address. */
01643 typedef const RTMAC *PCRTMAC;


/** Pointer to a lock validator record.
 * The structure definition is found in iprt/lockvalidator.h.  */
01648 typedef struct RTLOCKVALRECEXCL        *PRTLOCKVALRECEXCL;
/** Pointer to a lock validator source poisition.
 * The structure definition is found in iprt/lockvalidator.h.  */
01651 typedef struct RTLOCKVALSRCPOS         *PRTLOCKVALSRCPOS;
/** Pointer to a const lock validator source poisition.
 * The structure definition is found in iprt/lockvalidator.h.  */
01654 typedef struct RTLOCKVALSRCPOS const   *PCRTLOCKVALSRCPOS;

/** @name   Special sub-class values.
 * The range 16..UINT32_MAX is available to the user, the range 0..15 is
 * reserved for the lock validator.  In the user range the locks can only be
 * taking in ascending order.
 * @{ */
/** Invalid value.  */
01662 #define RTLOCKVAL_SUB_CLASS_INVALID     UINT32_C(0)
/** Not allowed to be taken with any other locks in the same class.
  * This is the recommended value.  */
01665 #define RTLOCKVAL_SUB_CLASS_NONE        UINT32_C(1)
/** Any order is allowed within the class. */
01667 #define RTLOCKVAL_SUB_CLASS_ANY         UINT32_C(2)
/** The first user value. */
01669 #define RTLOCKVAL_SUB_CLASS_USER        UINT32_C(16)
/** @} */


/**
 * Process exit codes.
 */
01676 typedef enum RTEXITCODE
{
    /** Success. */
01679     RTEXITCODE_SUCCESS = 0,
    /** General failure. */
01681     RTEXITCODE_FAILURE = 1,
    /** Invalid arguments.  */
01683     RTEXITCODE_SYNTAX = 2,
    /** Initialization failure (usually IPRT, but could be used for other
     *  components as well). */
01686     RTEXITCODE_INIT = 3,
    /** Test skipped. */
01688     RTEXITCODE_SKIPPED = 4,
    /** The end of valid exit codes. */
01690     RTEXITCODE_END,
    /** The usual 32-bit type hack. */
01692     RTEXITCODE_32BIT_HACK = 0x7fffffff
} RTEXITCODE;


#ifdef __cplusplus
/**
 * Strict type validation helper class.
 *
 * See RTErrStrictType and RT_SUCCESS_NP.
 */
class RTErrStrictType2
{
protected:
    /** The status code.  */
    int32_t m_rc;

public:
    /**
     * Constructor.
     * @param   rc      IPRT style status code.
     */
    RTErrStrictType2(int32_t rc) : m_rc(rc)
    {
    }

    /**
     * Get the status code.
     * @returns IPRT style status code.
     */
    int32_t getValue() const
    {
        return m_rc;
    }
};
#endif /* __cplusplus */
/** @} */

#endif


Generated by  Doxygen 1.6.0   Back to index