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

types.h

Go to the documentation of this file.
/** @file
 * innotek Portable Runtime - Types.
 */

/*
 * Copyright (C) 2006-2007 innotek GmbH
 *
 * 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 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.
 */

#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)
    /*
     * Klugde 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 has sligtly different offsetof definitions
     *  when compiling in kernel mode. This is just to make GCC keep shut.
     */
#  ifndef _STDDEF_H_
#   undef offsetof
#  endif
#  include <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_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.
     * 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
#  include <linux/types.h>
#  include <linux/stddef.h>
#  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/gcc.h>
#endif /* no crt */



/** @defgroup grp_rt_types  innotek Portable Runtime 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_DARWIN) && defined(_STDBOOL_H)
#   undef bool
#  endif
typedef _Bool bool;
# 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
00136 typedef struct uint128_s
{
    uint64_t    Lo;
    uint64_t    Hi;
} uint128_t;
#endif


/**
 * 128-bit signed integer.
 */
#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
typedef __int128_t int128_t;
#else
00150 typedef struct int128_s
{
    uint64_t    lo;
    int64_t     hi;
} int128_t;
#endif


/**
 * 16-bit unsigned interger union.
 */
00161 typedef union RTUINT16U
{
    /** natural view. */
00164     uint16_t    u;

    /** 16-bit view. */
00167     uint16_t    au16[1];
    /** 8-bit view. */
00169     uint8_t     au8[4];
    /** 16-bit hi/lo view. */
    struct
    {
        uint16_t    Lo;
        uint16_t    Hi;
    } s;
} RTUINT16U;
/** Pointer to a 16-bit unsigned interger union. */
00178 typedef RTUINT16U *PRTUINT16U;
/** Pointer to a const 32-bit unsigned interger union. */
00180 typedef const RTUINT16U *PCRTUINT16U;


/**
 * 32-bit unsigned interger union.
 */
00186 typedef union RTUINT32U
{
    /** natural view. */
00189     uint32_t    u;
    /** Hi/Low view. */
    struct
    {
        uint16_t    Lo;
        uint16_t    Hi;
    } s;
    /** Word view. */
    struct
    {
        uint16_t    w0;
        uint16_t    w1;
    } Words;

    /** 32-bit view. */
00204     uint32_t    au32[1];
    /** 16-bit view. */
00206     uint16_t    au16[2];
    /** 8-bit view. */
00208     uint8_t     au8[4];
} RTUINT32U;
/** Pointer to a 32-bit unsigned interger union. */
00211 typedef RTUINT32U *PRTUINT32U;
/** Pointer to a const 32-bit unsigned interger union. */
00213 typedef const RTUINT32U *PCRTUINT32U;


/**
 * 64-bit unsigned interger union.
 */
00219 typedef union RTUINT64U
{
    /** Natural view. */
00222     uint64_t    u;
    /** Hi/Low view. */
    struct
    {
        uint32_t    Lo;
        uint32_t    Hi;
    } s;
    /** Double-Word view. */
    struct
    {
        uint32_t    dw0;
        uint32_t    dw1;
    } DWords;
    /** Word view. */
    struct
    {
        uint16_t    w0;
        uint16_t    w1;
        uint16_t    w2;
        uint16_t    w3;
    } Words;

    /** 64-bit view. */
00245     uint64_t    au64[1];
    /** 32-bit view. */
00247     uint32_t    au32[2];
    /** 16-bit view. */
00249     uint16_t    au16[4];
    /** 8-bit view. */
00251     uint8_t     au8[8];
} RTUINT64U;
/** Pointer to a 64-bit unsigned interger union. */
00254 typedef RTUINT64U *PRTUINT64U;
/** Pointer to a const 64-bit unsigned interger union. */
00256 typedef const RTUINT64U *PCRTUINT64U;


/**
 * 128-bit unsigned interger union.
 */
