types.h revision e87df5a63825a4aed74b06f10229ee463b26f5c1
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** @file
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * IPRT - Types.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/*
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync *
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync * available from http://www.virtualbox.org. This file is free software;
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync * you can redistribute it and/or modify it under the terms of the GNU
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync * General Public License (GPL) as published by the Free Software
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
bd8e360cd1db83dcb2694ea9122ce3bc5bae678avboxsync *
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * The contents of this file may alternatively be used under the terms
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * of the Common Development and Distribution License Version 1.0
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * VirtualBox OSE distribution, in which case the provisions of the
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * CDDL are applicable instead of those of the GPL.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync *
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * You may elect to license modified versions of this file under the
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * terms and conditions of either the GPL or the CDDL or both.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync *
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
87b2fb3f8283472ba7010aedbf2b4dc12302155cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
87b2fb3f8283472ba7010aedbf2b4dc12302155cvboxsync * additional information or have any questions.
87b2fb3f8283472ba7010aedbf2b4dc12302155cvboxsync */
11a862be79fe123488bccca60c06e92cdbfec6e8vboxsync
87b2fb3f8283472ba7010aedbf2b4dc12302155cvboxsync#ifndef ___iprt_types_h
e38719852d98638514dba23fbacf53ad11361d6avboxsync#define ___iprt_types_h
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#include <iprt/cdefs.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#include <iprt/stdint.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/*
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * Include standard C types.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
c125376ef076c2334e09915c77098cdfef3a4935vboxsync#ifndef IPRT_NO_CRT
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# if defined(RT_OS_DARWIN) && defined(KERNEL)
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync /*
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * Kludge for the darwin kernel:
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * stddef.h is missing IIRC.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# ifndef _PTRDIFF_T
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define _PTRDIFF_T
85c594c1140f082dd862abde9dc7825137a3d51avboxsync typedef __darwin_ptrdiff_t ptrdiff_t;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <sys/types.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /*
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * Kludge for the FreeBSD kernel:
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * stddef.h and sys/types.h has sligtly different offsetof definitions
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * when compiling in kernel mode. This is just to make GCC keep shut.
e38719852d98638514dba23fbacf53ad11361d6avboxsync */
e38719852d98638514dba23fbacf53ad11361d6avboxsync# ifndef _STDDEF_H_
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef offsetof
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <stddef.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# ifndef _SYS_TYPES_H_
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef offsetof
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <sys/types.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# ifndef offsetof
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# error "offsetof is not defined..."
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /*
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * Kludge for the linux kernel:
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * 1. sys/types.h doesn't mix with the kernel.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * declares false and true as enum values.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * We work around these issues here and nowhere else.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <stddef.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# if defined(__cplusplus)
85c594c1140f082dd862abde9dc7825137a3d51avboxsync typedef bool _Bool;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define bool linux_bool
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define true linux_true
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define false linux_false
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define uintptr_t linux_uintptr_t
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <linux/autoconf.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <linux/types.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <linux/stddef.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef uintptr_t
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef false
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef true
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef bool
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# else
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <stddef.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# include <sys/types.h>
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/* Define any types missing from sys/types.h on windows. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# ifdef _MSC_VER
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef ssize_t
85c594c1140f082dd862abde9dc7825137a3d51avboxsync typedef intptr_t ssize_t;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync#else /* no crt */
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync# include <iprt/nocrt/compiler/gcc.h>
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync#endif /* no crt */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** @defgroup grp_rt_types IPRT Base Types
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * @{
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
e38719852d98638514dba23fbacf53ad11361d6avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/* define wchar_t, we don't wanna include all the wcsstuff to get this. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#ifdef _MSC_VER
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# ifndef _WCHAR_T_DEFINED
85c594c1140f082dd862abde9dc7825137a3d51avboxsync typedef unsigned short wchar_t;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define _WCHAR_T_DEFINED
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#ifdef __GNUC__
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** @todo wchar_t on GNUC */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/*
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * C doesn't have bool.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#ifndef __cplusplus
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# if defined(__GNUC__)
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# if defined(RT_OS_LINUX) && __GNUC__ < 3
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef uint8_t bool;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# else
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# undef bool
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef _Bool bool;
e38719852d98638514dba23fbacf53ad11361d6avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# else
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef unsigned char bool;
e38719852d98638514dba23fbacf53ad11361d6avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# ifndef true
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define true (1)
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# endif
e38719852d98638514dba23fbacf53ad11361d6avboxsync# ifndef false
85c594c1140f082dd862abde9dc7825137a3d51avboxsync# define false (0)
e38719852d98638514dba23fbacf53ad11361d6avboxsync# endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/**
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * 128-bit unsigned integer.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef __uint128_t uint128_t;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#else
e38719852d98638514dba23fbacf53ad11361d6avboxsynctypedef struct uint128_s
85c594c1140f082dd862abde9dc7825137a3d51avboxsync{
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint64_t Lo;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint64_t Hi;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync} uint128_t;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync#endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
11a862be79fe123488bccca60c06e92cdbfec6e8vboxsync
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsync/**
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsync * 128-bit signed integer.
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsync */
11a862be79fe123488bccca60c06e92cdbfec6e8vboxsync#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsynctypedef __int128_t int128_t;
11a862be79fe123488bccca60c06e92cdbfec6e8vboxsync#else
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsynctypedef struct int128_s
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsync{
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsync uint64_t lo;
1c8130d3c423590046a8ed4f3059de38ac5dcc14vboxsync int64_t hi;
e38719852d98638514dba23fbacf53ad11361d6avboxsync} int128_t;
c125376ef076c2334e09915c77098cdfef3a4935vboxsync#endif
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/**
85c594c1140f082dd862abde9dc7825137a3d51avboxsync * 16-bit unsigned interger union.
85c594c1140f082dd862abde9dc7825137a3d51avboxsync */
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef union RTUINT16U
85c594c1140f082dd862abde9dc7825137a3d51avboxsync{
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** natural view. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync uint16_t u;
bb06e22bdfd9b2cee861f442188cbdf2673633eevboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** 16-bit view. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint16_t au16[1];
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** 8-bit view. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync uint8_t au8[4];
e38719852d98638514dba23fbacf53ad11361d6avboxsync /** 16-bit hi/lo view. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync struct
85c594c1140f082dd862abde9dc7825137a3d51avboxsync {
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync uint16_t Lo;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync uint16_t Hi;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync } s;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync} RTUINT16U;
bb06e22bdfd9b2cee861f442188cbdf2673633eevboxsync/** Pointer to a 16-bit unsigned interger union. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsynctypedef RTUINT16U *PRTUINT16U;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync/** Pointer to a const 32-bit unsigned interger union. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsynctypedef const RTUINT16U *PCRTUINT16U;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync/**
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync * 32-bit unsigned interger union.
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsynctypedef union RTUINT32U
85c594c1140f082dd862abde9dc7825137a3d51avboxsync{
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** natural view. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync uint32_t u;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** Hi/Low view. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync struct
85c594c1140f082dd862abde9dc7825137a3d51avboxsync {
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint16_t Lo;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint16_t Hi;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync } s;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync /** Word view. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync struct
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync {
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint16_t w0;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint16_t w1;
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync } Words;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** 32-bit view. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint32_t au32[1];
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** 16-bit view. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint16_t au16[2];
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** 8-bit view. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsync uint8_t au8[4];
85c594c1140f082dd862abde9dc7825137a3d51avboxsync} RTUINT32U;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** Pointer to a 32-bit unsigned interger union. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef RTUINT32U *PRTUINT32U;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** Pointer to a const 32-bit unsigned interger union. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsynctypedef const RTUINT32U *PCRTUINT32U;
e38719852d98638514dba23fbacf53ad11361d6avboxsync
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync/**
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync * 64-bit unsigned interger union.
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync */
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsynctypedef union RTUINT64U
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync{
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync /** Natural view. */
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint64_t u;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync /** Hi/Low view. */
e38719852d98638514dba23fbacf53ad11361d6avboxsync struct
e38719852d98638514dba23fbacf53ad11361d6avboxsync {
e38719852d98638514dba23fbacf53ad11361d6avboxsync uint32_t Lo;
e38719852d98638514dba23fbacf53ad11361d6avboxsync uint32_t Hi;
e38719852d98638514dba23fbacf53ad11361d6avboxsync } s;
e38719852d98638514dba23fbacf53ad11361d6avboxsync /** Double-Word view. */
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync struct
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync {
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint32_t dw0;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint32_t dw1;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync } DWords;
e38719852d98638514dba23fbacf53ad11361d6avboxsync /** Word view. */
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync struct
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync {
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint16_t w0;
e38719852d98638514dba23fbacf53ad11361d6avboxsync uint16_t w1;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint16_t w2;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint16_t w3;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync } Words;
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync /** 64-bit view. */
6af51bfa1c7d9c89f657cac458247875a191ca48vboxsync uint64_t au64[1];
85c594c1140f082dd862abde9dc7825137a3d51avboxsync /** 32-bit view. */
e38719852d98638514dba23fbacf53ad11361d6avboxsync uint32_t au32[2];
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync /** 16-bit view. */
e38719852d98638514dba23fbacf53ad11361d6avboxsync uint16_t au16[4];
e38719852d98638514dba23fbacf53ad11361d6avboxsync /** 8-bit view. */
4ad933b349952e43d0b6ce21b3f5e2833ca04e85vboxsync uint8_t au8[8];
85c594c1140f082dd862abde9dc7825137a3d51avboxsync} RTUINT64U;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** Pointer to a 64-bit unsigned interger union. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef RTUINT64U *PRTUINT64U;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync/** Pointer to a const 64-bit unsigned interger union. */
85c594c1140f082dd862abde9dc7825137a3d51avboxsynctypedef const RTUINT64U *PCRTUINT64U;
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
85c594c1140f082dd862abde9dc7825137a3d51avboxsync
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync/**
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync * 128-bit unsigned interger union.
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync */
51c2e697d33363fc2bbd49233b25addb678f5977vboxsynctypedef union RTUINT128U
e38719852d98638514dba23fbacf53ad11361d6avboxsync{
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync /** Natural view.
e38719852d98638514dba23fbacf53ad11361d6avboxsync * WARNING! This member depends on compiler supporing 128-bit stuff. */
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync uint128_t u;
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync /** Hi/Low view. */
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync struct
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync {
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync uint64_t Lo;
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync uint64_t Hi;
e38719852d98638514dba23fbacf53ad11361d6avboxsync } s;
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync /** Quad-Word view. */
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync struct
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync {
2754bcbb9370f7d57b39cc5b6074e77cfdfb1f0fvboxsync uint64_t qw0;
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync uint64_t qw1;
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync } QWords;
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync /** Double-Word view. */
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync struct
6c18f0d84a7efbca87357d7042a44d7667d473d0vboxsync {
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync uint32_t dw0;
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync uint32_t dw1;
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync uint32_t dw2;
51c2e697d33363fc2bbd49233b25addb678f5977vboxsync uint32_t dw3;
6edb4183bc898fddcd0987b6c5c3903b8246fe45vboxsync } DWords;
87b2fb3f8283472ba7010aedbf2b4dc12302155cvboxsync /** Word view. */
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync struct
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync {
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync uint16_t w0;
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync uint16_t w1;
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync uint16_t w2;
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync uint16_t w3;
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync uint16_t w4;
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync uint16_t w5;
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync uint16_t w6;
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync uint16_t w7;
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync } Words;
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync
df10dfd3a6bb44f9efa6ab00ef05106dce6e14e9vboxsync /** 64-bit view. */
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync uint64_t au64[2];
b0dc8edd8414359c1d0f55edb4a4125cc04b1117vboxsync /** 32-bit view. */
uint32_t au32[4];
/** 16-bit view. */
uint16_t au16[8];
/** 8-bit view. */
uint8_t au8[16];
} RTUINT128U;
/** Pointer to a 64-bit unsigned interger union. */
typedef RTUINT128U *PRTUINT128U;
/** Pointer to a const 64-bit unsigned interger 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.
*/
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. */
typedef RTINTPTR *PRTINTPTR;
/** 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. */
#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. */
typedef RTUINTPTR *PRTUINTPTR;
/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
typedef const RTUINTPTR *PCRTUINTPTR;
/** Signed integer. */
typedef int32_t RTINT;
/** Pointer to signed integer. */
typedef RTINT *PRTINT;
/** Pointer to const signed integer. */
typedef const RTINT *PCRTINT;
/** Unsigned integer. */
typedef uint32_t RTUINT;
/** Pointer to unsigned integer. */
typedef RTUINT *PRTUINT;
/** Pointer to const unsigned integer. */
typedef const RTUINT *PCRTUINT;
/** A file offset / size (off_t). */
typedef int64_t RTFOFF;
/** Pointer to a file offset / size. */
typedef RTFOFF *PRTFOFF;
/** The max value for RTFOFF. */
#define RTFOFF_MAX INT64_MAX
/** The min value for RTFOFF. */
#define RTFOFF_MIN INT64_MIN
/** File mode (see iprt/fs.h). */
typedef uint32_t RTFMODE;
/** Pointer to file mode. */
typedef RTFMODE *PRTFMODE;
/** Device unix number. */
typedef uint32_t RTDEV;
/** Pointer to a device unix number. */
typedef RTDEV *PRTDEV;
/** i-node number. */
typedef uint64_t RTINODE;
/** Pointer to a i-node number. */
typedef RTINODE *PRTINODE;
/** User id. */
typedef uint32_t RTUID;
/** Pointer to a user id. */
typedef RTUID *PRTUID;
/** NIL user id.
* @todo check this for portability! */
#define NIL_RTUID (~(RTUID)0);
/** Group id. */
typedef uint32_t RTGID;
/** Pointer to a group id. */
typedef RTGID *PRTGID;
/** NIL group id.
* @todo check this for portability! */
#define NIL_RTGID (~(RTGID)0);
/** I/O Port. */
typedef uint16_t RTIOPORT;
/** Pointer to I/O Port. */
typedef RTIOPORT *PRTIOPORT;
/** Pointer to const I/O Port. */
typedef const RTIOPORT *PCRTIOPORT;
/** Selector. */
typedef uint16_t RTSEL;
/** Pointer to selector. */
typedef RTSEL *PRTSEL;
/** Pointer to const selector. */
typedef const RTSEL *PCRTSEL;
/** Far 16-bit pointer. */
#pragma pack(1)
typedef struct RTFAR16
{
uint16_t off;
RTSEL sel;
} RTFAR16;
#pragma pack()
/** Pointer to Far 16-bit pointer. */
typedef RTFAR16 *PRTFAR16;
/** Pointer to const Far 16-bit pointer. */
typedef const RTFAR16 *PCRTFAR16;
/** Far 32-bit pointer. */
#pragma pack(1)
typedef struct RTFAR32
{
uint32_t off;
RTSEL sel;
} RTFAR32;
#pragma pack()
/** Pointer to Far 32-bit pointer. */
typedef RTFAR32 *PRTFAR32;
/** Pointer to const Far 32-bit pointer. */
typedef const RTFAR32 *PCRTFAR32;
/** Far 64-bit pointer. */
#pragma pack(1)
typedef struct RTFAR64
{
uint64_t off;
RTSEL sel;
} RTFAR64;
#pragma pack()
/** Pointer to Far 64-bit pointer. */
typedef RTFAR64 *PRTFAR64;
/** Pointer to const Far 64-bit pointer. */
typedef const RTFAR64 *PCRTFAR64;
/** @} */
/** @defgroup grp_rt_types_hc Host Context Basic Types
* @ingroup grp_rt_types
* @{
*/
/** HC Natural signed integer. */
typedef int32_t RTHCINT;
/** Pointer to HC Natural signed integer. */
typedef RTHCINT *PRTHCINT;
/** Pointer to const HC Natural signed integer. */
typedef const RTHCINT *PCRTHCINT;
/** HC Natural unsigned integer. */
typedef uint32_t RTHCUINT;
/** Pointer to HC Natural unsigned integer. */
typedef RTHCUINT *PRTHCUINT;
/** Pointer to const HC Natural unsigned integer. */
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. */
typedef RTHCINTPTR *PRTHCINTPTR;
/** Pointer to const signed interger which can contain a HC pointer. */
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. */
typedef RTR3INTPTR *PRTR3INTPTR;
/** Pointer to const signed interger which can contain a HC ring-3 pointer. */
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. */
typedef RTR0INTPTR *PRTR0INTPTR;
/** Pointer to const signed interger which can contain a HC ring-0 pointer. */
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. */
typedef RTHCUINTPTR *PRTHCUINTPTR;
/** Pointer to unsigned interger which can contain a HC pointer. */
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. */
typedef RTR3UINTPTR *PRTR3UINTPTR;
/** Pointer to unsigned interger which can contain a HC ring-3 pointer. */
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. */
typedef RTR0UINTPTR *PRTR0UINTPTR;
/** Pointer to unsigned interger which can contain a HC ring-0 pointer. */
typedef const RTR0UINTPTR *PCRTR0UINTPTR;
/** Host Physical Memory Address. */
typedef uint64_t RTHCPHYS;
/** Pointer to Host Physical Memory Address. */
typedef RTHCPHYS *PRTHCPHYS;
/** 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)~0U) /** @todo change this to (~(VBOXHCPHYS)0) */
/** HC pointer. */
#ifndef IN_GC
typedef void * RTHCPTR;
#else
typedef RTHCUINTPTR RTHCPTR;
#endif
/** Pointer to HC pointer. */
typedef RTHCPTR *PRTHCPTR;
/** Pointer to const HC pointer. */
typedef const RTHCPTR *PCRTHCPTR;
/** @def NIL_RTHCPTR
* NIL HC pointer.
*/
#define NIL_RTHCPTR ((RTHCPTR)0)
/** HC ring-3 pointer. */
#ifdef IN_RING3
typedef void * RTR3PTR;
#else
typedef RTR3UINTPTR RTR3PTR;
#endif
/** Pointer to HC ring-3 pointer. */
typedef RTR3PTR *PRTR3PTR;
/** Pointer to const HC ring-3 pointer. */
typedef const RTR3PTR *PCRTR3PTR;
/** @def NIL_RTR3PTR
* NIL HC ring-3 pointer.
*/
#define NIL_RTR3PTR ((RTR3PTR)0)
/** HC ring-0 pointer. */
#ifdef IN_RING0
typedef void * RTR0PTR;
#else
typedef RTR0UINTPTR RTR0PTR;
#endif
/** Pointer to HC ring-0 pointer. */
typedef RTR0PTR *PRTR0PTR;
/** Pointer to const HC ring-0 pointer. */
typedef const RTR0PTR *PCRTR0PTR;
/** @def NIL_RTR0PTR
* NIL HC ring-0 pointer.
*/
#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. */
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;
#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. */
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;
#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. */
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. */
#if GC_ARCH_BITS == 32
typedef int32_t RTGCINT;
#elif GC_ARCH_BITS == 64
typedef int64_t RTGCINT;
#endif
/** Pointer to natural signed interger in GC. */
typedef RTGCINT *PRTGCINT;
/** Pointer to const natural signed interger in GC. */
typedef const RTGCINT *PCRTGCINT;
/** Natural unsigned integer in the GC. */
#if GC_ARCH_BITS == 32
typedef uint32_t RTGCUINT;
#elif GC_ARCH_BITS == 64
typedef uint64_t RTGCUINT;
#endif
/** Pointer to natural unsigned integer in GC. */
typedef RTGCUINT *PRTGCUINT;
/** Pointer to const natural unsigned integer in GC. */
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;
#endif
/** Pointer to signed interger which can contain a GC pointer. */
typedef RTGCINTPTR *PRTGCINTPTR;
/** Pointer to const signed interger 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;
#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. */
typedef RTGCUINTPTR *PRTGCUINTPTR;
/** Pointer to unsigned interger 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 interger which can contain a 32 bits GC pointer. */
typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
/** Pointer to unsigned interger 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 interger which can contain a 32 bits GC pointer. */
typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
/** Pointer to unsigned interger which can contain a 32 bits GC pointer. */
typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
/** Guest Physical Memory Address.*/
typedef uint64_t RTGCPHYS;
/** Pointer to Guest Physical Memory Address. */
typedef RTGCPHYS *PRTGCPHYS;
/** 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)
/** 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
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
#elif GC_ARCH_BITS == 32
typedef RTGCPTR32 RTGCPTR;
/** 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
#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;
#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. */
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 GC.
*/
#ifdef IN_GC
typedef void * RTRCPTR;
#else
typedef uint32_t RTRCPTR;
#endif
/** Pointer to a raw mode context pointer. */
typedef RTRCPTR *PRTRCPTR;
/** Pointer to a const raw mode context pointer. */
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.
*/
#define RTRCPTR_MAX ((RTRCPTR)~0)
typedef int32_t RTRCINTPTR;
typedef uint32_t RTRCUINTPTR;
/** @} */
/** @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
typedef RTHCPHYS RTCCPHYS;
#endif
/** Pointer to Current Context Physical Memory Address. */
typedef RTCCPHYS *PRTCCPHYS;
/** 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_GC
# define NIL_RTCCPHYS NIL_RTGCPHYS
#else
# define NIL_RTCCPHYS NIL_RTHCPHYS
#endif
/** Unsigned integer register in the current 32 bits context. */
typedef uint32_t RTCCUINTREG32;
/** Pointer to an unsigned integer register in the current context. */
typedef RTCCUINTREG32 *PRTCCUINTREG32;
/** Pointer to a const unsigned integer register in the current context. */
typedef const RTCCUINTREG32 *PCRTCCUINTREG32;
/** Unsigned integer register in the current 64 bits context. */
typedef uint64_t RTCCUINTREG64;
/** Pointer to an unsigned integer register in the current context. */
typedef RTCCUINTREG64 *PRTCCUINTREG64;
/** Pointer to a const unsigned integer register in the current context. */
typedef const RTCCUINTREG64 *PCRTCCUINTREG64;
/** Unsigned integer register in the current context. */
#if ARCH_BITS == 32
typedef RTCCUINTREG32 RTCCUINTREG;
/** Pointer to an unsigned integer register in the current context. */
typedef PRTCCUINTREG32 PRTCCUINTREG;
/** Pointer to a const unsigned integer register in the current context. */
typedef PCRTCCUINTREG32 PCRTCCUINTREG;
#elif ARCH_BITS == 64
typedef RTCCUINTREG64 RTCCUINTREG;
/** Pointer to an unsigned integer register in the current context. */
typedef PRTCCUINTREG64 PRTCCUINTREG;
/** Pointer to a const unsigned integer register in the current context. */
typedef PCRTCCUINTREG64 PCRTCCUINTREG;
#else
# error "Unsupported ARCH_BITS!"
#endif
/** @} */
/** File handle. */
typedef RTUINT RTFILE;
/** Pointer to file handle. */
typedef RTFILE *PRTFILE;
/** Nil file handle. */
#define NIL_RTFILE (~(RTFILE)0)
/** Loader module handle. */
typedef R3PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
/** Pointer to a loader module handle. */
typedef RTLDRMOD *PRTLDRMOD;
/** Nil loader module handle. */
#define NIL_RTLDRMOD 0
/** Ring-0 memory object handle. */
typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *) RTR0MEMOBJ;
/** 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. */
typedef uint32_t RTPROCESS;
/** 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. */
typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *) RTSEMEVENT;
/** Pointer to an event semaphore handle. */
typedef RTSEMEVENT *PRTSEMEVENT;
/** Nil event semaphore handle. */
#define NIL_RTSEMEVENT 0
/** @typedef RTSEMEVENTMULTI
* Event Multiple Release Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
/** 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. */
typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
/** Pointer to a mutex semaphore handle. */
typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
/** Nil fast mutex semaphore handle. */
#define NIL_RTSEMFASTMUTEX 0
/** @typedef RTSEMMUTEX
* Mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *) RTSEMMUTEX;
/** Pointer to a mutex semaphore handle. */
typedef RTSEMMUTEX *PRTSEMMUTEX;
/** Nil mutex semaphore handle. */
#define NIL_RTSEMMUTEX 0
/** @typedef RTSEMRW
* Read/Write Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *) RTSEMRW;
/** Pointer to a read/write semaphore handle. */
typedef RTSEMRW *PRTSEMRW;
/** Nil read/write semaphore handle. */
#define NIL_RTSEMRW 0
/** Spinlock handle. */
typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *) RTSPINLOCK;
/** Pointer to a spinlock handle. */
typedef RTSPINLOCK *PRTSPINLOCK;
/** Nil spinlock handle. */
#define NIL_RTSPINLOCK 0
/** Socket handle. */
typedef int RTSOCKET;
/** Pointer to socket handle. */
typedef RTSOCKET *PRTSOCKET;
/** Nil socket handle. */
#define NIL_RTSOCKET (~(RTSOCKET)0)
/** Thread handle.*/
typedef R3R0PTRTYPE(struct RTTHREADINT *) RTTHREAD;
/** Pointer to thread handle. */
typedef RTTHREAD *PRTTHREAD;
/** Nil thread handle. */
#define NIL_RTTHREAD 0
/** A TLS index. */
typedef int RTTLS;
/** Pointer to a TLS index. */
typedef RTTLS *PRTTLS;
/** Pointer to a const TLS index. */
typedef RTTLS const *PCRTTLS;
/** NIL TLS index value. */
#define NIL_RTTLS (-1)
/** Handle to a simple heap. */
typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *) RTHEAPSIMPLE;
/** 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. */
typedef R3PTRTYPE(struct RTENVINTERNAL *) RTENV;
/** Pointer to a handle to an environment block. */
typedef RTENV *PRTENV;
/** NIL simple heap handle. */
#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. */
typedef RTHCUINTPTR RTCPUID;
/** Pointer to a CPU identifier. */
typedef RTCPUID *PRTCPUID;
/** Pointer to a const CPU identifier. */
typedef RTCPUID const *PCRTCPUID;
/** Nil CPU Id. */
#define NIL_RTCPUID ((RTCPUID)~0)
/** A CPU set.
* Treat this as an opaque type and always use RTCpuSet* for manupulating it. */
typedef uint64_t RTCPUSET;
/** Pointer to a CPU set. */
typedef RTCPUSET *PRTCPUSET;
/** Pointer to a const CPU set. */
typedef RTCPUSET const *PCRTCPUSET;
/** A handle table handle. */
typedef struct RTHANDLETABLEINT *RTHANDLETABLE;
/** A pointer to a handle table handle. */
typedef RTHANDLETABLE *PRTHANDLETABLE;
/** @def NIL_RTHANDLETABLE
* NIL handle table handle. */
#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
/**
* UUID data type.
*/
typedef union RTUUID
{
/** 8-bit view. */
uint8_t au8[16];
/** 16-bit view. */
uint16_t au16[8];
/** 32-bit view. */
uint32_t au32[4];
/** 64-bit view. */
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 */
unsigned char aUuid[16];
} RTUUID;
/** Pointer to UUID data. */
typedef RTUUID *PRTUUID;
/** Pointer to readonly UUID data. */
typedef const RTUUID *PCRTUUID;
/**
* UUID string maximum length.
*/
#define RTUUID_STR_LENGTH 37
/** Compression handle. */
typedef struct RTZIPCOMP *PRTZIPCOMP;
/** Decompressor handle. */
typedef struct RTZIPDECOMP *PRTZIPDECOMP;
/**
* Unicode Code Point.
*/
typedef uint32_t RTUNICP;
/** Pointer to an Unicode Code Point. */
typedef RTUNICP *PRTUNICP;
/** Pointer to an Unicode Code Point. */
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.
*/
typedef uint16_t RTUTF16;
/** Pointer to a UTF-16 character. */
typedef RTUTF16 *PRTUTF16;
/** Pointer to a const UTF-16 character. */
typedef const RTUTF16 *PCRTUTF16;
/**
* 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.
*/
typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
/** Pointer to a generic progress callback function, FNRTPROCESS(). */
typedef FNRTPROGRESS *PFNRTPROGRESS;
/**
* Rectangle data type.
*/
typedef struct RTRECT
{
/** left X coordinate. */
int32_t xLeft;
/** top Y coordinate. */
int32_t yTop;
/** right X coordinate. (exclusive) */
int32_t xRight;
/** bottom Y coordinate. (exclusive) */
int32_t yBottom;
} RTRECT;
/** Pointer to a rectangle. */
typedef RTRECT *PRTRECT;
/** Pointer to a const rectangle. */
typedef const RTRECT *PCRTRECT;
/** @} */
#endif