6 * Copyright (C) 2006-2017 Oracle Corporation
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
26 #ifndef ___iprt_types_h
27 #define ___iprt_types_h
29 #include <iprt/cdefs.h>
30 #include <iprt/stdint.h>
31 #include <iprt/stdarg.h>
34 * Include standard C types.
38 # if defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
40 * Kludge for xfree86 modules: size_t and other types are redefined.
43 # include "xf86_ansic.h"
47 # elif defined(RT_OS_DARWIN) && defined(KERNEL)
49 * Kludge for the darwin kernel:
50 * stddef.h is missing IIRC.
54 typedef __darwin_ptrdiff_t
ptrdiff_t;
56 # include <sys/types.h>
58 # elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
60 * Kludge for the FreeBSD kernel:
61 * stddef.h and sys/types.h have slightly different offsetof definitions
62 * when compiling in kernel mode. This is just to make GCC shut up.
67 # include <sys/stddef.h>
68 # ifndef _SYS_TYPES_H_
71 # include <sys/types.h>
73 # error "offsetof is not defined!"
76 # elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
78 * Kludge for compiling 32-bit code on a 64-bit FreeBSD:
79 * FreeBSD declares uint64_t and int64_t wrong (long unsigned and long int
80 * though they need to be long long unsigned and long long int). These
81 * defines conflict with our declaration in stdint.h. Adding the defines
82 * below omits the definitions in the system header.
85 # define _UINT64_T_DECLARED
86 # define _INT64_T_DECLARED
87 # define _UINTPTR_T_DECLARED
88 # define _INTPTR_T_DECLARED
89 # include <sys/types.h>
91 # elif defined(RT_OS_NETBSD) && defined(_KERNEL)
93 # include <sys/types.h>
96 * Kludge for NetBSD-6.x where the definition of bool in
97 * <sys/types.h> does not check for C++.
99 # if defined(__cplusplus) && defined(bool)
106 * Kludge for NetBSD-6.x where <sys/types.h> does not define
107 * ptrdiff_t for the kernel code. Note that we don't worry about
108 * redefinition in <stddef.h> since that header doesn't exist for
111 # ifdef _BSD_PTRDIFF_T_
112 typedef _BSD_PTRDIFF_T_
ptrdiff_t;
115 # elif defined(RT_OS_LINUX) && defined(__KERNEL__)
117 * Kludge for the linux kernel:
118 * 1. sys/types.h doesn't mix with the kernel.
119 * 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
120 * declares false and true as enum values.
121 * 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
122 * We work around these issues here and nowhere else.
125 # if defined(__cplusplus)
128 # define bool linux_bool
129 # define true linux_true
130 # define false linux_false
131 # define uintptr_t linux_uintptr_t
132 # include <linux/version.h>
133 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
134 # include <generated/autoconf.h>
136 # ifndef AUTOCONF_INCLUDED
137 # include <linux/autoconf.h>
140 # include <linux/compiler.h>
141 # if defined(__cplusplus)
143 * Starting with 3.3, <linux/compiler-gcc.h> appends 'notrace' (which
144 * expands to __attribute__((no_instrument_function))) to inline,
145 * __inline and __inline__. Revert that.
148 # define inline inline
150 # define __inline__ __inline__
152 # define __inline __inline
154 # include <linux/types.h>
155 # include <linux/stddef.h>
157 * Starting with 3.4, <linux/stddef.h> defines NULL as '((void*)0)' which
158 * does not work for C++ code.
163 # if !RT_GNUC_PREREQ(4, 1)
165 * <linux/compiler-gcc{3,4}.h> does
166 * #define __inline__ __inline__ __attribute__((always_inline))
167 * in some older Linux kernels. Forcing inlining will fail for some RTStrA*
168 * functions with gcc <= 4.0 due to passing variable argument lists.
171 # define __inline__ __inline__
179 # include <sys/types.h>
183 /* Define any types missing from sys/types.h on windows. */
186 typedef intptr_t ssize_t
;
190 # include <iprt/nocrt/compiler/compiler.h>
202 # define NULL ((void*)0)
208 /** @defgroup grp_rt_types IPRT Base Types
212 /* define wchar_t, we don't wanna include all the wcsstuff to get this. */
214 # ifndef _WCHAR_T_DEFINED
215 typedef unsigned short wchar_t;
216 # define _WCHAR_T_DEFINED
220 /** @todo wchar_t on GNUC */
224 * C doesn't have bool, nor does VisualAge for C++ v3.08.
226 #if !defined(__cplusplus) || (defined(__IBMCPP__) && defined(RT_OS_OS2))
227 # if defined(__GNUC__)
228 # if defined(RT_OS_LINUX) && __GNUC__ < 3
229 typedef uint8_t bool;
230 # elif defined(RT_OS_FREEBSD)
231 # ifndef __bool_true_false_are_defined
234 # elif defined(RT_OS_NETBSD)
235 # if !defined(_KERNEL)
237 * For the kernel code <stdbool.h> is not available, but bool is
238 * provided by <sys/types.h> included above.
240 # include <stdbool.h>
243 * ... but the story doesn't end here. The C standard says that
244 * <stdbool.h> defines preprocessor macro "bool" that expands to
245 * "_Bool", but adds that a program may undefine/redefine it
246 * (this is 7.16 in C99 and 7.18 in C11). We have to play this
247 * game here because X11 code uses "bool" as a struct member name
248 * - so undefine "bool" and provide it as a typedef instead. We
249 * still keep #include <stdbool.h> so that any code that might
250 * include it later doesn't mess things up.
256 # if (defined(RT_OS_DARWIN) || defined(RT_OS_HAIKU)) && (defined(_STDBOOL_H) || defined(__STDBOOL_H))
262 # if RT_MSC_PREREQ(RT_MSC_VER_VC120)
263 # include <stdbool.h>
265 typedef unsigned char bool;
277 * 128-bit unsigned integer.
279 #if defined(__GNUC__) && defined(RT_ARCH_AMD64)
280 typedef __uint128_t uint128_t
;
282 typedef struct uint128_s
284 # ifdef RT_BIG_ENDIAN
296 * 128-bit signed integer.
298 #if defined(__GNUC__) && defined(RT_ARCH_AMD64)
299 typedef __int128_t int128_t
;
301 typedef struct int128_s
303 # ifdef RT_BIG_ENDIAN
315 * 16-bit unsigned integer union.
317 typedef union RTUINT16U
326 /** 16-bit hi/lo view. */
338 /** Pointer to a 16-bit unsigned integer union. */
339 typedef RTUINT16U RT_FAR
*PRTUINT16U
;
340 /** Pointer to a const 32-bit unsigned integer union. */
341 typedef const RTUINT16U RT_FAR
*PCRTUINT16U
;
345 * 32-bit unsigned integer union.
347 typedef union RTUINT32U
381 /** Pointer to a 32-bit unsigned integer union. */
382 typedef RTUINT32U RT_FAR
*PRTUINT32U
;
383 /** Pointer to a const 32-bit unsigned integer union. */
384 typedef const RTUINT32U RT_FAR
*PCRTUINT32U
;
388 * 64-bit unsigned integer union.
390 typedef union RTUINT64U
405 /** Double-Word view. */
441 /** Pointer to a 64-bit unsigned integer union. */
442 typedef RTUINT64U RT_FAR
*PRTUINT64U
;
443 /** Pointer to a const 64-bit unsigned integer union. */
444 typedef const RTUINT64U RT_FAR
*PCRTUINT64U
;
448 * 128-bit unsigned integer union.
451 typedef union RTUINT128U
454 * @remarks We put this first so we can have portable initializers
455 * (RTUINT128_INIT) */
468 * WARNING! This member depends on the compiler supporting 128-bit stuff. */
471 /** Quad-Word view. */
482 /** Double-Word view. */
531 /** Pointer to a 128-bit unsigned integer union. */
532 typedef RTUINT128U RT_FAR
*PRTUINT128U
;
533 /** Pointer to a const 128-bit unsigned integer union. */
534 typedef const RTUINT128U RT_FAR
*PCRTUINT128U
;
536 /** @def RTUINT128_INIT
537 * Portable RTUINT128U initializer. */
539 # define RTUINT128_INIT(a_Hi, a_Lo) { { a_Hi, a_Lo } }
541 # define RTUINT128_INIT(a_Hi, a_Lo) { { a_Lo, a_Hi } }
544 /** @def RTUINT128_INIT_C
545 * Portable RTUINT128U initializer for 64-bit constants. */
547 # define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Hi), UINT64_C(a_Lo) } }
549 # define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Lo), UINT64_C(a_Hi) } }
554 * 256-bit unsigned integer union.
557 typedef union RTUINT256U
559 /** Quad-Word view (first as it's used by RTUINT256_INIT). */
574 /** Double-Word view. */
637 /** Double-Quad-Word view. */
661 /** Pointer to a 256-bit unsigned integer union. */
662 typedef RTUINT256U RT_FAR
*PRTUINT256U
;
663 /** Pointer to a const 256-bit unsigned integer union. */
664 typedef const RTUINT256U RT_FAR
*PCRTUINT256U
;
666 /** @def RTUINT256_INIT
667 * Portable RTUINT256U initializer. */
669 # define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
671 # define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw0, a_Qw1, a_Qw2, a_Qw3 } }
674 /** @def RTUINT256_INIT_C
675 * Portable RTUINT256U initializer for 64-bit constants. */
676 #define RTUINT256_INIT_C(a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
677 RTUINT256_INIT(UINT64_C(a_Qw3), UINT64_C(a_Qw2), UINT64_C(a_Qw1), UINT64_C(a_Qw0))
681 * 512-bit unsigned integer union.
684 typedef union RTUINT512U
686 /** Quad-Word view (first as it's used by RTUINT512_INIT). */
709 /** Double-Word view. */
820 /** Double-Quad-Word view. */
836 /** Octo-Word view. */
866 /** Pointer to a 512-bit unsigned integer union. */
867 typedef RTUINT512U RT_FAR
*PRTUINT512U
;
868 /** Pointer to a const 512-bit unsigned integer union. */
869 typedef const RTUINT512U RT_FAR
*PCRTUINT512U
;
871 /** @def RTUINT512_INIT
872 * Portable RTUINT512U initializer. */
874 # define RTUINT512_INIT(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
875 { { a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
877 # define RTUINT512_INIT(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
878 { { a_Qw0, a_Qw1, a_Qw2, a_Qw3, a_Qw4, a_Qw5, a_Qw6, a_Qw7 } }
881 /** @def RTUINT512_INIT_C
882 * Portable RTUINT512U initializer for 64-bit constants. */
883 #define RTUINT512_INIT_C(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
884 RTUINT512_INIT(UINT64_C(a_Qw7), UINT64_C(a_Qw6), UINT64_C(a_Qw5), UINT64_C(a_Qw4), \
885 UINT64_C(a_Qw3), UINT64_C(a_Qw2), UINT64_C(a_Qw1), UINT64_C(a_Qw0))
889 * Double precision floating point format (64-bit).
891 typedef union RTFLOAT64U
893 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
897 /** Format using regular bitfields. */
900 # ifdef RT_BIG_ENDIAN
901 /** The sign indicator. */
903 /** The exponent (offseted by 1023). */
904 uint32_t uExponent
: 11;
905 /** The fraction, bits 32 thru 51. */
906 uint32_t u20FractionHigh
: 20;
907 /** The fraction, bits 0 thru 31. */
908 uint32_t u32FractionLow
;
910 /** The fraction, bits 0 thru 31. */
911 uint32_t u32FractionLow
;
912 /** The fraction, bits 32 thru 51. */
913 uint32_t u20FractionHigh
: 20;
914 /** The exponent (offseted by 1023). */
915 uint32_t uExponent
: 11;
916 /** The sign indicator. */
921 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
922 /** Format using 64-bit bitfields. */
923 RT_GCC_EXTENSION
struct
925 # ifdef RT_BIG_ENDIAN
926 /** The sign indicator. */
927 RT_GCC_EXTENSION
uint64_t fSign
: 1;
928 /** The exponent (offseted by 1023). */
929 RT_GCC_EXTENSION
uint64_t uExponent
: 11;
931 RT_GCC_EXTENSION
uint64_t uFraction
: 52;
934 RT_GCC_EXTENSION
uint64_t uFraction
: 52;
935 /** The exponent (offseted by 1023). */
936 RT_GCC_EXTENSION
uint64_t uExponent
: 11;
937 /** The sign indicator. */
938 RT_GCC_EXTENSION
uint64_t fSign
: 1;
952 /** Pointer to a double precision floating point format union. */
953 typedef RTFLOAT64U RT_FAR
*PRTFLOAT64U
;
954 /** Pointer to a const double precision floating point format union. */
955 typedef const RTFLOAT64U RT_FAR
*PCRTFLOAT64U
;
958 #if !defined(__IBMCPP__) && !defined(__IBMC__)
961 * Extended Double precision floating point format (80-bit).
964 typedef union RTFLOAT80U
966 /** Format using bitfields. */
967 RT_GCC_EXTENSION
struct
969 # ifdef RT_BIG_ENDIAN
970 /** The sign indicator. */
971 RT_GCC_EXTENSION
uint16_t fSign
: 1;
972 /** The exponent (offseted by 16383). */
973 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
975 uint64_t u64Mantissa
;
978 uint64_t u64Mantissa
;
979 /** The exponent (offseted by 16383). */
980 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
981 /** The sign indicator. */
982 RT_GCC_EXTENSION
uint16_t fSign
: 1;
996 /** Pointer to a extended precision floating point format union. */
997 typedef RTFLOAT80U RT_FAR
*PRTFLOAT80U
;
998 /** Pointer to a const extended precision floating point format union. */
999 typedef const RTFLOAT80U RT_FAR
*PCRTFLOAT80U
;
1003 * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
1004 * compiler implements long double.
1007 typedef union RTFLOAT80U2
1009 #ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
1010 /** Long double view. */
1013 /** Format using bitfields. */
1014 RT_GCC_EXTENSION
struct
1016 #ifdef RT_BIG_ENDIAN
1017 /** The sign indicator. */
1018 RT_GCC_EXTENSION
uint16_t fSign
: 1;
1019 /** The exponent (offseted by 16383). */
1020 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
1021 /** The mantissa. */
1022 uint64_t u64Mantissa
;
1024 /** The mantissa. */
1025 uint64_t u64Mantissa
;
1026 /** The exponent (offseted by 16383). */
1027 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
1028 /** The sign indicator. */
1029 RT_GCC_EXTENSION
uint16_t fSign
: 1;
1033 /** Bitfield exposing the J bit and the fraction. */
1034 RT_GCC_EXTENSION
struct
1036 #ifdef RT_BIG_ENDIAN
1037 /** The sign indicator. */
1038 RT_GCC_EXTENSION
uint16_t fSign
: 1;
1039 /** The exponent (offseted by 16383). */
1040 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
1041 /** The J bit, aka the integer bit. */
1043 /** The fraction, bits 32 thru 62. */
1044 uint32_t u31FractionHigh
: 31;
1045 /** The fraction, bits 0 thru 31. */
1046 uint32_t u32FractionLow
: 32;
1048 /** The fraction, bits 0 thru 31. */
1049 uint32_t u32FractionLow
: 32;
1050 /** The fraction, bits 32 thru 62. */
1051 uint32_t u31FractionHigh
: 31;
1052 /** The J bit, aka the integer bit. */
1054 /** The exponent (offseted by 16383). */
1055 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
1056 /** The sign indicator. */
1057 RT_GCC_EXTENSION
uint16_t fSign
: 1;
1061 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
1062 /** 64-bit bitfields exposing the J bit and the fraction. */
1063 RT_GCC_EXTENSION
struct
1065 # ifdef RT_BIG_ENDIAN
1066 /** The sign indicator. */
1067 RT_GCC_EXTENSION
uint16_t fSign
: 1;
1068 /** The exponent (offseted by 16383). */
1069 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
1070 /** The J bit, aka the integer bit. */
1071 RT_GCC_EXTENSION
uint64_t fInteger
: 1;
1072 /** The fraction. */
1073 RT_GCC_EXTENSION
uint64_t u63Fraction
: 63;
1075 /** The fraction. */
1076 RT_GCC_EXTENSION
uint64_t u63Fraction
: 63;
1077 /** The J bit, aka the integer bit. */
1078 RT_GCC_EXTENSION
uint64_t fInteger
: 1;
1079 /** The exponent (offseted by 16383). */
1080 RT_GCC_EXTENSION
uint16_t uExponent
: 15;
1081 /** The sign indicator. */
1082 RT_GCC_EXTENSION
uint16_t fSign
: 1;
1097 /** Pointer to a extended precision floating point format union, 2nd
1099 typedef RTFLOAT80U2 RT_FAR
*PRTFLOAT80U2
;
1100 /** Pointer to a const extended precision floating point format union, 2nd
1102 typedef const RTFLOAT80U2 RT_FAR
*PCRTFLOAT80U2
;
1104 #endif /* uint16_t bitfields doesn't work */
1107 /** Generic function type.
1110 typedef DECLCALLBACK(void) FNRT(void);
1112 /** Generic function pointer.
1113 * With -pedantic, gcc-4 complains when casting a function to a data object, for
1121 * void *bar = (void *)foo;
1124 * The compiler would warn with "ISO C++ forbids casting between
1125 * pointer-to-function and pointer-to-object". The purpose of this warning is
1126 * not to bother the programmer but to point out that he is probably doing
1127 * something dangerous, assigning a pointer to executable code to a data object.
1129 typedef FNRT
*PFNRT
;
1131 /** Millisecond interval. */
1132 typedef uint32_t RTMSINTERVAL
;
1133 /** Pointer to a millisecond interval. */
1134 typedef RTMSINTERVAL RT_FAR
*PRTMSINTERVAL
;
1135 /** Pointer to a const millisecond interval. */
1136 typedef const RTMSINTERVAL RT_FAR
*PCRTMSINTERVAL
;
1138 /** Pointer to a time spec structure. */
1139 typedef struct RTTIMESPEC RT_FAR
*PRTTIMESPEC
;
1140 /** Pointer to a const time spec structure. */
1141 typedef const struct RTTIMESPEC RT_FAR
*PCRTTIMESPEC
;
1145 /** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
1149 /** Signed integer which can contain both GC and HC pointers. */
1150 #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1151 typedef int32_t RTINTPTR
;
1152 #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1153 typedef int64_t RTINTPTR
;
1155 # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1157 /** Pointer to signed integer which can contain both GC and HC pointers. */
1158 typedef RTINTPTR RT_FAR
*PRTINTPTR
;
1159 /** Pointer const to signed integer which can contain both GC and HC pointers. */
1160 typedef const RTINTPTR RT_FAR
*PCRTINTPTR
;
1161 /** The maximum value the RTINTPTR type can hold. */
1162 #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1163 # define RTINTPTR_MAX INT32_MAX
1164 #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1165 # define RTINTPTR_MAX INT64_MAX
1167 # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1169 /** The minimum value the RTINTPTR type can hold. */
1170 #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1171 # define RTINTPTR_MIN INT32_MIN
1172 #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1173 # define RTINTPTR_MIN INT64_MIN
1175 # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1178 /** Unsigned integer which can contain both GC and HC pointers. */
1179 #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1180 typedef uint32_t RTUINTPTR
;
1181 #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1182 typedef uint64_t RTUINTPTR
;
1184 # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1186 /** Pointer to unsigned integer which can contain both GC and HC pointers. */
1187 typedef RTUINTPTR RT_FAR
*PRTUINTPTR
;
1188 /** Pointer const to unsigned integer which can contain both GC and HC pointers. */
1189 typedef const RTUINTPTR RT_FAR
*PCRTUINTPTR
;
1190 /** The maximum value the RTUINTPTR type can hold. */
1191 #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1192 # define RTUINTPTR_MAX UINT32_MAX
1193 #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1194 # define RTUINTPTR_MAX UINT64_MAX
1196 # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1199 /** Signed integer. */
1200 typedef int32_t RTINT
;
1201 /** Pointer to signed integer. */
1202 typedef RTINT RT_FAR
*PRTINT
;
1203 /** Pointer to const signed integer. */
1204 typedef const RTINT RT_FAR
*PCRTINT
;
1206 /** Unsigned integer. */
1207 typedef uint32_t RTUINT
;
1208 /** Pointer to unsigned integer. */
1209 typedef RTUINT RT_FAR
*PRTUINT
;
1210 /** Pointer to const unsigned integer. */
1211 typedef const RTUINT RT_FAR
*PCRTUINT
;
1213 /** A file offset / size (off_t). */
1214 typedef int64_t RTFOFF
;
1215 /** Pointer to a file offset / size. */
1216 typedef RTFOFF RT_FAR
*PRTFOFF
;
1217 /** The max value for RTFOFF. */
1218 #define RTFOFF_MAX INT64_MAX
1219 /** The min value for RTFOFF. */
1220 #define RTFOFF_MIN INT64_MIN
1222 /** File mode (see iprt/fs.h). */
1223 typedef uint32_t RTFMODE
;
1224 /** Pointer to file mode. */
1225 typedef RTFMODE RT_FAR
*PRTFMODE
;
1227 /** Device unix number. */
1228 typedef uint32_t RTDEV
;
1229 /** Pointer to a device unix number. */
1230 typedef RTDEV RT_FAR
*PRTDEV
;
1232 /** @name RTDEV Macros
1235 * Our makedev macro.
1237 * @param uMajor The major device number.
1238 * @param uMinor The minor device number.
1240 #define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
1242 * Get the major device node number from an RTDEV type.
1243 * @returns The major device number of @a uDev
1244 * @param uDev The device number.
1246 #define RTDEV_MAJOR(uDev) ((uDev) >> 24)
1248 * Get the minor device node number from an RTDEV type.
1249 * @returns The minor device number of @a uDev
1250 * @param uDev The device number.
1252 #define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
1255 /** i-node number. */
1256 typedef uint64_t RTINODE
;
1257 /** Pointer to a i-node number. */
1258 typedef RTINODE RT_FAR
*PRTINODE
;
1261 typedef uint32_t RTUID
;
1262 /** Pointer to a user id. */
1263 typedef RTUID RT_FAR
*PRTUID
;
1265 * @todo check this for portability! */
1266 #define NIL_RTUID (~(RTUID)0)
1269 typedef uint32_t RTGID
;
1270 /** Pointer to a group id. */
1271 typedef RTGID RT_FAR
*PRTGID
;
1273 * @todo check this for portability! */
1274 #define NIL_RTGID (~(RTGID)0)
1277 typedef uint16_t RTIOPORT
;
1278 /** Pointer to I/O Port. */
1279 typedef RTIOPORT RT_FAR
*PRTIOPORT
;
1280 /** Pointer to const I/O Port. */
1281 typedef const RTIOPORT RT_FAR
*PCRTIOPORT
;
1284 typedef uint16_t RTSEL
;
1285 /** Pointer to selector. */
1286 typedef RTSEL RT_FAR
*PRTSEL
;
1287 /** Pointer to const selector. */
1288 typedef const RTSEL RT_FAR
*PCRTSEL
;
1289 /** Max selector value. */
1290 #define RTSEL_MAX UINT16_MAX
1292 /** Far 16-bit pointer. */
1294 typedef struct RTFAR16
1300 /** Pointer to Far 16-bit pointer. */
1301 typedef RTFAR16 RT_FAR
*PRTFAR16
;
1302 /** Pointer to const Far 16-bit pointer. */
1303 typedef const RTFAR16 RT_FAR
*PCRTFAR16
;
1305 /** Far 32-bit pointer. */
1307 typedef struct RTFAR32
1313 /** Pointer to Far 32-bit pointer. */
1314 typedef RTFAR32 RT_FAR
*PRTFAR32
;
1315 /** Pointer to const Far 32-bit pointer. */
1316 typedef const RTFAR32 RT_FAR
*PCRTFAR32
;
1318 /** Far 64-bit pointer. */
1320 typedef struct RTFAR64
1326 /** Pointer to Far 64-bit pointer. */
1327 typedef RTFAR64 RT_FAR
*PRTFAR64
;
1328 /** Pointer to const Far 64-bit pointer. */
1329 typedef const RTFAR64 RT_FAR
*PCRTFAR64
;
1334 /** @defgroup grp_rt_types_hc Host Context Basic Types
1338 /** HC Natural signed integer.
1339 * @deprecated silly type. */
1340 typedef int32_t RTHCINT
;
1341 /** Pointer to HC Natural signed integer.
1342 * @deprecated silly type. */
1343 typedef RTHCINT RT_FAR
*PRTHCINT
;
1344 /** Pointer to const HC Natural signed integer.
1345 * @deprecated silly type. */
1346 typedef const RTHCINT RT_FAR
*PCRTHCINT
;
1348 /** HC Natural unsigned integer.
1349 * @deprecated silly type. */
1350 typedef uint32_t RTHCUINT
;
1351 /** Pointer to HC Natural unsigned integer.
1352 * @deprecated silly type. */
1353 typedef RTHCUINT RT_FAR
*PRTHCUINT
;
1354 /** Pointer to const HC Natural unsigned integer.
1355 * @deprecated silly type. */
1356 typedef const RTHCUINT RT_FAR
*PCRTHCUINT
;
1359 /** Signed integer which can contain a HC pointer. */
1360 #if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
1361 typedef int32_t RTHCINTPTR
;
1362 #elif HC_ARCH_BITS == 64
1363 typedef int64_t RTHCINTPTR
;
1365 # error Unsupported HC_ARCH_BITS value.
1367 /** Pointer to signed integer which can contain a HC pointer. */
1368 typedef RTHCINTPTR RT_FAR
*PRTHCINTPTR
;
1369 /** Pointer to const signed integer which can contain a HC pointer. */
1370 typedef const RTHCINTPTR RT_FAR
*PCRTHCINTPTR
;
1371 /** Max RTHCINTPTR value. */
1372 #if HC_ARCH_BITS == 32
1373 # define RTHCINTPTR_MAX INT32_MAX
1374 #elif HC_ARCH_BITS == 64
1375 # define RTHCINTPTR_MAX INT64_MAX
1377 # define RTHCINTPTR_MAX INT16_MAX
1379 /** Min RTHCINTPTR value. */
1380 #if HC_ARCH_BITS == 32
1381 # define RTHCINTPTR_MIN INT32_MIN
1382 #elif HC_ARCH_BITS == 64
1383 # define RTHCINTPTR_MIN INT64_MIN
1385 # define RTHCINTPTR_MIN INT16_MIN
1388 /** Signed integer which can contain a HC ring-3 pointer. */
1389 #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1390 typedef int32_t RTR3INTPTR
;
1391 #elif R3_ARCH_BITS == 64
1392 typedef int64_t RTR3INTPTR
;
1394 # error Unsupported R3_ARCH_BITS value.
1396 /** Pointer to signed integer which can contain a HC ring-3 pointer. */
1397 typedef RTR3INTPTR RT_FAR
*PRTR3INTPTR
;
1398 /** Pointer to const signed integer which can contain a HC ring-3 pointer. */
1399 typedef const RTR3INTPTR RT_FAR
*PCRTR3INTPTR
;
1400 /** Max RTR3INTPTR value. */
1401 #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1402 # define RTR3INTPTR_MAX INT32_MAX
1404 # define RTR3INTPTR_MAX INT64_MAX
1406 /** Min RTR3INTPTR value. */
1407 #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1408 # define RTR3INTPTR_MIN INT32_MIN
1410 # define RTR3INTPTR_MIN INT64_MIN
1413 /** Signed integer which can contain a HC ring-0 pointer. */
1414 #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1415 typedef int32_t RTR0INTPTR
;
1416 #elif R0_ARCH_BITS == 64
1417 typedef int64_t RTR0INTPTR
;
1419 # error Unsupported R0_ARCH_BITS value.
1421 /** Pointer to signed integer which can contain a HC ring-0 pointer. */
1422 typedef RTR0INTPTR RT_FAR
*PRTR0INTPTR
;
1423 /** Pointer to const signed integer which can contain a HC ring-0 pointer. */
1424 typedef const RTR0INTPTR RT_FAR
*PCRTR0INTPTR
;
1425 /** Max RTR0INTPTR value. */
1426 #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1427 # define RTR0INTPTR_MAX INT32_MAX
1429 # define RTR0INTPTR_MAX INT64_MAX
1431 /** Min RTHCINTPTR value. */
1432 #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1433 # define RTR0INTPTR_MIN INT32_MIN
1435 # define RTR0INTPTR_MIN INT64_MIN
1439 /** Unsigned integer which can contain a HC pointer. */
1440 #if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
1441 typedef uint32_t RTHCUINTPTR
;
1442 #elif HC_ARCH_BITS == 64
1443 typedef uint64_t RTHCUINTPTR
;
1445 # error Unsupported HC_ARCH_BITS value.
1447 /** Pointer to unsigned integer which can contain a HC pointer. */
1448 typedef RTHCUINTPTR RT_FAR
*PRTHCUINTPTR
;
1449 /** Pointer to unsigned integer which can contain a HC pointer. */
1450 typedef const RTHCUINTPTR RT_FAR
*PCRTHCUINTPTR
;
1451 /** Max RTHCUINTTPR value. */
1452 #if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
1453 # define RTHCUINTPTR_MAX UINT32_MAX
1455 # define RTHCUINTPTR_MAX UINT64_MAX
1458 /** Unsigned integer which can contain a HC ring-3 pointer. */
1459 #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1460 typedef uint32_t RTR3UINTPTR
;
1461 #elif R3_ARCH_BITS == 64
1462 typedef uint64_t RTR3UINTPTR
;
1464 # error Unsupported R3_ARCH_BITS value.
1466 /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1467 typedef RTR3UINTPTR RT_FAR
*PRTR3UINTPTR
;
1468 /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1469 typedef const RTR3UINTPTR RT_FAR
*PCRTR3UINTPTR
;
1470 /** Max RTHCUINTTPR value. */
1471 #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1472 # define RTR3UINTPTR_MAX UINT32_MAX
1474 # define RTR3UINTPTR_MAX UINT64_MAX
1477 /** Unsigned integer which can contain a HC ring-0 pointer. */
1478 #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1479 typedef uint32_t RTR0UINTPTR
;
1480 #elif R0_ARCH_BITS == 64
1481 typedef uint64_t RTR0UINTPTR
;
1483 # error Unsupported R0_ARCH_BITS value.
1485 /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
1486 typedef RTR0UINTPTR RT_FAR
*PRTR0UINTPTR
;
1487 /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
1488 typedef const RTR0UINTPTR RT_FAR
*PCRTR0UINTPTR
;
1489 /** Max RTR0UINTTPR value. */
1490 #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1491 # define RTR0UINTPTR_MAX UINT32_MAX
1493 # define RTR0UINTPTR_MAX UINT64_MAX
1497 /** Host Physical Memory Address. */
1498 typedef uint64_t RTHCPHYS
;
1499 /** Pointer to Host Physical Memory Address. */
1500 typedef RTHCPHYS RT_FAR
*PRTHCPHYS
;
1501 /** Pointer to const Host Physical Memory Address. */
1502 typedef const RTHCPHYS RT_FAR
*PCRTHCPHYS
;
1503 /** @def NIL_RTHCPHYS
1504 * NIL HC Physical Address.
1505 * NIL_RTHCPHYS is used to signal an invalid physical address, similar
1506 * to the NULL pointer.
1508 #define NIL_RTHCPHYS (~(RTHCPHYS)0)
1509 /** Max RTHCPHYS value. */
1510 #define RTHCPHYS_MAX UINT64_MAX
1515 typedef void RT_FAR
*RTHCPTR
;
1517 typedef RTHCUINTPTR RTHCPTR
;
1519 /** Pointer to HC pointer. */
1520 typedef RTHCPTR RT_FAR
*PRTHCPTR
;
1521 /** Pointer to const HC pointer. */
1522 typedef const RTHCPTR
*PCRTHCPTR
;
1523 /** @def NIL_RTHCPTR
1526 #define NIL_RTHCPTR ((RTHCPTR)0)
1527 /** Max RTHCPTR value. */
1528 #define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
1531 /** HC ring-3 pointer. */
1533 typedef void RT_FAR
*RTR3PTR
;
1535 typedef RTR3UINTPTR RTR3PTR
;
1537 /** Pointer to HC ring-3 pointer. */
1538 typedef RTR3PTR RT_FAR
*PRTR3PTR
;
1539 /** Pointer to const HC ring-3 pointer. */
1540 typedef const RTR3PTR
*PCRTR3PTR
;
1541 /** @def NIL_RTR3PTR
1542 * NIL HC ring-3 pointer.
1545 # define NIL_RTR3PTR ((RTR3PTR)0)
1547 # define NIL_RTR3PTR (NULL)
1549 /** Max RTR3PTR value. */
1550 #define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
1552 /** HC ring-0 pointer. */
1554 typedef void RT_FAR
*RTR0PTR
;
1556 typedef RTR0UINTPTR RTR0PTR
;
1558 /** Pointer to HC ring-0 pointer. */
1559 typedef RTR0PTR RT_FAR
*PRTR0PTR
;
1560 /** Pointer to const HC ring-0 pointer. */
1561 typedef const RTR0PTR
*PCRTR0PTR
;
1562 /** @def NIL_RTR0PTR
1563 * NIL HC ring-0 pointer.
1566 # define NIL_RTR0PTR ((RTR0PTR)0)
1568 # define NIL_RTR0PTR (NULL)
1570 /** Max RTR3PTR value. */
1571 #define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
1574 /** Unsigned integer register in the host context. */
1575 #if HC_ARCH_BITS == 32
1576 typedef uint32_t RTHCUINTREG
;
1577 #elif HC_ARCH_BITS == 64
1578 typedef uint64_t RTHCUINTREG
;
1579 #elif HC_ARCH_BITS == 16
1580 typedef uint16_t RTHCUINTREG
;
1582 # error "Unsupported HC_ARCH_BITS!"
1584 /** Pointer to an unsigned integer register in the host context. */
1585 typedef RTHCUINTREG RT_FAR
*PRTHCUINTREG
;
1586 /** Pointer to a const unsigned integer register in the host context. */
1587 typedef const RTHCUINTREG RT_FAR
*PCRTHCUINTREG
;
1589 /** Unsigned integer register in the host ring-3 context. */
1590 #if R3_ARCH_BITS == 32
1591 typedef uint32_t RTR3UINTREG
;
1592 #elif R3_ARCH_BITS == 64
1593 typedef uint64_t RTR3UINTREG
;
1594 #elif R3_ARCH_BITS == 16
1595 typedef uint16_t RTR3UINTREG
;
1597 # error "Unsupported R3_ARCH_BITS!"
1599 /** Pointer to an unsigned integer register in the host ring-3 context. */
1600 typedef RTR3UINTREG RT_FAR
*PRTR3UINTREG
;
1601 /** Pointer to a const unsigned integer register in the host ring-3 context. */
1602 typedef const RTR3UINTREG RT_FAR
*PCRTR3UINTREG
;
1604 /** Unsigned integer register in the host ring-3 context. */
1605 #if R0_ARCH_BITS == 32
1606 typedef uint32_t RTR0UINTREG
;
1607 #elif R0_ARCH_BITS == 64
1608 typedef uint64_t RTR0UINTREG
;
1609 #elif R0_ARCH_BITS == 16
1610 typedef uint16_t RTR0UINTREG
;
1612 # error "Unsupported R3_ARCH_BITS!"
1614 /** Pointer to an unsigned integer register in the host ring-3 context. */
1615 typedef RTR0UINTREG RT_FAR
*PRTR0UINTREG
;
1616 /** Pointer to a const unsigned integer register in the host ring-3 context. */
1617 typedef const RTR0UINTREG RT_FAR
*PCRTR0UINTREG
;
1622 /** @defgroup grp_rt_types_gc Guest Context Basic Types
1626 /** Natural signed integer in the GC.
1627 * @deprecated silly type. */
1628 #if GC_ARCH_BITS == 32
1629 typedef int32_t RTGCINT
;
1630 #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
1631 typedef int64_t RTGCINT
;
1633 /** Pointer to natural signed integer in GC.
1634 * @deprecated silly type. */
1635 typedef RTGCINT RT_FAR
*PRTGCINT
;
1636 /** Pointer to const natural signed integer in GC.
1637 * @deprecated silly type. */
1638 typedef const RTGCINT RT_FAR
*PCRTGCINT
;
1640 /** Natural unsigned integer in the GC.
1641 * @deprecated silly type. */
1642 #if GC_ARCH_BITS == 32
1643 typedef uint32_t RTGCUINT
;
1644 #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
1645 typedef uint64_t RTGCUINT
;
1647 /** Pointer to natural unsigned integer in GC.
1648 * @deprecated silly type. */
1649 typedef RTGCUINT RT_FAR
*PRTGCUINT
;
1650 /** Pointer to const natural unsigned integer in GC.
1651 * @deprecated silly type. */
1652 typedef const RTGCUINT RT_FAR
*PCRTGCUINT
;
1654 /** Signed integer which can contain a GC pointer. */
1655 #if GC_ARCH_BITS == 32
1656 typedef int32_t RTGCINTPTR
;
1657 #elif GC_ARCH_BITS == 64
1658 typedef int64_t RTGCINTPTR
;
1660 /** Pointer to signed integer which can contain a GC pointer. */
1661 typedef RTGCINTPTR RT_FAR
*PRTGCINTPTR
;
1662 /** Pointer to const signed integer which can contain a GC pointer. */
1663 typedef const RTGCINTPTR RT_FAR
*PCRTGCINTPTR
;
1665 /** Unsigned integer which can contain a GC pointer. */
1666 #if GC_ARCH_BITS == 32
1667 typedef uint32_t RTGCUINTPTR
;
1668 #elif GC_ARCH_BITS == 64
1669 typedef uint64_t RTGCUINTPTR
;
1671 # error Unsupported GC_ARCH_BITS value.
1673 /** Pointer to unsigned integer which can contain a GC pointer. */
1674 typedef RTGCUINTPTR RT_FAR
*PRTGCUINTPTR
;
1675 /** Pointer to unsigned integer which can contain a GC pointer. */
1676 typedef const RTGCUINTPTR RT_FAR
*PCRTGCUINTPTR
;
1678 /** Unsigned integer which can contain a 32 bits GC pointer. */
1679 typedef uint32_t RTGCUINTPTR32
;
1680 /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1681 typedef RTGCUINTPTR32 RT_FAR
*PRTGCUINTPTR32
;
1682 /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1683 typedef const RTGCUINTPTR32 RT_FAR
*PCRTGCUINTPTR32
;
1685 /** Unsigned integer which can contain a 64 bits GC pointer. */
1686 typedef uint64_t RTGCUINTPTR64
;
1687 /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1688 typedef RTGCUINTPTR64 RT_FAR
*PRTGCUINTPTR64
;
1689 /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1690 typedef const RTGCUINTPTR64 RT_FAR
*PCRTGCUINTPTR64
;
1692 /** Guest Physical Memory Address.*/
1693 typedef uint64_t RTGCPHYS
;
1694 /** Pointer to Guest Physical Memory Address. */
1695 typedef RTGCPHYS RT_FAR
*PRTGCPHYS
;
1696 /** Pointer to const Guest Physical Memory Address. */
1697 typedef const RTGCPHYS RT_FAR
*PCRTGCPHYS
;
1698 /** @def NIL_RTGCPHYS
1699 * NIL GC Physical Address.
1700 * NIL_RTGCPHYS is used to signal an invalid physical address, similar
1701 * to the NULL pointer. Note that this value may actually be valid in
1704 #define NIL_RTGCPHYS (~(RTGCPHYS)0U)
1705 /** Max guest physical memory address value. */
1706 #define RTGCPHYS_MAX UINT64_MAX
1709 /** Guest Physical Memory Address; limited to 32 bits.*/
1710 typedef uint32_t RTGCPHYS32
;
1711 /** Pointer to Guest Physical Memory Address. */
1712 typedef RTGCPHYS32 RT_FAR
*PRTGCPHYS32
;
1713 /** Pointer to const Guest Physical Memory Address. */
1714 typedef const RTGCPHYS32 RT_FAR
*PCRTGCPHYS32
;
1715 /** @def NIL_RTGCPHYS32
1716 * NIL GC Physical Address.
1717 * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
1718 * to the NULL pointer. Note that this value may actually be valid in
1721 #define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
1724 /** Guest Physical Memory Address; limited to 64 bits.*/
1725 typedef uint64_t RTGCPHYS64
;
1726 /** Pointer to Guest Physical Memory Address. */
1727 typedef RTGCPHYS64 RT_FAR
*PRTGCPHYS64
;
1728 /** Pointer to const Guest Physical Memory Address. */
1729 typedef const RTGCPHYS64 RT_FAR
*PCRTGCPHYS64
;
1730 /** @def NIL_RTGCPHYS64
1731 * NIL GC Physical Address.
1732 * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
1733 * to the NULL pointer. Note that this value may actually be valid in
1736 #define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
1738 /** Guest context pointer, 32 bits.
1739 * Keep in mind that this type is an unsigned integer in
1740 * HC and void pointer in GC.
1742 typedef RTGCUINTPTR32 RTGCPTR32
;
1743 /** Pointer to a guest context pointer. */
1744 typedef RTGCPTR32 RT_FAR
*PRTGCPTR32
;
1745 /** Pointer to a const guest context pointer. */
1746 typedef const RTGCPTR32 RT_FAR
*PCRTGCPTR32
;
1747 /** @def NIL_RTGCPTR32
1750 #define NIL_RTGCPTR32 ((RTGCPTR32)0)
1752 /** Guest context pointer, 64 bits.
1754 typedef RTGCUINTPTR64 RTGCPTR64
;
1755 /** Pointer to a guest context pointer. */
1756 typedef RTGCPTR64 RT_FAR
*PRTGCPTR64
;
1757 /** Pointer to a const guest context pointer. */
1758 typedef const RTGCPTR64 RT_FAR
*PCRTGCPTR64
;
1759 /** @def NIL_RTGCPTR64
1762 #define NIL_RTGCPTR64 ((RTGCPTR64)0)
1764 /** Guest context pointer.
1765 * Keep in mind that this type is an unsigned integer in
1766 * HC and void pointer in GC.
1768 #if GC_ARCH_BITS == 64
1769 typedef RTGCPTR64 RTGCPTR
;
1770 /** Pointer to a guest context pointer. */
1771 typedef PRTGCPTR64 PRTGCPTR
;
1772 /** Pointer to a const guest context pointer. */
1773 typedef PCRTGCPTR64 PCRTGCPTR
;
1774 /** @def NIL_RTGCPTR
1777 # define NIL_RTGCPTR NIL_RTGCPTR64
1778 /** Max RTGCPTR value. */
1779 # define RTGCPTR_MAX UINT64_MAX
1780 #elif GC_ARCH_BITS == 32
1781 typedef RTGCPTR32 RTGCPTR
;
1782 /** Pointer to a guest context pointer. */
1783 typedef PRTGCPTR32 PRTGCPTR
;
1784 /** Pointer to a const guest context pointer. */
1785 typedef PCRTGCPTR32 PCRTGCPTR
;
1786 /** @def NIL_RTGCPTR
1789 # define NIL_RTGCPTR NIL_RTGCPTR32
1790 /** Max RTGCPTR value. */
1791 # define RTGCPTR_MAX UINT32_MAX
1793 # error "Unsupported GC_ARCH_BITS!"
1796 /** Unsigned integer register in the guest context. */
1797 typedef uint32_t RTGCUINTREG32
;
1798 /** Pointer to an unsigned integer register in the guest context. */
1799 typedef RTGCUINTREG32 RT_FAR
*PRTGCUINTREG32
;
1800 /** Pointer to a const unsigned integer register in the guest context. */
1801 typedef const RTGCUINTREG32 RT_FAR
*PCRTGCUINTREG32
;
1803 typedef uint64_t RTGCUINTREG64
;
1804 /** Pointer to an unsigned integer register in the guest context. */
1805 typedef RTGCUINTREG64 RT_FAR
*PRTGCUINTREG64
;
1806 /** Pointer to a const unsigned integer register in the guest context. */
1807 typedef const RTGCUINTREG64 RT_FAR
*PCRTGCUINTREG64
;
1809 #if GC_ARCH_BITS == 64
1810 typedef RTGCUINTREG64 RTGCUINTREG
;
1811 #elif GC_ARCH_BITS == 32
1812 typedef RTGCUINTREG32 RTGCUINTREG
;
1814 # error "Unsupported GC_ARCH_BITS!"
1816 /** Pointer to an unsigned integer register in the guest context. */
1817 typedef RTGCUINTREG RT_FAR
*PRTGCUINTREG
;
1818 /** Pointer to a const unsigned integer register in the guest context. */
1819 typedef const RTGCUINTREG RT_FAR
*PCRTGCUINTREG
;
1823 /** @defgroup grp_rt_types_rc Raw mode Context Basic Types
1827 /** Raw mode context pointer; a 32 bits guest context pointer.
1828 * Keep in mind that this type is an unsigned integer in
1829 * HC and void pointer in RC.
1832 typedef void RT_FAR
*RTRCPTR
;
1834 typedef uint32_t RTRCPTR
;
1836 /** Pointer to a raw mode context pointer. */
1837 typedef RTRCPTR RT_FAR
*PRTRCPTR
;
1838 /** Pointer to a const raw mode context pointer. */
1839 typedef const RTRCPTR RT_FAR
*PCRTRCPTR
;
1840 /** @def NIL_RTGCPTR
1844 # define NIL_RTRCPTR ((RTRCPTR)0)
1846 # define NIL_RTRCPTR (NULL)
1848 /** @def RTRCPTR_MAX
1849 * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
1851 #define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
1853 /** Raw mode context pointer, unsigned integer variant. */
1854 typedef int32_t RTRCINTPTR
;
1855 /** @def RTRCUINTPTR_MAX
1856 * The maximum value a RTRCUINPTR can have.
1858 #define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
1860 /** Raw mode context pointer, signed integer variant. */
1861 typedef uint32_t RTRCUINTPTR
;
1862 /** @def RTRCINTPTR_MIN
1863 * The minimum value a RTRCINPTR can have.
1865 #define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
1866 /** @def RTRCINTPTR_MAX
1867 * The maximum value a RTRCINPTR can have.
1869 #define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
1874 /** @defgroup grp_rt_types_cc Current Context Basic Types
1878 /** Current Context Physical Memory Address.*/
1880 typedef RTGCPHYS RTCCPHYS
;
1882 typedef RTHCPHYS RTCCPHYS
;
1884 /** Pointer to Current Context Physical Memory Address. */
1885 typedef RTCCPHYS RT_FAR
*PRTCCPHYS
;
1886 /** Pointer to const Current Context Physical Memory Address. */
1887 typedef const RTCCPHYS RT_FAR
*PCRTCCPHYS
;
1888 /** @def NIL_RTCCPHYS
1889 * NIL CC Physical Address.
1890 * NIL_RTCCPHYS is used to signal an invalid physical address, similar
1891 * to the NULL pointer.
1894 # define NIL_RTCCPHYS NIL_RTGCPHYS
1896 # define NIL_RTCCPHYS NIL_RTHCPHYS
1899 /** Unsigned integer register in the current context. */
1901 typedef uint32_t RTCCUINTREG
;
1902 #elif ARCH_BITS == 64
1903 typedef uint64_t RTCCUINTREG
;
1904 #elif ARCH_BITS == 16
1905 typedef uint16_t RTCCUINTREG
;
1907 # error "Unsupported ARCH_BITS!"
1909 /** Pointer to an unsigned integer register in the current context. */
1910 typedef RTCCUINTREG RT_FAR
*PRTCCUINTREG
;
1911 /** Pointer to a const unsigned integer register in the current context. */
1912 typedef RTCCUINTREG
const RT_FAR
*PCRTCCUINTREG
;
1914 /** Signed integer register in the current context. */
1916 typedef int32_t RTCCINTREG
;
1917 #elif ARCH_BITS == 64
1918 typedef int64_t RTCCINTREG
;
1919 #elif ARCH_BITS == 16
1920 typedef int16_t RTCCINTREG
;
1922 /** Pointer to a signed integer register in the current context. */
1923 typedef RTCCINTREG RT_FAR
*PRTCCINTREG
;
1924 /** Pointer to a const signed integer register in the current context. */
1925 typedef RTCCINTREG
const RT_FAR
*PCRTCCINTREG
;
1927 /** Unsigned integer register in the current context.
1928 * @remarks This is for dealing with EAX in 16-bit mode. */
1929 #if ARCH_BITS == 16 && defined(RT_ARCH_X86)
1930 typedef uint32_t RTCCUINTXREG
;
1932 typedef RTCCUINTREG RTCCUINTXREG
;
1934 /** Pointer to an unsigned integer register in the current context. */
1935 typedef RTCCUINTREG RT_FAR
*PRTCCUINTXREG
;
1936 /** Pointer to a const unsigned integer register in the current context. */
1937 typedef RTCCUINTREG
const RT_FAR
*PCRTCCUINTXREG
;
1939 /** Signed integer extended register in the current context.
1940 * @remarks This is for dealing with EAX in 16-bit mode. */
1941 #if ARCH_BITS == 16 && defined(RT_ARCH_X86)
1942 typedef int32_t RTCCINTXREG
;
1944 typedef RTCCINTREG RTCCINTXREG
;
1946 /** Pointer to a signed integer extended register in the current context. */
1947 typedef RTCCINTXREG RT_FAR
*PRTCCINTXREG
;
1948 /** Pointer to a const signed integer extended register in the current
1950 typedef RTCCINTXREG
const RT_FAR
*PCRTCCINTXREG
;
1952 /** @def RTCCUINTREG_C
1953 * Defines a constant of RTCCUINTREG type.
1954 * @param a_Value Constant value */
1955 /** @def RTCCUINTREG_MAX
1956 * Max value that RTCCUINTREG can hold. */
1957 /** @def RTCCUINTREG_FMT
1958 * Generic IPRT format specifier for RTCCUINTREG. */
1959 /** @def RTCCUINTREG_XFMT
1960 * Generic IPRT format specifier for RTCCUINTREG, hexadecimal. */
1961 /** @def RTCCINTREG_C
1962 * Defines a constant of RTCCINTREG type.
1963 * @param a_Value Constant value */
1964 /** @def RTCCINTREG_MAX
1965 * Max value that RTCCINTREG can hold. */
1966 /** @def RTCCINTREG_MIN
1967 * Min value that RTCCINTREG can hold. */
1968 /** @def RTCCINTREG_XFMT
1969 * Generic IPRT format specifier for RTCCINTREG, hexadecimal. */
1971 # define RTCCUINTREG_C(a_Value) UINT32_C(a_Value)
1972 # define RTCCUINTREG_MAX UINT32_MAX
1973 # define RTCCUINTREG_FMT "RU32"
1974 # define RTCCUINTREG_XFMT "RX32"
1975 # define RTCCINTREG_C(a_Value) INT32_C(a_Value)
1976 # define RTCCINTREG_MAX INT32_MAX
1977 # define RTCCINTREG_MIN INT32_MIN
1978 # define RTCCINTREG_FMT "RI32"
1979 # define RTCCINTREG_XFMT "RX32"
1980 #elif ARCH_BITS == 64
1981 # define RTCCUINTREG_C(a_Value) UINT64_C(a_Value)
1982 # define RTCCUINTREG_MAX UINT64_MAX
1983 # define RTCCUINTREG_FMT "RU64"
1984 # define RTCCUINTREG_XFMT "RX64"
1985 # define RTCCINTREG_C(a_Value) INT64_C(a_Value)
1986 # define RTCCINTREG_MAX INT64_MAX
1987 # define RTCCINTREG_MIN INT64_MIN
1988 # define RTCCINTREG_FMT "RI64"
1989 # define RTCCINTREG_XFMT "RX64"
1990 #elif ARCH_BITS == 16
1991 # define RTCCUINTREG_C(a_Value) UINT16_C(a_Value)
1992 # define RTCCUINTREG_MAX UINT16_MAX
1993 # define RTCCUINTREG_FMT "RU16"
1994 # define RTCCUINTREG_XFMT "RX16"
1995 # define RTCCINTREG_C(a_Value) INT16_C(a_Value)
1996 # define RTCCINTREG_MAX INT16_MAX
1997 # define RTCCINTREG_MIN INT16_MIN
1998 # define RTCCINTREG_FMT "RI16"
1999 # define RTCCINTREG_XFMT "RX16"
2001 # error "Unsupported ARCH_BITS!"
2003 /** @def RTCCUINTXREG_C
2004 * Defines a constant of RTCCUINTXREG type.
2005 * @param a_Value Constant value */
2006 /** @def RTCCUINTXREG_MAX
2007 * Max value that RTCCUINTXREG can hold. */
2008 /** @def RTCCUINTXREG_FMT
2009 * Generic IPRT format specifier for RTCCUINTXREG. */
2010 /** @def RTCCUINTXREG_XFMT
2011 * Generic IPRT format specifier for RTCCUINTXREG, hexadecimal. */
2012 /** @def RTCCINTXREG_C
2013 * Defines a constant of RTCCINTXREG type.
2014 * @param a_Value Constant value */
2015 /** @def RTCCINTXREG_MAX
2016 * Max value that RTCCINTXREG can hold. */
2017 /** @def RTCCINTXREG_MIN
2018 * Min value that RTCCINTXREG can hold. */
2019 /** @def RTCCINTXREG_FMT
2020 * Generic IPRT format specifier for RTCCINTXREG. */
2021 /** @def RTCCINTXREG_XFMT
2022 * Generic IPRT format specifier for RTCCINTXREG, hexadecimal. */
2023 #if ARCH_BITS == 16 && defined(RT_ARCH_X86)
2024 # define RTCCUINTXREG_C(a_Value) UINT32_C(a_Value)
2025 # define RTCCUINTXREG_MAX UINT32_MAX
2026 # define RTCCUINTXREG_FMT "RU32"
2027 # define RTCCUINTXREG_XFMT "RX32"
2028 # define RTCCINTXREG_C(a_Value) INT32_C(a_Value)
2029 # define RTCCINTXREG_MAX INT32_MAX
2030 # define RTCCINTXREG_MIN INT32_MIN
2031 # define RTCCINTXREG_FMT "RI32"
2032 # define RTCCINTXREG_XFMT "RX32"
2034 # define RTCCUINTXREG_C(a_Value) RTCCUINTREG_C(a_Value)
2035 # define RTCCUINTXREG_MAX RTCCUINTREG_MAX
2036 # define RTCCUINTXREG_FMT RTCCUINTREG_FMT
2037 # define RTCCUINTXREG_XFMT RTCCUINTREG_XFMT
2038 # define RTCCINTXREG_C(a_Value) RTCCINTREG_C(a_Value)
2039 # define RTCCINTXREG_MAX RTCCINTREG_MAX
2040 # define RTCCINTXREG_MIN RTCCINTREG_MIN
2041 # define RTCCINTXREG_FMT RTCCINTREG_FMT
2042 # define RTCCINTXREG_XFMT RTCCINTREG_XFMT
2048 /** Pointer to a big integer number. */
2049 typedef struct RTBIGNUM RT_FAR
*PRTBIGNUM
;
2050 /** Pointer to a const big integer number. */
2051 typedef struct RTBIGNUM
const RT_FAR
*PCRTBIGNUM
;
2054 /** Pointer to a critical section. */
2055 typedef struct RTCRITSECT RT_FAR
*PRTCRITSECT
;
2056 /** Pointer to a const critical section. */
2057 typedef const struct RTCRITSECT RT_FAR
*PCRTCRITSECT
;
2059 /** Pointer to a read/write critical section. */
2060 typedef struct RTCRITSECTRW RT_FAR
*PRTCRITSECTRW
;
2061 /** Pointer to a const read/write critical section. */
2062 typedef const struct RTCRITSECTRW RT_FAR
*PCRTCRITSECTRW
;
2065 /** Condition variable handle. */
2066 typedef R3PTRTYPE(struct RTCONDVARINTERNAL RT_FAR
*) RTCONDVAR
;
2067 /** Pointer to a condition variable handle. */
2068 typedef RTCONDVAR RT_FAR
*PRTCONDVAR
;
2069 /** Nil condition variable handle. */
2070 #define NIL_RTCONDVAR 0
2072 /** Cryptographic (certificate) store handle. */
2073 typedef R3R0PTRTYPE(struct RTCRSTOREINT RT_FAR
*) RTCRSTORE
;
2074 /** Pointer to a Cryptographic (certificate) store handle. */
2075 typedef RTCRSTORE RT_FAR
*PRTCRSTORE
;
2076 /** Nil Cryptographic (certificate) store handle. */
2077 #define NIL_RTCRSTORE 0
2079 /** Pointer to a const (store) certificate context. */
2080 typedef struct RTCRCERTCTX
const RT_FAR
*PCRTCRCERTCTX
;
2082 /** Cryptographic message digest handle. */
2083 typedef R3R0PTRTYPE(struct RTCRDIGESTINT RT_FAR
*) RTCRDIGEST
;
2084 /** Pointer to a cryptographic message digest handle. */
2085 typedef RTCRDIGEST RT_FAR
*PRTCRDIGEST
;
2086 /** NIL cryptographic message digest handle. */
2087 #define NIL_RTCRDIGEST (0)
2089 /** Public key encryption schema handle. */
2090 typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT RT_FAR
*) RTCRPKIXENCRYPTION
;
2091 /** Pointer to a public key encryption schema handle. */
2092 typedef RTCRPKIXENCRYPTION RT_FAR
*PRTCRPKIXENCRYPTION
;
2093 /** NIL public key encryption schema handle */
2094 #define NIL_RTCRPKIXENCRYPTION (0)
2096 /** Public key signature schema handle. */
2097 typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT RT_FAR
*) RTCRPKIXSIGNATURE
;
2098 /** Pointer to a public key signature schema handle. */
2099 typedef RTCRPKIXSIGNATURE RT_FAR
*PRTCRPKIXSIGNATURE
;
2100 /** NIL public key signature schema handle */
2101 #define NIL_RTCRPKIXSIGNATURE (0)
2103 /** X.509 certificate paths builder & validator handle. */
2104 typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT RT_FAR
*) RTCRX509CERTPATHS
;
2105 /** Pointer to a certificate paths builder & validator handle. */
2106 typedef RTCRX509CERTPATHS RT_FAR
*PRTCRX509CERTPATHS
;
2107 /** Nil certificate paths builder & validator handle. */
2108 #define NIL_RTCRX509CERTPATHS 0
2110 /** Directory handle. */
2111 typedef struct RTDIRINTERNAL
*RTDIR
;
2112 /** Pointer to directory handle. */
2113 typedef RTDIR
*PRTDIR
;
2114 /** NIL directory handle. */
2115 #define NIL_RTDIR ((RTDIR)0)
2118 typedef R3R0PTRTYPE(struct RTFILEINT RT_FAR
*) RTFILE
;
2119 /** Pointer to file handle. */
2120 typedef RTFILE RT_FAR
*PRTFILE
;
2121 /** Nil file handle. */
2122 #define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
2124 /** Async I/O request handle. */
2125 typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL RT_FAR
*) RTFILEAIOREQ
;
2126 /** Pointer to an async I/O request handle. */
2127 typedef RTFILEAIOREQ RT_FAR
*PRTFILEAIOREQ
;
2128 /** Nil request handle. */
2129 #define NIL_RTFILEAIOREQ 0
2131 /** Async I/O completion context handle. */
2132 typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL RT_FAR
*) RTFILEAIOCTX
;
2133 /** Pointer to an async I/O completion context handle. */
2134 typedef RTFILEAIOCTX RT_FAR
*PRTFILEAIOCTX
;
2135 /** Nil context handle. */
2136 #define NIL_RTFILEAIOCTX 0
2138 /** ISO image maker handle. */
2139 typedef struct RTFSISOMAKERINT RT_FAR
*RTFSISOMAKER
;
2140 /** Pointer to an ISO image maker handle. */
2141 typedef RTFSISOMAKER RT_FAR
*PRTFSISOMAKER
;
2142 /** NIL ISO maker handle. */
2143 #define NIL_RTFSISOMAKER ((RTFSISOMAKER)0)
2145 /** INI-file handle. */
2146 typedef struct RTINIFILEINT RT_FAR
*RTINIFILE
;
2147 /** Pointer to an INI-file handle. */
2148 typedef RTINIFILE RT_FAR
*PRTINIFILE
;
2149 /** NIL INI-file handle. */
2150 #define NIL_RTINIFILE ((RTINIFILE)0)
2152 /** Loader module handle. */
2153 typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL RT_FAR
*) RTLDRMOD
;
2154 /** Pointer to a loader module handle. */
2155 typedef RTLDRMOD RT_FAR
*PRTLDRMOD
;
2156 /** Nil loader module handle. */
2157 #define NIL_RTLDRMOD 0
2159 /** Lock validator class handle. */
2160 typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT RT_FAR
*) RTLOCKVALCLASS
;
2161 /** Pointer to a lock validator class handle. */
2162 typedef RTLOCKVALCLASS RT_FAR
*PRTLOCKVALCLASS
;
2163 /** Nil lock validator class handle. */
2164 #define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
2166 /** Ring-0 memory object handle. */
2167 typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL RT_FAR
*) RTR0MEMOBJ
;
2168 /** Pointer to a Ring-0 memory object handle. */
2169 typedef RTR0MEMOBJ RT_FAR
*PRTR0MEMOBJ
;
2170 /** Nil ring-0 memory object handle. */
2171 #define NIL_RTR0MEMOBJ 0
2173 /** Native thread handle. */
2174 typedef RTHCUINTPTR RTNATIVETHREAD
;
2175 /** Pointer to an native thread handle. */
2176 typedef RTNATIVETHREAD RT_FAR
*PRTNATIVETHREAD
;
2177 /** Nil native thread handle. */
2178 #define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
2181 typedef R3R0PTRTYPE(struct RTPIPEINTERNAL RT_FAR
*) RTPIPE
;
2182 /** Pointer to a pipe handle. */
2183 typedef RTPIPE RT_FAR
*PRTPIPE
;
2184 /** Nil pipe handle.
2185 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
2186 #define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
2188 /** @typedef RTPOLLSET
2189 * Poll set handle. */
2190 typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL RT_FAR
*) RTPOLLSET
;
2191 /** Pointer to a poll set handle. */
2192 typedef RTPOLLSET RT_FAR
*PRTPOLLSET
;
2193 /** Nil poll set handle handle. */
2194 #define NIL_RTPOLLSET ((RTPOLLSET)0)
2196 /** Process identifier. */
2197 typedef uint32_t RTPROCESS
;
2198 /** Pointer to a process identifier. */
2199 typedef RTPROCESS RT_FAR
*PRTPROCESS
;
2200 /** Nil process identifier. */
2201 #define NIL_RTPROCESS (~(RTPROCESS)0)
2203 /** Process ring-0 handle. */
2204 typedef RTR0UINTPTR RTR0PROCESS
;
2205 /** Pointer to a ring-0 process handle. */
2206 typedef RTR0PROCESS RT_FAR
*PRTR0PROCESS
;
2207 /** Nil ring-0 process handle. */
2208 #define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
2210 /** @typedef RTSEMEVENT
2211 * Event Semaphore handle. */
2212 typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL RT_FAR
*) RTSEMEVENT
;
2213 /** Pointer to an event semaphore handle. */
2214 typedef RTSEMEVENT RT_FAR
*PRTSEMEVENT
;
2215 /** Nil event semaphore handle. */
2216 #define NIL_RTSEMEVENT 0
2218 /** @typedef RTSEMEVENTMULTI
2219 * Event Multiple Release Semaphore handle. */
2220 typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL RT_FAR
*) RTSEMEVENTMULTI
;
2221 /** Pointer to an event multiple release semaphore handle. */
2222 typedef RTSEMEVENTMULTI RT_FAR
*PRTSEMEVENTMULTI
;
2223 /** Nil multiple release event semaphore handle. */
2224 #define NIL_RTSEMEVENTMULTI 0
2226 /** @typedef RTSEMFASTMUTEX
2227 * Fast mutex Semaphore handle. */
2228 typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL RT_FAR
*) RTSEMFASTMUTEX
;
2229 /** Pointer to a fast mutex semaphore handle. */
2230 typedef RTSEMFASTMUTEX RT_FAR
*PRTSEMFASTMUTEX
;
2231 /** Nil fast mutex semaphore handle. */
2232 #define NIL_RTSEMFASTMUTEX 0
2234 /** @typedef RTSEMMUTEX
2235 * Mutex Semaphore handle. */
2236 typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL RT_FAR
*) RTSEMMUTEX
;
2237 /** Pointer to a mutex semaphore handle. */
2238 typedef RTSEMMUTEX RT_FAR
*PRTSEMMUTEX
;
2239 /** Nil mutex semaphore handle. */
2240 #define NIL_RTSEMMUTEX 0
2242 /** @typedef RTSEMSPINMUTEX
2243 * Spinning mutex Semaphore handle. */
2244 typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL RT_FAR
*) RTSEMSPINMUTEX
;
2245 /** Pointer to a spinning mutex semaphore handle. */
2246 typedef RTSEMSPINMUTEX RT_FAR
*PRTSEMSPINMUTEX
;
2247 /** Nil spinning mutex semaphore handle. */
2248 #define NIL_RTSEMSPINMUTEX 0
2250 /** @typedef RTSEMRW
2251 * Read/Write Semaphore handle. */
2252 typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL RT_FAR
*) RTSEMRW
;
2253 /** Pointer to a read/write semaphore handle. */
2254 typedef RTSEMRW RT_FAR
*PRTSEMRW
;
2255 /** Nil read/write semaphore handle. */
2256 #define NIL_RTSEMRW 0
2258 /** @typedef RTSEMXROADS
2259 * Crossroads semaphore handle. */
2260 typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL RT_FAR
*) RTSEMXROADS
;
2261 /** Pointer to a crossroads semaphore handle. */
2262 typedef RTSEMXROADS RT_FAR
*PRTSEMXROADS
;
2263 /** Nil crossroads semaphore handle. */
2264 #define NIL_RTSEMXROADS ((RTSEMXROADS)0)
2266 /** Spinlock handle. */
2267 typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL RT_FAR
*) RTSPINLOCK
;
2268 /** Pointer to a spinlock handle. */
2269 typedef RTSPINLOCK RT_FAR
*PRTSPINLOCK
;
2270 /** Nil spinlock handle. */
2271 #define NIL_RTSPINLOCK 0
2273 /** Socket handle. */
2274 typedef R3R0PTRTYPE(struct RTSOCKETINT RT_FAR
*) RTSOCKET
;
2275 /** Pointer to socket handle. */
2276 typedef RTSOCKET RT_FAR
*PRTSOCKET
;
2277 /** Nil socket handle. */
2278 #define NIL_RTSOCKET ((RTSOCKET)0)
2280 /** Pointer to a RTTCPSERVER handle. */
2281 typedef struct RTTCPSERVER RT_FAR
*PRTTCPSERVER
;
2282 /** Pointer to a RTTCPSERVER handle. */
2283 typedef PRTTCPSERVER RT_FAR
*PPRTTCPSERVER
;
2284 /** Nil RTTCPSERVER handle. */
2285 #define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
2287 /** Pointer to a RTUDPSERVER handle. */
2288 typedef struct RTUDPSERVER RT_FAR
*PRTUDPSERVER
;
2289 /** Pointer to a RTUDPSERVER handle. */
2290 typedef PRTUDPSERVER RT_FAR
*PPRTUDPSERVER
;
2291 /** Nil RTUDPSERVER handle. */
2292 #define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
2294 /** Thread handle.*/
2295 typedef R3R0PTRTYPE(struct RTTHREADINT RT_FAR
*) RTTHREAD
;
2296 /** Pointer to thread handle. */
2297 typedef RTTHREAD RT_FAR
*PRTTHREAD
;
2298 /** Nil thread handle. */
2299 #define NIL_RTTHREAD 0
2301 /** Thread context switching hook handle. */
2302 typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT RT_FAR
*) RTTHREADCTXHOOK
;
2303 /** Pointer to Thread context switching hook handle. */
2304 typedef RTTHREADCTXHOOK RT_FAR
*PRTTHREADCTXHOOK
;
2305 /** Nil Thread context switching hook handle. */
2306 #define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
2309 typedef RTHCINTPTR RTTLS
;
2310 /** Pointer to a TLS index. */
2311 typedef RTTLS RT_FAR
*PRTTLS
;
2312 /** Pointer to a const TLS index. */
2313 typedef RTTLS
const RT_FAR
*PCRTTLS
;
2314 /** NIL TLS index value. */
2315 #define NIL_RTTLS ((RTTLS)-1)
2317 /** Trace buffer handle.
2318 * @remarks This is not a R3/R0 type like most other handles!
2320 typedef struct RTTRACEBUFINT RT_FAR
*RTTRACEBUF
;
2321 /** Pointer to a trace buffer handle. */
2322 typedef RTTRACEBUF RT_FAR
*PRTTRACEBUF
;
2323 /** Nil trace buffer handle. */
2324 #define NIL_RTTRACEBUF ((RTTRACEBUF)0)
2325 /** The handle of the default trace buffer.
2326 * This can be used with any of the RTTraceBufAdd APIs. */
2327 #define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
2329 /** Handle to a simple heap. */
2330 typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL RT_FAR
*) RTHEAPSIMPLE
;
2331 /** Pointer to a handle to a simple heap. */
2332 typedef RTHEAPSIMPLE RT_FAR
*PRTHEAPSIMPLE
;
2333 /** NIL simple heap handle. */
2334 #define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
2336 /** Handle to an offset based heap. */
2337 typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL RT_FAR
*) RTHEAPOFFSET
;
2338 /** Pointer to a handle to an offset based heap. */
2339 typedef RTHEAPOFFSET RT_FAR
*PRTHEAPOFFSET
;
2340 /** NIL offset based heap handle. */
2341 #define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
2343 /** Handle to an environment block. */
2344 typedef R3PTRTYPE(struct RTENVINTERNAL RT_FAR
*) RTENV
;
2345 /** Pointer to a handle to an environment block. */
2346 typedef RTENV RT_FAR
*PRTENV
;
2347 /** NIL simple heap handle. */
2348 #define NIL_RTENV ((RTENV)0)
2350 /** A CPU identifier.
2351 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
2352 * does it have to correspond to the bits in the affinity mask, at
2353 * least not until we've sorted out Windows NT. */
2354 typedef uint32_t RTCPUID
;
2355 /** Pointer to a CPU identifier. */
2356 typedef RTCPUID RT_FAR
*PRTCPUID
;
2357 /** Pointer to a const CPU identifier. */
2358 typedef RTCPUID
const RT_FAR
*PCRTCPUID
;
2360 #define NIL_RTCPUID ((RTCPUID)~0)
2362 /** The maximum number of CPUs a set can contain and IPRT is able
2363 * to reference. (Should be max of support arch/platforms.)
2364 * @remarks Must be a multiple of 64 (see RTCPUSET). */
2365 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
2366 # define RTCPUSET_MAX_CPUS 256
2367 #elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
2368 # define RTCPUSET_MAX_CPUS 1024
2370 # define RTCPUSET_MAX_CPUS 64
2373 * @note Treat this as an opaque type and always use RTCpuSet* for
2374 * manipulating it. */
2375 typedef struct RTCPUSET
2378 uint64_t bmSet
[RTCPUSET_MAX_CPUS
/ 64];
2380 /** Pointer to a CPU set. */
2381 typedef RTCPUSET RT_FAR
*PRTCPUSET
;
2382 /** Pointer to a const CPU set. */
2383 typedef RTCPUSET
const RT_FAR
*PCRTCPUSET
;
2385 /** A handle table handle. */
2386 typedef R3R0PTRTYPE(struct RTHANDLETABLEINT RT_FAR
*) RTHANDLETABLE
;
2387 /** A pointer to a handle table handle. */
2388 typedef RTHANDLETABLE RT_FAR
*PRTHANDLETABLE
;
2389 /** @def NIL_RTHANDLETABLE
2390 * NIL handle table handle. */
2391 #define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
2393 /** A handle to a low resolution timer. */
2394 typedef R3R0PTRTYPE(struct RTTIMERLRINT RT_FAR
*) RTTIMERLR
;
2395 /** A pointer to a low resolution timer handle. */
2396 typedef RTTIMERLR RT_FAR
*PRTTIMERLR
;
2397 /** @def NIL_RTTIMERLR
2398 * NIL low resolution timer handle value. */
2399 #define NIL_RTTIMERLR ((RTTIMERLR)0)
2401 /** Handle to a random number generator. */
2402 typedef R3R0PTRTYPE(struct RTRANDINT RT_FAR
*) RTRAND
;
2403 /** Pointer to a random number generator handle. */
2404 typedef RTRAND RT_FAR
*PRTRAND
;
2405 /** NIL random number generator handle value. */
2406 #define NIL_RTRAND ((RTRAND)0)
2408 /** Debug address space handle. */
2409 typedef R3R0PTRTYPE(struct RTDBGASINT RT_FAR
*) RTDBGAS
;
2410 /** Pointer to a debug address space handle. */
2411 typedef RTDBGAS RT_FAR
*PRTDBGAS
;
2412 /** NIL debug address space handle. */
2413 #define NIL_RTDBGAS ((RTDBGAS)0)
2415 /** Debug module handle. */
2416 typedef R3R0PTRTYPE(struct RTDBGMODINT RT_FAR
*) RTDBGMOD
;
2417 /** Pointer to a debug module handle. */
2418 typedef RTDBGMOD RT_FAR
*PRTDBGMOD
;
2419 /** NIL debug module handle. */
2420 #define NIL_RTDBGMOD ((RTDBGMOD)0)
2422 /** Manifest handle. */
2423 typedef struct RTMANIFESTINT RT_FAR
*RTMANIFEST
;
2424 /** Pointer to a manifest handle. */
2425 typedef RTMANIFEST RT_FAR
*PRTMANIFEST
;
2426 /** NIL manifest handle. */
2427 #define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
2429 /** Memory pool handle. */
2430 typedef R3R0PTRTYPE(struct RTMEMPOOLINT RT_FAR
*) RTMEMPOOL
;
2431 /** Pointer to a memory pool handle. */
2432 typedef RTMEMPOOL RT_FAR
*PRTMEMPOOL
;
2433 /** NIL memory pool handle. */
2434 #define NIL_RTMEMPOOL ((RTMEMPOOL)0)
2435 /** The default memory pool handle. */
2436 #define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
2438 /** String cache handle. */
2439 typedef R3R0PTRTYPE(struct RTSTRCACHEINT RT_FAR
*) RTSTRCACHE
;
2440 /** Pointer to a string cache handle. */
2441 typedef RTSTRCACHE RT_FAR
*PRTSTRCACHE
;
2442 /** NIL string cache handle. */
2443 #define NIL_RTSTRCACHE ((RTSTRCACHE)0)
2444 /** The default string cache handle. */
2445 #define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
2448 /** Virtual Filesystem handle. */
2449 typedef struct RTVFSINTERNAL RT_FAR
*RTVFS
;
2450 /** Pointer to a VFS handle. */
2451 typedef RTVFS RT_FAR
*PRTVFS
;
2452 /** A NIL VFS handle. */
2453 #define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
2455 /** Virtual Filesystem base object handle. */
2456 typedef struct RTVFSOBJINTERNAL RT_FAR
*RTVFSOBJ
;
2457 /** Pointer to a VFS base object handle. */
2458 typedef RTVFSOBJ RT_FAR
*PRTVFSOBJ
;
2459 /** A NIL VFS base object handle. */
2460 #define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
2462 /** Virtual Filesystem directory handle. */
2463 typedef struct RTVFSDIRINTERNAL RT_FAR
*RTVFSDIR
;
2464 /** Pointer to a VFS directory handle. */
2465 typedef RTVFSDIR RT_FAR
*PRTVFSDIR
;
2466 /** A NIL VFS directory handle. */
2467 #define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
2469 /** Virtual Filesystem filesystem stream handle. */
2470 typedef struct RTVFSFSSTREAMINTERNAL RT_FAR
*RTVFSFSSTREAM
;
2471 /** Pointer to a VFS filesystem stream handle. */
2472 typedef RTVFSFSSTREAM RT_FAR
*PRTVFSFSSTREAM
;
2473 /** A NIL VFS filesystem stream handle. */
2474 #define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
2476 /** Virtual Filesystem I/O stream handle. */
2477 typedef struct RTVFSIOSTREAMINTERNAL RT_FAR
*RTVFSIOSTREAM
;
2478 /** Pointer to a VFS I/O stream handle. */
2479 typedef RTVFSIOSTREAM RT_FAR
*PRTVFSIOSTREAM
;
2480 /** A NIL VFS I/O stream handle. */
2481 #define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
2483 /** Virtual Filesystem file handle. */
2484 typedef struct RTVFSFILEINTERNAL RT_FAR
*RTVFSFILE
;
2485 /** Pointer to a VFS file handle. */
2486 typedef RTVFSFILE RT_FAR
*PRTVFSFILE
;
2487 /** A NIL VFS file handle. */
2488 #define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
2490 /** Virtual Filesystem symbolic link handle. */
2491 typedef struct RTVFSSYMLINKINTERNAL RT_FAR
*RTVFSSYMLINK
;
2492 /** Pointer to a VFS symbolic link handle. */
2493 typedef RTVFSSYMLINK RT_FAR
*PRTVFSSYMLINK
;
2494 /** A NIL VFS symbolic link handle. */
2495 #define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
2497 /** Async I/O manager handle. */
2498 typedef struct RTAIOMGRINT RT_FAR
*RTAIOMGR
;
2499 /** Pointer to a async I/O manager handle. */
2500 typedef RTAIOMGR RT_FAR
*PRTAIOMGR
;
2501 /** A NIL async I/O manager handle. */
2502 #define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
2504 /** Async I/O manager file handle. */
2505 typedef struct RTAIOMGRFILEINT RT_FAR
*RTAIOMGRFILE
;
2506 /** Pointer to a async I/O manager file handle. */
2507 typedef RTAIOMGRFILE RT_FAR
*PRTAIOMGRFILE
;
2508 /** A NIL async I/O manager file handle. */
2509 #define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
2511 /** Kernel module information record handle. */
2512 typedef struct RTKRNLMODINFOINT RT_FAR
*RTKRNLMODINFO
;
2513 /** Pointer to a kernel information record handle. */
2514 typedef RTKRNLMODINFO RT_FAR
*PRTKRNLMODINFO
;
2515 /** A NIL kernel module information record handle. */
2516 #define NIL_RTKRNLMODINFO ((RTKRNLMODINFO)~(uintptr_t)0);
2521 * This is usually used together with RTHANDLEUNION.
2523 typedef enum RTHANDLETYPE
2525 /** The invalid zero value. */
2526 RTHANDLETYPE_INVALID
= 0,
2531 /** Socket handle. */
2532 RTHANDLETYPE_SOCKET
,
2533 /** Thread handle. */
2534 RTHANDLETYPE_THREAD
,
2535 /** The end of the valid values. */
2537 /** The 32-bit type blow up. */
2538 RTHANDLETYPE_32BIT_HACK
= 0x7fffffff
2540 /** Pointer to a handle type. */
2541 typedef RTHANDLETYPE RT_FAR
*PRTHANDLETYPE
;
2546 * This is usually used together with RTHANDLETYPE or as RTHANDLE.
2548 typedef union RTHANDLEUNION
2550 RTFILE hFile
; /**< File handle. */
2551 RTPIPE hPipe
; /**< Pipe handle. */
2552 RTSOCKET hSocket
; /**< Socket handle. */
2553 RTTHREAD hThread
; /**< Thread handle. */
2554 /** Generic integer handle value.
2555 * Note that RTFILE is not yet pointer sized, so accessing it via this member
2556 * isn't necessarily safe or fully portable. */
2559 /** Pointer to a handle union. */
2560 typedef RTHANDLEUNION RT_FAR
*PRTHANDLEUNION
;
2561 /** Pointer to a const handle union. */
2562 typedef RTHANDLEUNION
const RT_FAR
*PCRTHANDLEUNION
;
2567 typedef struct RTHANDLE
2569 /** The handle type. */
2570 RTHANDLETYPE enmType
;
2571 /** The handle value. */
2574 /** Pointer to a generic handle. */
2575 typedef RTHANDLE RT_FAR
*PRTHANDLE
;
2576 /** Pointer to a const generic handle. */
2577 typedef RTHANDLE
const RT_FAR
*PCRTHANDLE
;
2583 * @remarks These have the correct file descriptor values for unixy systems and
2584 * can be used directly in code specific to those platforms.
2586 typedef enum RTHANDLESTD
2588 /** Invalid standard handle. */
2589 RTHANDLESTD_INVALID
= -1,
2590 /** The standard input handle. */
2591 RTHANDLESTD_INPUT
= 0,
2592 /** The standard output handle. */
2594 /** The standard error handle. */
2596 /** The typical 32-bit type hack. */
2597 RTHANDLESTD_32BIT_HACK
= 0x7fffffff
2606 typedef struct RTERRINFO
2608 /** Flags, see RTERRINFO_FLAGS_XXX. */
2610 /** The status code. */
2612 /** The size of the message */
2614 /** The error buffer. */
2616 /** Reserved for future use. */
2617 void *apvReserved
[2];
2619 /** Pointer to an error info structure. */
2620 typedef RTERRINFO RT_FAR
*PRTERRINFO
;
2621 /** Pointer to a const error info structure. */
2622 typedef RTERRINFO
const RT_FAR
*PCRTERRINFO
;
2625 * Static error info structure, see RTErrInfoInitStatic.
2627 typedef struct RTERRINFOSTATIC
2629 /** The core error info. */
2631 /** The static message buffer. */
2634 /** Pointer to a error info buffer. */
2635 typedef RTERRINFOSTATIC RT_FAR
*PRTERRINFOSTATIC
;
2636 /** Pointer to a const static error info buffer. */
2637 typedef RTERRINFOSTATIC
const RT_FAR
*PCRTERRINFOSTATIC
;
2645 * @remarks IPRT defines that the first three integers in the @c Gen struct
2646 * interpretation are in little endian representation. This is
2647 * different to many other UUID implementation, and requires
2648 * conversion if you need to achieve consistent results.
2650 typedef union RTUUID
2660 /** The way the UUID is declared by the DCE specification. */
2663 uint32_t u32TimeLow
;
2664 uint16_t u16TimeMid
;
2665 uint16_t u16TimeHiAndVersion
;
2666 uint8_t u8ClockSeqHiAndReserved
;
2667 uint8_t u8ClockSeqLow
;
2671 /** Pointer to UUID data. */
2672 typedef RTUUID RT_FAR
*PRTUUID
;
2673 /** Pointer to readonly UUID data. */
2674 typedef const RTUUID RT_FAR
*PCRTUUID
;
2676 /** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
2677 #define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
2679 /** UUID string maximum length. */
2680 #define RTUUID_STR_LENGTH 37
2683 /** Compression handle. */
2684 typedef struct RTZIPCOMP RT_FAR
*PRTZIPCOMP
;
2685 /** Decompressor handle. */
2686 typedef struct RTZIPDECOMP RT_FAR
*PRTZIPDECOMP
;
2690 * Unicode Code Point.
2692 typedef uint32_t RTUNICP
;
2693 /** Pointer to an Unicode Code Point. */
2694 typedef RTUNICP RT_FAR
*PRTUNICP
;
2695 /** Pointer to an Unicode Code Point. */
2696 typedef const RTUNICP RT_FAR
*PCRTUNICP
;
2697 /** Max value a RTUNICP type can hold. */
2698 #define RTUNICP_MAX ( ~(RTUNICP)0 )
2699 /** Invalid code point.
2700 * This is returned when encountered invalid encodings or invalid
2701 * unicode code points. */
2702 #define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
2707 * @remark wchar_t is not usable since it's compiler defined.
2708 * @remark When we use the term character we're not talking about unicode code point, but
2709 * the basic unit of the string encoding. Thus cwc - count of wide chars - means
2710 * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
2711 * and cch means count of the typedef 'char', which is assumed to be an octet.
2713 typedef uint16_t RTUTF16
;
2714 /** Pointer to a UTF-16 character. */
2715 typedef RTUTF16 RT_FAR
*PRTUTF16
;
2716 /** Pointer to a const UTF-16 character. */
2717 typedef const RTUTF16 RT_FAR
*PCRTUTF16
;
2721 * String tuple to go with the RT_STR_TUPLE macro.
2723 typedef struct RTSTRTUPLE
2727 /** The string length. */
2730 /** Pointer to a string tuple. */
2731 typedef RTSTRTUPLE RT_FAR
*PRTSTRTUPLE
;
2732 /** Pointer to a const string tuple. */
2733 typedef RTSTRTUPLE
const RT_FAR
*PCRTSTRTUPLE
;
2736 * Wait for ever if we have to.
2738 #define RT_INDEFINITE_WAIT (~0U)
2742 * Generic process callback.
2744 * @returns VBox status code. Failure will cancel the operation.
2745 * @param uPercentage The percentage of the operation which has been completed.
2746 * @param pvUser The user specified argument.
2748 typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage
, void *pvUser
);
2749 /** Pointer to a generic progress callback function, FNRTPROCESS(). */
2750 typedef FNRTPROGRESS
*PFNRTPROGRESS
;
2753 * Generic vprintf-like callback function for dumpers.
2755 * @param pvUser User argument.
2756 * @param pszFormat The format string.
2757 * @param va Arguments for the format string.
2759 typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser
, const char *pszFormat
, va_list va
) RT_IPRT_FORMAT_ATTR(2, 0);
2760 /** Pointer to a generic printf-like function for dumping. */
2761 typedef FNRTDUMPPRINTFV
*PFNRTDUMPPRINTFV
;
2765 * A point in a two dimentional coordinate system.
2767 typedef struct RTPOINT
2769 /** X coordinate. */
2771 /** Y coordinate. */
2774 /** Pointer to a point. */
2775 typedef RTPOINT RT_FAR
*PRTPOINT
;
2776 /** Pointer to a const point. */
2777 typedef const RTPOINT RT_FAR
*PCRTPOINT
;
2781 * Rectangle data type, double point.
2783 typedef struct RTRECT
2785 /** left X coordinate. */
2787 /** top Y coordinate. */
2789 /** right X coordinate. (exclusive) */
2791 /** bottom Y coordinate. (exclusive) */
2794 /** Pointer to a double point rectangle. */
2795 typedef RTRECT RT_FAR
*PRTRECT
;
2796 /** Pointer to a const double point rectangle. */
2797 typedef const RTRECT RT_FAR
*PCRTRECT
;
2801 * Rectangle data type, point + size.
2803 typedef struct RTRECT2
2806 * Unless stated otherwise, this is the top left corner. */
2809 * Unless stated otherwise, this is the top left corner. */
2812 * Unless stated otherwise, this is to the right of (x,y) and will not
2813 * be a negative number. */
2816 * Unless stated otherwise, this is down from (x,y) and will not be a
2817 * negative number. */
2820 /** Pointer to a point + size rectangle. */
2821 typedef RTRECT2 RT_FAR
*PRTRECT2
;
2822 /** Pointer to a const point + size rectangle. */
2823 typedef const RTRECT2 RT_FAR
*PCRTRECT2
;
2827 * The size of a rectangle.
2829 typedef struct RTRECTSIZE
2831 /** The width (along the x-axis). */
2833 /** The height (along the y-axis). */
2836 /** Pointer to a rectangle size. */
2837 typedef RTRECTSIZE RT_FAR
*PRTRECTSIZE
;
2838 /** Pointer to a const rectangle size. */
2839 typedef const RTRECTSIZE RT_FAR
*PCRTRECTSIZE
;
2843 * Ethernet MAC address.
2845 * The first 24 bits make up the Organisationally Unique Identifier (OUI),
2846 * where the first bit (little endian) indicates multicast (set) / unicast,
2847 * and the second bit indicates locally (set) / global administered. If all
2848 * bits are set, it's a broadcast.
2852 /** @todo add a bitfield view of this stuff. */
2858 /** Pointer to a MAC address. */
2859 typedef RTMAC RT_FAR
*PRTMAC
;
2860 /** Pointer to a readonly MAC address. */
2861 typedef const RTMAC RT_FAR
*PCRTMAC
;
2864 /** Pointer to a lock validator record.
2865 * The structure definition is found in iprt/lockvalidator.h. */
2866 typedef struct RTLOCKVALRECEXCL RT_FAR
*PRTLOCKVALRECEXCL
;
2867 /** Pointer to a record of one ownership share.
2868 * The structure definition is found in iprt/lockvalidator.h. */
2869 typedef struct RTLOCKVALRECSHRD RT_FAR
*PRTLOCKVALRECSHRD
;
2870 /** Pointer to a lock validator source position.
2871 * The structure definition is found in iprt/lockvalidator.h. */
2872 typedef struct RTLOCKVALSRCPOS RT_FAR
*PRTLOCKVALSRCPOS
;
2873 /** Pointer to a const lock validator source position.
2874 * The structure definition is found in iprt/lockvalidator.h. */
2875 typedef struct RTLOCKVALSRCPOS
const RT_FAR
*PCRTLOCKVALSRCPOS
;
2877 /** @name Special sub-class values.
2878 * The range 16..UINT32_MAX is available to the user, the range 0..15 is
2879 * reserved for the lock validator. In the user range the locks can only be
2880 * taking in ascending order.
2882 /** Invalid value. */
2883 #define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
2884 /** Not allowed to be taken with any other locks in the same class.
2885 * This is the recommended value. */
2886 #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
2887 /** Any order is allowed within the class. */
2888 #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
2889 /** The first user value. */
2890 #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
2897 typedef enum RTDIGESTTYPE
2899 /** Invalid digest value. */
2900 RTDIGESTTYPE_INVALID
= 0,
2901 /** Unknown digest type. */
2902 RTDIGESTTYPE_UNKNOWN
,
2903 /** CRC32 checksum. */
2905 /** CRC64 checksum. */
2907 /** MD2 checksum (unsafe!). */
2909 /** MD4 checksum (unsafe!!). */
2911 /** MD5 checksum (unsafe!). */
2913 /** SHA-1 checksum (unsafe!). */
2915 /** SHA-224 checksum. */
2916 RTDIGESTTYPE_SHA224
,
2917 /** SHA-256 checksum. */
2918 RTDIGESTTYPE_SHA256
,
2919 /** SHA-384 checksum. */
2920 RTDIGESTTYPE_SHA384
,
2921 /** SHA-512 checksum. */
2922 RTDIGESTTYPE_SHA512
,
2923 /** SHA-512/224 checksum. */
2924 RTDIGESTTYPE_SHA512T224
,
2925 /** SHA-512/256 checksum. */
2926 RTDIGESTTYPE_SHA512T256
,
2927 /** End of valid types. */
2929 /** Usual 32-bit type blowup. */
2930 RTDIGESTTYPE_32BIT_HACK
= 0x7fffffff
2934 * Process exit codes.
2936 typedef enum RTEXITCODE
2939 RTEXITCODE_SUCCESS
= 0,
2940 /** General failure. */
2941 RTEXITCODE_FAILURE
= 1,
2942 /** Invalid arguments. */
2943 RTEXITCODE_SYNTAX
= 2,
2944 /** Initialization failure (usually IPRT, but could be used for other
2945 * components as well). */
2946 RTEXITCODE_INIT
= 3,
2947 /** Test skipped. */
2948 RTEXITCODE_SKIPPED
= 4,
2949 /** The end of valid exit codes. */
2951 /** The usual 32-bit type hack. */
2952 RTEXITCODE_32BIT_HACK
= 0x7fffffff
2958 typedef struct RTRANGE
2960 /** Start offset. */
2965 /** Pointer to a range descriptor. */
2966 typedef RTRANGE RT_FAR
*PRTRANGE
;
2967 /** Pointer to a readonly range descriptor. */
2968 typedef const RTRANGE RT_FAR
*PCRTRANGE
;
2972 * Generic pointer union.
2974 typedef union RTPTRUNION
2976 /** Pointer into the void. */
2978 /** As a signed integer. */
2980 /** As an unsigned integer. */
2982 /** Pointer to char value. */
2984 /** Pointer to char value. */
2985 unsigned char RT_FAR
*puch
;
2986 /** Pointer to a int value. */
2988 /** Pointer to a unsigned int value. */
2989 unsigned int RT_FAR
*pu
;
2990 /** Pointer to a long value. */
2992 /** Pointer to a long value. */
2993 unsigned long RT_FAR
*pul
;
2994 /** Pointer to a 8-bit unsigned value. */
2995 uint8_t RT_FAR
*pu8
;
2996 /** Pointer to a 16-bit unsigned value. */
2997 uint16_t RT_FAR
*pu16
;
2998 /** Pointer to a 32-bit unsigned value. */
2999 uint32_t RT_FAR
*pu32
;
3000 /** Pointer to a 64-bit unsigned value. */
3001 uint64_t RT_FAR
*pu64
;
3002 /** Pointer to a UTF-16 character. */
3004 /** Pointer to a UUID character. */
3007 /** Pointer to a pointer union. */
3008 typedef RTPTRUNION RT_FAR
*PRTPTRUNION
;
3011 * Generic const pointer union.
3013 typedef union RTCPTRUNION
3015 /** Pointer into the void. */
3016 void const RT_FAR
*pv
;
3017 /** As a signed integer. */
3019 /** As an unsigned integer. */
3021 /** Pointer to char value. */
3022 char const RT_FAR
*pch
;
3023 /** Pointer to char value. */
3024 unsigned char const RT_FAR
*puch
;
3025 /** Pointer to a int value. */
3026 int const RT_FAR
*pi
;
3027 /** Pointer to a unsigned int value. */
3028 unsigned int const RT_FAR
*pu
;
3029 /** Pointer to a long value. */
3030 long const RT_FAR
*pl
;
3031 /** Pointer to a long value. */
3032 unsigned long const RT_FAR
*pul
;
3033 /** Pointer to a 8-bit unsigned value. */
3034 uint8_t const RT_FAR
*pu8
;
3035 /** Pointer to a 16-bit unsigned value. */
3036 uint16_t const RT_FAR
*pu16
;
3037 /** Pointer to a 32-bit unsigned value. */
3038 uint32_t const RT_FAR
*pu32
;
3039 /** Pointer to a 64-bit unsigned value. */
3040 uint64_t const RT_FAR
*pu64
;
3041 /** Pointer to a UTF-16 character. */
3043 /** Pointer to a UUID character. */
3046 /** Pointer to a const pointer union. */
3047 typedef RTCPTRUNION RT_FAR
*PRTCPTRUNION
;
3050 * Generic volatile pointer union.
3052 typedef union RTVPTRUNION
3054 /** Pointer into the void. */
3055 void volatile RT_FAR
*pv
;
3056 /** As a signed integer. */
3058 /** As an unsigned integer. */
3060 /** Pointer to char value. */
3061 char volatile RT_FAR
*pch
;
3062 /** Pointer to char value. */
3063 unsigned char volatile RT_FAR
*puch
;
3064 /** Pointer to a int value. */
3065 int volatile RT_FAR
*pi
;
3066 /** Pointer to a unsigned int value. */
3067 unsigned int volatile RT_FAR
*pu
;
3068 /** Pointer to a long value. */
3069 long volatile RT_FAR
*pl
;
3070 /** Pointer to a long value. */
3071 unsigned long volatile RT_FAR
*pul
;
3072 /** Pointer to a 8-bit unsigned value. */
3073 uint8_t volatile RT_FAR
*pu8
;
3074 /** Pointer to a 16-bit unsigned value. */
3075 uint16_t volatile RT_FAR
*pu16
;
3076 /** Pointer to a 32-bit unsigned value. */
3077 uint32_t volatile RT_FAR
*pu32
;
3078 /** Pointer to a 64-bit unsigned value. */
3079 uint64_t volatile RT_FAR
*pu64
;
3080 /** Pointer to a UTF-16 character. */
3081 RTUTF16
volatile RT_FAR
*pwc
;
3082 /** Pointer to a UUID character. */
3083 RTUUID
volatile RT_FAR
*pUuid
;
3085 /** Pointer to a const pointer union. */
3086 typedef RTVPTRUNION RT_FAR
*PRTVPTRUNION
;
3089 * Generic const volatile pointer union.
3091 typedef union RTCVPTRUNION
3093 /** Pointer into the void. */
3094 void const volatile RT_FAR
*pv
;
3095 /** As a signed integer. */
3097 /** As an unsigned integer. */
3099 /** Pointer to char value. */
3100 char const volatile RT_FAR
*pch
;
3101 /** Pointer to char value. */
3102 unsigned char const volatile RT_FAR
*puch
;
3103 /** Pointer to a int value. */
3104 int const volatile RT_FAR
*pi
;
3105 /** Pointer to a unsigned int value. */
3106 unsigned int const volatile RT_FAR
*pu
;
3107 /** Pointer to a long value. */
3108 long const volatile RT_FAR
*pl
;
3109 /** Pointer to a long value. */
3110 unsigned long const volatile RT_FAR
*pul
;
3111 /** Pointer to a 8-bit unsigned value. */
3112 uint8_t const volatile RT_FAR
*pu8
;
3113 /** Pointer to a 16-bit unsigned value. */
3114 uint16_t const volatile RT_FAR
*pu16
;
3115 /** Pointer to a 32-bit unsigned value. */
3116 uint32_t const volatile RT_FAR
*pu32
;
3117 /** Pointer to a 64-bit unsigned value. */
3118 uint64_t const volatile RT_FAR
*pu64
;
3119 /** Pointer to a UTF-16 character. */
3120 RTUTF16
const volatile RT_FAR
*pwc
;
3121 /** Pointer to a UUID character. */
3122 RTUUID
const volatile RT_FAR
*pUuid
;
3124 /** Pointer to a const pointer union. */
3125 typedef RTCVPTRUNION RT_FAR
*PRTCVPTRUNION
;
3131 * Strict type validation helper class.
3133 * See RTErrStrictType and RT_SUCCESS_NP.
3135 class RTErrStrictType2
3138 /** The status code. */
3144 * @param rc IPRT style status code.
3146 RTErrStrictType2(int32_t rc
) : m_rc(rc
)
3151 * Get the status code.
3152 * @returns IPRT style status code.
3154 int32_t getValue() const
3159 #endif /* __cplusplus */