00262 typedef union RTUINT128U
{
    /** Natural view.
     * WARNING! This member depends on compiler supporing 128-bit stuff. */
00266     uint128_t   u;
    /** Hi/Low view. */
    struct
    {
        uint64_t    Lo;
        uint64_t    Hi;
    } s;
    /** Quad-Word view. */
    struct
    {
        uint64_t    qw0;
        uint64_t    qw1;
    } QWords;
    /** Double-Word view. */
    struct
    {
        uint32_t    dw0;
        uint32_t    dw1;
        uint32_t    dw2;
        uint32_t    dw3;
    } DWords;
    /** Word view. */
    struct
    {
        uint16_t    w0;
        uint16_t    w1;
        uint16_t    w2;
        uint16_t    w3;
        uint16_t    w4;
        uint16_t    w5;
        uint16_t    w6;
        uint16_t    w7;
    } Words;

    /** 64-bit view. */
00301     uint64_t    au64[2];
    /** 32-bit view. */
00303     uint32_t    au32[4];
    /** 16-bit view. */
00305     uint16_t    au16[8];
    /** 8-bit view. */
00307     uint8_t     au8[16];
} RTUINT128U;
/** Pointer to a 64-bit unsigned interger union. */
00310 typedef RTUINT128U *PRTUINT128U;
/** Pointer to a const 64-bit unsigned interger union. */
00312 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.
 */
00336 typedef FNRT *PFNRT;


/** @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)
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. */
00353 typedef RTINTPTR       *PRTINTPTR;
/** Pointer const to signed integer which can contain both GC and HC pointers. */
00355 typedef const RTINTPTR *PCRTINTPTR;

/** Unsigned integer which can contain both GC and HC pointers. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
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. */
00366 typedef RTUINTPTR      *PRTUINTPTR;
/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
00368 typedef const RTUINTPTR *PCRTUINTPTR;

/** Signed integer. */
00371 typedef int32_t         RTINT;
/** Pointer to signed integer. */
00373 typedef RTINT          *PRTINT;
/** Pointer to const signed integer. */
00375 typedef const RTINT    *PCRTINT;

/** Unsigned integer. */
00378 typedef uint32_t        RTUINT;
/** Pointer to unsigned integer. */
00380 typedef RTUINT         *PRTUINT;
/** Pointer to const unsigned integer. */
00382 typedef const RTUINT   *PCRTUINT;

/** A file offset / size (off_t). */
00385 typedef int64_t         RTFOFF;
/** Pointer to a file offset / size. */
00387 typedef RTFOFF         *PRTFOFF;

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

/** Device unix number. */
00395 typedef uint32_t        RTDEV;
/** Pointer to a device unix number. */
00397 typedef RTDEV          *PRTDEV;

/** i-node number. */
00400 typedef uint64_t        RTINODE;
/** Pointer to a i-node number. */
00402 typedef RTINODE        *PRTINODE;

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

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

/** I/O Port. */
00421 typedef uint16_t        RTIOPORT;
/** Pointer to I/O Port. */
00423 typedef RTIOPORT       *PRTIOPORT;
/** Pointer to const I/O Port. */
00425 typedef const RTIOPORT *PCRTIOPORT;

/** Selector. */
00428 typedef uint16_t        RTSEL;
/** Pointer to selector. */
00430 typedef RTSEL          *PRTSEL;
/** Pointer to const selector. */
00432 typedef const RTSEL    *PCRTSEL;

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

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

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

/** @} */


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

/** HC Natural signed integer. */
00482 typedef int32_t         RTHCINT;
/** Pointer to HC Natural signed integer. */
00484 typedef RTHCINT        *PRTHCINT;
/** Pointer to const HC Natural signed integer. */
00486 typedef const RTHCINT  *PCRTHCINT;

/** HC Natural unsigned integer. */
00489 typedef uint32_t        RTHCUINT;
/** Pointer to HC Natural unsigned integer. */
00491 typedef RTHCUINT       *PRTHCUINT;
/** Pointer to const HC Natural unsigned integer. */
00493 typedef const RTHCUINT *PCRTHCUINT;


/** Signed integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32
typedef int32_t         RTHCINTPTR;
#elif HC_ARCH_BITS == 64
typedef int64_t         RTHCINTPTR;
#else
#  error Unsupported HC_ARCH_BITS value.
#endif
/** Pointer to signed interger which can contain a HC pointer. */
00505 typedef RTHCINTPTR     *PRTHCINTPTR;
/** Pointer to const signed interger which can contain a HC pointer. */
00507 typedef const RTHCINTPTR *PCRTHCINTPTR;

/** Signed integer which can contain a HC ring-3 pointer. */
#if R3_ARCH_BITS == 32
typedef int32_t         RTR3INTPTR;
#elif R3_ARCH_BITS == 64
typedef int64_t         RTR3INTPTR;
#else
#  error Unsupported R3_ARCH_BITS value.
#endif
/** Pointer to signed interger which can contain a HC ring-3 pointer. */
00518 typedef RTR3INTPTR     *PRTR3INTPTR;
/** Pointer to const signed interger which can contain a HC ring-3 pointer. */
00520 typedef const RTR3INTPTR *PCRTR3INTPTR;

/** Signed integer which can contain a HC ring-0 pointer. */
#if R0_ARCH_BITS == 32
typedef int32_t         RTR0INTPTR;
#elif R0_ARCH_BITS == 64
typedef int64_t         RTR0INTPTR;
#else
#  error Unsupported R0_ARCH_BITS value.
#endif
/** Pointer to signed interger which can contain a HC ring-0 pointer. */
00531 typedef RTR0INTPTR     *PRTR0INTPTR;
/** Pointer to const signed interger which can contain a HC ring-0 pointer. */
00533 typedef const RTR0INTPTR *PCRTR0INTPTR;


/** Unsigned integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32
typedef uint32_t        RTHCUINTPTR;
#elif HC_ARCH_BITS == 64
typedef uint64_t        RTHCUINTPTR;
#else
#  error Unsupported HC_ARCH_BITS value.
#endif
/** Pointer to unsigned interger which can contain a HC pointer. */
00545 typedef RTHCUINTPTR    *PRTHCUINTPTR;
/** Pointer to unsigned interger which can contain a HC pointer. */
00547 typedef const RTHCUINTPTR *PCRTHCUINTPTR;

/** Unsigned integer which can contain a HC ring-3 pointer. */
#if R3_ARCH_BITS == 32
typedef uint32_t        RTR3UINTPTR;
#elif R3_ARCH_BITS == 64
typedef uint64_t        RTR3UINTPTR;
#else
#  error Unsupported R3_ARCH_BITS value.
#endif
/** Pointer to unsigned interger which can contain a HC ring-3 pointer. */
00558 typedef RTR3UINTPTR    *PRTR3UINTPTR;
/** Pointer to unsigned interger which can contain a HC ring-3 pointer. */
00560 typedef const RTR3UINTPTR *PCRTR3UINTPTR;

/** Unsigned integer which can contain a HC ring-0 pointer. */
#if R0_ARCH_BITS == 32
typedef uint32_t        RTR0UINTPTR;
#elif R0_ARCH_BITS == 64
typedef uint64_t        RTR0UINTPTR;
#else
#  error Unsupported R0_ARCH_BITS value.
#endif
/** Pointer to unsigned interger which can contain a HC ring-0 pointer. */
00571 typedef RTR0UINTPTR    *PRTR0UINTPTR;
/** Pointer to unsigned interger which can contain a HC ring-0 pointer. */
00573 typedef const RTR0UINTPTR *PCRTR0UINTPTR;


/** Host Physical Memory Address.
 * @todo    This should be configurable at compile time too...
 */
00579 typedef uint64_t        RTHCPHYS;
/** Pointer to Host Physical Memory Address. */
00581 typedef RTHCPHYS       *PRTHCPHYS;
/** Pointer to const Host Physical Memory Address. */
00583 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.
 */
00589 #define NIL_RTHCPHYS     ((RTHCPHYS)~0U) /** @todo change this to (~(VBOXHCPHYS)0) */


/** HC pointer. */
#ifndef IN_GC
00594 typedef void *          RTHCPTR;
#else
typedef RTHCUINTPTR     RTHCPTR;
#endif
/** Pointer to HC pointer. */
00599 typedef RTHCPTR        *PRTHCPTR;
/** Pointer to const HC pointer. */
00601 typedef const RTHCPTR  *PCRTHCPTR;
/** @def NIL_RTHCPTR
 * NIL HC pointer.
 */
00605 #define NIL_RTHCPTR     ((RTHCPTR)0)

/** HC ring-3 pointer. */
#ifdef  IN_RING3
typedef void *          RTR3PTR;
#else
00611 typedef RTR3UINTPTR     RTR3PTR;
#endif
/** Pointer to HC ring-3 pointer. */
00614 typedef RTR3PTR        *PRTR3PTR;
/** Pointer to const HC ring-3 pointer. */
00616 typedef const RTR3PTR  *PCRTR3PTR;
/** @def NIL_RTR3PTR
 * NIL HC ring-3 pointer.
 */
00620 #define NIL_RTR3PTR     ((RTR3PTR)0)

/** HC ring-0 pointer. */
#ifdef  IN_RING0
typedef void *          RTR0PTR;
#else
00626 typedef RTR0UINTPTR     RTR0PTR;
#endif
/** Pointer to HC ring-0 pointer. */
00629 typedef RTR0PTR        *PRTR0PTR;
/** Pointer to const HC ring-0 pointer. */
00631 typedef const RTR0PTR  *PCRTR0PTR;
/** @def NIL_RTR0PTR
 * NIL HC ring-0 pointer.
 */
00635 #define NIL_RTR0PTR     ((RTR0PTR)0)


/** Unsigned integer register in the host context. */
#if HC_ARCH_BITS == 32
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. */
00647 typedef RTHCUINTREG        *PRTHCUINTREG;
/** Pointer to a const unsigned integer register in the host context. */
00649 typedef const RTHCUINTREG  *PCRTHCUINTREG;

/** Unsigned integer register in the host ring-3 context. */
#if R3_ARCH_BITS == 32
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. */
00660 typedef RTR3UINTREG        *PRTR3UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
00662 typedef const RTR3UINTREG  *PCRTR3UINTREG;

/** Unsigned integer register in the host ring-3 context. */
#if R0_ARCH_BITS == 32
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. */
00673 typedef RTR0UINTREG        *PRTR0UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
00675 typedef const RTR0UINTREG  *PCRTR0UINTREG;

/** @} */


/** @defgroup grp_rt_types_gc  Guest Context Basic Types
 * @ingroup grp_rt_types
 * @{
 */

/** Natural signed integer in the GC. */
00686 typedef int32_t         RTGCINT;
/** Pointer to natural signed interger in GC. */
00688 typedef RTGCINT        *PRTGCINT;
/** Pointer to const natural signed interger in GC. */
00690 typedef const RTGCINT  *PCRTGCINT;

/** Natural signed uninteger in the GC. */
00693 typedef uint32_t        RTGCUINT;
/** Pointer to natural unsigned interger in GC. */
00695 typedef RTGCUINT       *PRTGCUINT;
/** Pointer to const natural unsigned interger in GC. */
00697 typedef const RTGCUINT *PCRTGCUINT;

/** Signed integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
typedef int32_t         RTGCINTPTR;
#elif GC_ARCH_BITS == 64
typedef int64_t         RTGCINTPTR;
#else
#  error Unsupported GC_ARCH_BITS value.
#endif
/** Pointer to signed interger which can contain a GC pointer. */
00708 typedef RTGCINTPTR     *PRTGCINTPTR;
/** Pointer to const signed interger which can contain a GC pointer. */
00710 typedef const RTGCINTPTR *PCRTGCINTPTR;

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

/** Guest Physical Memory Address.*/
00726 typedef RTGCUINTPTR     RTGCPHYS;
/** Pointer to Guest Physical Memory Address. */
00728 typedef RTGCPHYS       *PRTGCPHYS;
/** Pointer to const Guest Physical Memory Address. */
00730 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.
 */
00736 #define NIL_RTGCPHYS     ((RTGCPHYS)~0U) /** @todo change this to (~(RTGCPHYS)0) */


/** Guest context pointer.
 * Keep in mind that this type is an unsigned integer in
 * HC and void pointer in GC.
 */
#ifdef IN_GC
typedef void           *RTGCPTR;
#else
00746 typedef RTGCUINTPTR     RTGCPTR;
#endif
/** Pointer to a guest context pointer. */
00749 typedef RTGCPTR        *PRTGCPTR;
/** Pointer to a const guest context pointer. */
00751 typedef const RTGCPTR  *PCRTGCPTR;
/** @def NIL_RTGCPTR
 * NIL GC pointer.
 */
00755 #define NIL_RTGCPTR     ((RTGCPTR)0)


/** Unsigned integer register in the guest context. */
#if GC_ARCH_BITS == 32
typedef uint32_t            RTGCUINTREG;
#elif GC_ARCH_BITS == 64
typedef uint64_t            RTGCUINTREG;
#else
# error "Unsupported GC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the guest context. */
00767 typedef RTGCUINTREG        *PRTGCUINTREG;
/** Pointer to a const unsigned integer register in the guest context. */
00769 typedef const RTGCUINTREG  *PCRTGCUINTREG;

/** @} */


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

/** Current Context Physical Memory Address.*/
#ifdef IN_GC
typedef RTGCPHYS RTCCPHYS;
#else
00783 typedef RTHCPHYS RTCCPHYS;
#endif
/** Pointer to Current Context Physical Memory Address. */
00786 typedef RTCCPHYS       *PRTCCPHYS;
/** Pointer to const Current Context Physical Memory Address. */
00788 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_GC
# define NIL_RTCCPHYS   NIL_RTGCPHYS
#else
00797 # define NIL_RTCCPHYS   NIL_RTHCPHYS
#endif

/** Unsigned integer register in the current context. */
#if ARCH_BITS == 32
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. */
00809 typedef RTCCUINTREG        *PRTCCUINTREG;
/** Pointer to a const unsigned integer register in the current context. */
00811 typedef const RTCCUINTREG  *PCRTCCUINTREG;

/** @deprecated */
00814 typedef RTCCUINTREG         RTUINTREG;
/** @deprecated */
00816 typedef RTCCUINTREG        *PRTUINTREG;
/** @deprecated */
00818 typedef const RTCCUINTREG  *PCRTUINTREG;

/** @} */


/** File handle. */
00824 typedef RTUINT                                      RTFILE;
/** Pointer to file handle. */
00826 typedef RTFILE                                     *PRTFILE;
/** Nil file handle. */
00828 #define NIL_RTFILE                                  (~(RTFILE)0)

/** Loader module handle. */
typedef HCPTRTYPE(struct RTLDRMODINTERNAL *)        RTLDRMOD;
/** Pointer to a loader module handle. */
00833 typedef RTLDRMOD                                   *PRTLDRMOD;
/** Nil loader module handle. */
00835 #define NIL_RTLDRMOD                                0

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

/** Native thread handle. */
00845 typedef RTHCUINTPTR                                 RTNATIVETHREAD;
/** Pointer to an native thread handle. */
00847 typedef RTNATIVETHREAD                             *PRTNATIVETHREAD;
/** Nil native thread handle. */
00849 #define NIL_RTNATIVETHREAD                          (~(RTNATIVETHREAD)0)

/** Process identifier. */
00852 typedef uint32_t                                    RTPROCESS;
/** Pointer to a process identifier. */
00854 typedef RTPROCESS                                  *PRTPROCESS;
/** Nil process identifier. */
00856 #define NIL_RTPROCESS                               (~(RTPROCESS)0)

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

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

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

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

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

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

/** Spinlock handle. */
typedef HCPTRTYPE(struct RTSPINLOCKINTERNAL *)      RTSPINLOCK;
/** Pointer to a spinlock handle. */
00908 typedef RTSPINLOCK                                 *PRTSPINLOCK;
/** Nil spinlock handle. */
00910 #define NIL_RTSPINLOCK                              0

/** Socket handle. */
00913 typedef int RTSOCKET;
/** Pointer to socket handle. */
00915 typedef RTSOCKET *PRTSOCKET;
/** Nil socket handle. */
00917 #define NIL_RTSOCKET                                (~(RTSOCKET)0)

/** Thread handle.*/
typedef HCPTRTYPE(struct RTTHREADINT *)             RTTHREAD;
/** Pointer to thread handle. */
00922 typedef RTTHREAD                                   *PRTTHREAD;
/** Nil thread handle. */
00924 #define NIL_RTTHREAD                                0

/** Handle to a simple heap. */
typedef HCPTRTYPE(struct RTHEAPSIMPLEINTERNAL *)    RTHEAPSIMPLE;
/** Pointer to a handle to a simple heap. */
00929 typedef RTHEAPSIMPLE                               *PRTHEAPSIMPLE;
/** NIL simple heap handle. */
00931 #define NIL_RTHEAPSIMPLE                            ((RTHEAPSIMPLE)0)

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


/**
 * UUID data type.
 */
00944 typedef union RTUUID
{
    /** 8-bit view. */
00947     uint8_t     au8[16];
    /** 16-bit view. */
00949     uint16_t    au16[8];
    /** 32-bit view. */
00951     uint32_t    au32[4];
    /** 64-bit view. */
00953     uint64_t    au64[2];
    /** The way the UUID is declared by the ext2 guys. */
    struct
    {
        uint32_t    u32TimeLow;
        uint16_t    u16TimeMid;
        uint16_t    u16TimeHiAndVersion;
        uint16_t    u16ClockSeq;
        uint8_t     au8Node[6];
    } Gen;
    /** @deprecated */
00964     unsigned char aUuid[16];
} RTUUID;
/** Pointer to UUID data. */
00967 typedef RTUUID *PRTUUID;
/** Pointer to readonly UUID data. */
00969 typedef const RTUUID *PCRTUUID;

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


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

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


/**
 * Unicode Code Point.
 */
00987 typedef uint32_t        RTUNICP;
/** Pointer to an Unicode Code Point. */
00989 typedef RTUNICP        *PRTUNICP;
/** Pointer to an Unicode Code Point. */
00991 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 cuc - count of unicode chars - means
 *          count of RTUTF16. And cch means count of the typedef 'char', which is assumed
 *          to be an octet.
 */
01002 typedef uint16_t        RTUTF16;
/** Pointer to a UTF-16 character. */
01004 typedef RTUTF16        *PRTUTF16;
/** Pointer to a const UTF-16 character. */
01006 typedef const RTUTF16  *PCRTUTF16;

/**
 * UCS-2 character.
 * @remark wchar_t is not usable since it's compiler defined.
 * @deprecated  Use RTUTF16!
 */
01013 typedef RTUTF16         RTUCS2;
/** Pointer to UCS-2 character.
 * @deprecated  Use PRTUTF16!
 */
01017 typedef PRTUTF16        PRTUCS2;
/** Pointer to const UCS-2 character.
 * @deprecated  Use PCRTUTF16!
 */
01021 typedef PCRTUTF16       PCRTUCS2;



/**
 * Wait for ever if we have to.
 */
01028 #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(). */
01040 typedef FNRTPROGRESS *PFNRTPROGRESS;


/**
 * Rectangle data type.
 */
01046 typedef struct RTRECT
{
    /** left X coordinate. */
01049     int32_t     xLeft;
    /** top Y coordinate. */
01051     int32_t     yTop;
    /** right X coordinate. (exclusive) */
01053     int32_t     xRight;
    /** bottom Y coordinate. (exclusive) */
01055     int32_t     yBottom;
} RTRECT;
/** Pointer to a rectangle. */
01058 typedef RTRECT *PRTRECT;
/** Pointer to a const rectangle. */
01060 typedef const RTRECT *PCRTRECT;

/** @} */

#endif


Generated by  Doxygen 1.6.0   Back to index