VirtualBox

source: vbox/trunk/include/iprt/types.h@ 55950

Last change on this file since 55950 was 55863, checked in by vboxsync, 10 years ago

IPRT,SUPDrv,VMM: Revised the context switching hook interface. Do less work when enabling the hook (formerly 'registration'). Drop the reference counting (kept internally for solaris) as it complicates restrictions wrt destroying enabled hooks. Bumped support driver version.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 78.4 KB
Line 
1/** @file
2 * IPRT - Types.
3 */
4
5/*
6 * Copyright (C) 2006-2014 Oracle Corporation
7 *
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.
15 *
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.
21 *
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.
24 */
25
26#ifndef ___iprt_types_h
27#define ___iprt_types_h
28
29#include <iprt/cdefs.h>
30#include <iprt/stdint.h>
31#include <iprt/stdarg.h>
32
33/*
34 * Include standard C types.
35 */
36#ifndef IPRT_NO_CRT
37
38# if defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
39 /*
40 * Kludge for xfree86 modules: size_t and other types are redefined.
41 */
42RT_C_DECLS_BEGIN
43# include "xf86_ansic.h"
44# undef NULL
45RT_C_DECLS_END
46
47# elif defined(RT_OS_DARWIN) && defined(KERNEL)
48 /*
49 * Kludge for the darwin kernel:
50 * stddef.h is missing IIRC.
51 */
52# ifndef _PTRDIFF_T
53# define _PTRDIFF_T
54 typedef __darwin_ptrdiff_t ptrdiff_t;
55# endif
56# include <sys/types.h>
57
58# elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
59 /*
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.
63 */
64# ifndef _STDDEF_H_
65# undef offsetof
66# endif
67# include <sys/stddef.h>
68# ifndef _SYS_TYPES_H_
69# undef offsetof
70# endif
71# include <sys/types.h>
72# ifndef offsetof
73# error "offsetof is not defined..."
74# endif
75
76# elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
77 /*
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.
83 */
84# include <stddef.h>
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>
90
91# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
92 /*
93 * Kludge for the linux kernel:
94 * 1. sys/types.h doesn't mix with the kernel.
95 * 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
96 * declares false and true as enum values.
97 * 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
98 * We work around these issues here and nowhere else.
99 */
100# include <stddef.h>
101# if defined(__cplusplus)
102 typedef bool _Bool;
103# endif
104# define bool linux_bool
105# define true linux_true
106# define false linux_false
107# define uintptr_t linux_uintptr_t
108# include <linux/version.h>
109# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
110# include <generated/autoconf.h>
111# else
112# ifndef AUTOCONF_INCLUDED
113# include <linux/autoconf.h>
114# endif
115# endif
116# include <linux/compiler.h>
117# if defined(__cplusplus)
118 /*
119 * Starting with 3.3, <linux/compiler-gcc.h> appends 'notrace' (which
120 * expands to __attribute__((no_instrument_function))) to inline,
121 * __inline and __inline__. Revert that.
122 */
123# undef inline
124# define inline inline
125# undef __inline__
126# define __inline__ __inline__
127# undef __inline
128# define __inline __inline
129# endif
130# include <linux/types.h>
131# include <linux/stddef.h>
132 /*
133 * Starting with 3.4, <linux/stddef.h> defines NULL as '((void*)0)' which
134 * does not work for C++ code.
135 */
136# undef NULL
137# undef uintptr_t
138# ifdef __GNUC__
139# if (__GNUC__ * 100 + __GNUC_MINOR__) <= 400
140 /*
141 * <linux/compiler-gcc{3,4}.h> does
142 * #define __inline__ __inline__ __attribute__((always_inline))
143 * in some older Linux kernels. Forcing inlining will fail for some RTStrA*
144 * functions with gcc <= 4.0 due to passing variable argument lists.
145 */
146# undef __inline__
147# define __inline__ __inline__
148# endif
149# endif
150# undef false
151# undef true
152# undef bool
153# else
154# include <stddef.h>
155# include <sys/types.h>
156# endif
157
158
159/* Define any types missing from sys/types.h on windows. */
160# ifdef _MSC_VER
161# undef ssize_t
162 typedef intptr_t ssize_t;
163# endif
164
165#else /* no crt */
166# include <iprt/nocrt/compiler/compiler.h>
167#endif /* no crt */
168
169
170
171/** @def NULL
172 * NULL pointer.
173 */
174#ifndef NULL
175# ifdef __cplusplus
176# define NULL 0
177# else
178# define NULL ((void*)0)
179# endif
180#endif
181
182
183
184/** @defgroup grp_rt_types IPRT Base Types
185 * @{
186 */
187
188/* define wchar_t, we don't wanna include all the wcsstuff to get this. */
189#ifdef _MSC_VER
190# ifndef _WCHAR_T_DEFINED
191 typedef unsigned short wchar_t;
192# define _WCHAR_T_DEFINED
193# endif
194#endif
195#ifdef __GNUC__
196/** @todo wchar_t on GNUC */
197#endif
198
199/*
200 * C doesn't have bool, nor does VisualAge for C++ v3.08.
201 */
202#if !defined(__cplusplus) || (defined(__IBMCPP__) && defined(RT_OS_OS2))
203# if defined(__GNUC__)
204# if defined(RT_OS_LINUX) && __GNUC__ < 3
205typedef uint8_t bool;
206# elif defined(RT_OS_FREEBSD)
207# ifndef __bool_true_false_are_defined
208typedef _Bool bool;
209# endif
210# else
211# if (defined(RT_OS_DARWIN) || defined(RT_OS_HAIKU)) && (defined(_STDBOOL_H) || defined(__STDBOOL_H))
212# undef bool
213# endif
214typedef _Bool bool;
215# endif
216# else
217typedef unsigned char bool;
218# endif
219# ifndef true
220# define true (1)
221# endif
222# ifndef false
223# define false (0)
224# endif
225#endif
226
227/**
228 * 128-bit unsigned integer.
229 */
230#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
231typedef __uint128_t uint128_t;
232#else
233typedef struct uint128_s
234{
235# ifdef RT_BIG_ENDIAN
236 uint64_t Hi;
237 uint64_t Lo;
238# else
239 uint64_t Lo;
240 uint64_t Hi;
241# endif
242} uint128_t;
243#endif
244
245
246/**
247 * 128-bit signed integer.
248 */
249#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
250typedef __int128_t int128_t;
251#else
252typedef struct int128_s
253{
254# ifdef RT_BIG_ENDIAN
255 int64_t Hi;
256 uint64_t Lo;
257# else
258 uint64_t Lo;
259 int64_t Hi;
260# endif
261} int128_t;
262#endif
263
264
265/**
266 * 16-bit unsigned integer union.
267 */
268typedef union RTUINT16U
269{
270 /** natural view. */
271 uint16_t u;
272
273 /** 16-bit view. */
274 uint16_t au16[1];
275 /** 8-bit view. */
276 uint8_t au8[2];
277 /** 16-bit hi/lo view. */
278 struct
279 {
280#ifdef RT_BIG_ENDIAN
281 uint8_t Hi;
282 uint8_t Lo;
283#else
284 uint8_t Lo;
285 uint8_t Hi;
286#endif
287 } s;
288} RTUINT16U;
289/** Pointer to a 16-bit unsigned integer union. */
290typedef RTUINT16U *PRTUINT16U;
291/** Pointer to a const 32-bit unsigned integer union. */
292typedef const RTUINT16U *PCRTUINT16U;
293
294
295/**
296 * 32-bit unsigned integer union.
297 */
298typedef union RTUINT32U
299{
300 /** natural view. */
301 uint32_t u;
302 /** Hi/Low view. */
303 struct
304 {
305#ifdef RT_BIG_ENDIAN
306 uint16_t Hi;
307 uint16_t Lo;
308#else
309 uint16_t Lo;
310 uint16_t Hi;
311#endif
312 } s;
313 /** Word view. */
314 struct
315 {
316#ifdef RT_BIG_ENDIAN
317 uint16_t w1;
318 uint16_t w0;
319#else
320 uint16_t w0;
321 uint16_t w1;
322#endif
323 } Words;
324
325 /** 32-bit view. */
326 uint32_t au32[1];
327 /** 16-bit view. */
328 uint16_t au16[2];
329 /** 8-bit view. */
330 uint8_t au8[4];
331} RTUINT32U;
332/** Pointer to a 32-bit unsigned integer union. */
333typedef RTUINT32U *PRTUINT32U;
334/** Pointer to a const 32-bit unsigned integer union. */
335typedef const RTUINT32U *PCRTUINT32U;
336
337
338/**
339 * 64-bit unsigned integer union.
340 */
341typedef union RTUINT64U
342{
343 /** Natural view. */
344 uint64_t u;
345 /** Hi/Low view. */
346 struct
347 {
348#ifdef RT_BIG_ENDIAN
349 uint32_t Hi;
350 uint32_t Lo;
351#else
352 uint32_t Lo;
353 uint32_t Hi;
354#endif
355 } s;
356 /** Double-Word view. */
357 struct
358 {
359#ifdef RT_BIG_ENDIAN
360 uint32_t dw1;
361 uint32_t dw0;
362#else
363 uint32_t dw0;
364 uint32_t dw1;
365#endif
366 } DWords;
367 /** Word view. */
368 struct
369 {
370#ifdef RT_BIG_ENDIAN
371 uint16_t w3;
372 uint16_t w2;
373 uint16_t w1;
374 uint16_t w0;
375#else
376 uint16_t w0;
377 uint16_t w1;
378 uint16_t w2;
379 uint16_t w3;
380#endif
381 } Words;
382
383 /** 64-bit view. */
384 uint64_t au64[1];
385 /** 32-bit view. */
386 uint32_t au32[2];
387 /** 16-bit view. */
388 uint16_t au16[4];
389 /** 8-bit view. */
390 uint8_t au8[8];
391} RTUINT64U;
392/** Pointer to a 64-bit unsigned integer union. */
393typedef RTUINT64U *PRTUINT64U;
394/** Pointer to a const 64-bit unsigned integer union. */
395typedef const RTUINT64U *PCRTUINT64U;
396
397
398/**
399 * 128-bit unsigned integer union.
400 */
401#pragma pack(1)
402typedef union RTUINT128U
403{
404 /** Hi/Low view.
405 * @remarks We put this first so we can have portable initializers
406 * (RTUINT128_INIT) */
407 struct
408 {
409#ifdef RT_BIG_ENDIAN
410 uint64_t Hi;
411 uint64_t Lo;
412#else
413 uint64_t Lo;
414 uint64_t Hi;
415#endif
416 } s;
417
418 /** Natural view.
419 * WARNING! This member depends on the compiler supporting 128-bit stuff. */
420 uint128_t u;
421
422 /** Quad-Word view. */
423 struct
424 {
425#ifdef RT_BIG_ENDIAN
426 uint64_t qw1;
427 uint64_t qw0;
428#else
429 uint64_t qw0;
430 uint64_t qw1;
431#endif
432 } QWords;
433 /** Double-Word view. */
434 struct
435 {
436#ifdef RT_BIG_ENDIAN
437 uint32_t dw3;
438 uint32_t dw2;
439 uint32_t dw1;
440 uint32_t dw0;
441#else
442 uint32_t dw0;
443 uint32_t dw1;
444 uint32_t dw2;
445 uint32_t dw3;
446#endif
447 } DWords;
448 /** Word view. */
449 struct
450 {
451#ifdef RT_BIG_ENDIAN
452 uint16_t w7;
453 uint16_t w6;
454 uint16_t w5;
455 uint16_t w4;
456 uint16_t w3;
457 uint16_t w2;
458 uint16_t w1;
459 uint16_t w0;
460#else
461 uint16_t w0;
462 uint16_t w1;
463 uint16_t w2;
464 uint16_t w3;
465 uint16_t w4;
466 uint16_t w5;
467 uint16_t w6;
468 uint16_t w7;
469#endif
470 } Words;
471
472 /** 64-bit view. */
473 uint64_t au64[2];
474 /** 32-bit view. */
475 uint32_t au32[4];
476 /** 16-bit view. */
477 uint16_t au16[8];
478 /** 8-bit view. */
479 uint8_t au8[16];
480} RTUINT128U;
481#pragma pack()
482/** Pointer to a 64-bit unsigned integer union. */
483typedef RTUINT128U *PRTUINT128U;
484/** Pointer to a const 64-bit unsigned integer union. */
485typedef const RTUINT128U *PCRTUINT128U;
486
487/** @def RTUINT128_INIT
488 * Portable RTUINT128U initializer. */
489#ifdef RT_BIG_ENDIAN
490# define RTUINT128_INIT(a_Hi, a_Lo) { { a_Hi, a_Lo } }
491#else
492# define RTUINT128_INIT(a_Hi, a_Lo) { { a_Lo, a_Hi } }
493#endif
494
495/** @def RTUINT128_INIT_C
496 * Portable RTUINT128U initializer for 64-bit constants. */
497#ifdef RT_BIG_ENDIAN
498# define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Hi), UINT64_C(a_Lo) } }
499#else
500# define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Lo), UINT64_C(a_Hi) } }
501#endif
502
503
504/**
505 * Double precision floating point format (64-bit).
506 */
507typedef union RTFLOAT64U
508{
509#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
510 /** Double view. */
511 double rd;
512#endif
513 /** Format using regular bitfields. */
514 struct
515 {
516# ifdef RT_BIG_ENDIAN
517 /** The sign indicator. */
518 uint32_t fSign : 1;
519 /** The exponent (offseted by 1023). */
520 uint32_t uExponent : 11;
521 /** The fraction, bits 32 thru 51. */
522 uint32_t u20FractionHigh : 20;
523 /** The fraction, bits 0 thru 31. */
524 uint32_t u32FractionLow;
525# else
526 /** The fraction, bits 0 thru 31. */
527 uint32_t u32FractionLow;
528 /** The fraction, bits 32 thru 51. */
529 uint32_t u20FractionHigh : 20;
530 /** The exponent (offseted by 1023). */
531 uint32_t uExponent : 11;
532 /** The sign indicator. */
533 uint32_t fSign : 1;
534# endif
535 } s;
536
537#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
538 /** Format using 64-bit bitfields. */
539 RT_GCC_EXTENSION struct
540 {
541# ifdef RT_BIG_ENDIAN
542 /** The sign indicator. */
543 RT_GCC_EXTENSION uint64_t fSign : 1;
544 /** The exponent (offseted by 1023). */
545 RT_GCC_EXTENSION uint64_t uExponent : 11;
546 /** The fraction. */
547 RT_GCC_EXTENSION uint64_t uFraction : 52;
548# else
549 /** The fraction. */
550 RT_GCC_EXTENSION uint64_t uFraction : 52;
551 /** The exponent (offseted by 1023). */
552 RT_GCC_EXTENSION uint64_t uExponent : 11;
553 /** The sign indicator. */
554 RT_GCC_EXTENSION uint64_t fSign : 1;
555# endif
556 } s64;
557#endif
558
559 /** 64-bit view. */
560 uint64_t au64[1];
561 /** 32-bit view. */
562 uint32_t au32[2];
563 /** 16-bit view. */
564 uint16_t au16[4];
565 /** 8-bit view. */
566 uint8_t au8[8];
567} RTFLOAT64U;
568/** Pointer to a double precision floating point format union. */
569typedef RTFLOAT64U *PRTFLOAT64U;
570/** Pointer to a const double precision floating point format union. */
571typedef const RTFLOAT64U *PCRTFLOAT64U;
572
573
574#if !defined(__IBMCPP__) && !defined(__IBMC__)
575
576/**
577 * Extended Double precision floating point format (80-bit).
578 */
579#pragma pack(1)
580typedef union RTFLOAT80U
581{
582 /** Format using bitfields. */
583 RT_GCC_EXTENSION struct
584 {
585# ifdef RT_BIG_ENDIAN
586 /** The sign indicator. */
587 RT_GCC_EXTENSION uint16_t fSign : 1;
588 /** The exponent (offseted by 16383). */
589 RT_GCC_EXTENSION uint16_t uExponent : 15;
590 /** The mantissa. */
591 uint64_t u64Mantissa;
592# else
593 /** The mantissa. */
594 uint64_t u64Mantissa;
595 /** The exponent (offseted by 16383). */
596 RT_GCC_EXTENSION uint16_t uExponent : 15;
597 /** The sign indicator. */
598 RT_GCC_EXTENSION uint16_t fSign : 1;
599# endif
600 } s;
601
602 /** 64-bit view. */
603 uint64_t au64[1];
604 /** 32-bit view. */
605 uint32_t au32[2];
606 /** 16-bit view. */
607 uint16_t au16[5];
608 /** 8-bit view. */
609 uint8_t au8[10];
610} RTFLOAT80U;
611#pragma pack()
612/** Pointer to a extended precision floating point format union. */
613typedef RTFLOAT80U *PRTFLOAT80U;
614/** Pointer to a const extended precision floating point format union. */
615typedef const RTFLOAT80U *PCRTFLOAT80U;
616
617
618/**
619 * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
620 * compiler implements long double.
621 */
622#pragma pack(1)
623typedef union RTFLOAT80U2
624{
625#ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
626 /** Long double view. */
627 long double lrd;
628#endif
629 /** Format using bitfields. */
630 RT_GCC_EXTENSION struct
631 {
632#ifdef RT_BIG_ENDIAN
633 /** The sign indicator. */
634 RT_GCC_EXTENSION uint16_t fSign : 1;
635 /** The exponent (offseted by 16383). */
636 RT_GCC_EXTENSION uint16_t uExponent : 15;
637 /** The mantissa. */
638 uint64_t u64Mantissa;
639#else
640 /** The mantissa. */
641 uint64_t u64Mantissa;
642 /** The exponent (offseted by 16383). */
643 RT_GCC_EXTENSION uint16_t uExponent : 15;
644 /** The sign indicator. */
645 RT_GCC_EXTENSION uint16_t fSign : 1;
646#endif
647 } s;
648
649 /** Bitfield exposing the J bit and the fraction. */
650 RT_GCC_EXTENSION struct
651 {
652#ifdef RT_BIG_ENDIAN
653 /** The sign indicator. */
654 RT_GCC_EXTENSION uint16_t fSign : 1;
655 /** The exponent (offseted by 16383). */
656 RT_GCC_EXTENSION uint16_t uExponent : 15;
657 /** The J bit, aka the integer bit. */
658 uint32_t fInteger;
659 /** The fraction, bits 32 thru 62. */
660 uint32_t u31FractionHigh : 31;
661 /** The fraction, bits 0 thru 31. */
662 uint32_t u32FractionLow : 32;
663#else
664 /** The fraction, bits 0 thru 31. */
665 uint32_t u32FractionLow : 32;
666 /** The fraction, bits 32 thru 62. */
667 uint32_t u31FractionHigh : 31;
668 /** The J bit, aka the integer bit. */
669 uint32_t fInteger;
670 /** The exponent (offseted by 16383). */
671 RT_GCC_EXTENSION uint16_t uExponent : 15;
672 /** The sign indicator. */
673 RT_GCC_EXTENSION uint16_t fSign : 1;
674#endif
675 } sj;
676
677#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
678 /** 64-bit bitfields exposing the J bit and the fraction. */
679 RT_GCC_EXTENSION struct
680 {
681# ifdef RT_BIG_ENDIAN
682 /** The sign indicator. */
683 RT_GCC_EXTENSION uint16_t fSign : 1;
684 /** The exponent (offseted by 16383). */
685 RT_GCC_EXTENSION uint16_t uExponent : 15;
686 /** The J bit, aka the integer bit. */
687 RT_GCC_EXTENSION uint64_t fInteger : 1;
688 /** The fraction. */
689 RT_GCC_EXTENSION uint64_t u63Fraction : 63;
690# else
691 /** The fraction. */
692 RT_GCC_EXTENSION uint64_t u63Fraction : 63;
693 /** The J bit, aka the integer bit. */
694 RT_GCC_EXTENSION uint64_t fInteger : 1;
695 /** The exponent (offseted by 16383). */
696 RT_GCC_EXTENSION uint16_t uExponent : 15;
697 /** The sign indicator. */
698 RT_GCC_EXTENSION uint16_t fSign : 1;
699# endif
700 } sj64;
701#endif
702
703 /** 64-bit view. */
704 uint64_t au64[1];
705 /** 32-bit view. */
706 uint32_t au32[2];
707 /** 16-bit view. */
708 uint16_t au16[5];
709 /** 8-bit view. */
710 uint8_t au8[10];
711} RTFLOAT80U2;
712#pragma pack()
713/** Pointer to a extended precision floating point format union, 2nd
714 * variant. */
715typedef RTFLOAT80U2 *PRTFLOAT80U2;
716/** Pointer to a const extended precision floating point format union, 2nd
717 * variant. */
718typedef const RTFLOAT80U2 *PCRTFLOAT80U2;
719
720#endif /* uint16_t bitfields doesn't work */
721
722
723/** Generic function type.
724 * @see PFNRT
725 */
726typedef DECLCALLBACK(void) FNRT(void);
727
728/** Generic function pointer.
729 * With -pedantic, gcc-4 complains when casting a function to a data object, for
730 * example:
731 *
732 * @code
733 * void foo(void)
734 * {
735 * }
736 *
737 * void *bar = (void *)foo;
738 * @endcode
739 *
740 * The compiler would warn with "ISO C++ forbids casting between
741 * pointer-to-function and pointer-to-object". The purpose of this warning is
742 * not to bother the programmer but to point out that he is probably doing
743 * something dangerous, assigning a pointer to executable code to a data object.
744 */
745typedef FNRT *PFNRT;
746
747/** Millisecond interval. */
748typedef uint32_t RTMSINTERVAL;
749/** Pointer to a millisecond interval. */
750typedef RTMSINTERVAL *PRTMSINTERVAL;
751/** Pointer to a const millisecond interval. */
752typedef const RTMSINTERVAL *PCRTMSINTERVAL;
753
754/** Pointer to a time spec structure. */
755typedef struct RTTIMESPEC *PRTTIMESPEC;
756/** Pointer to a const time spec structure. */
757typedef const struct RTTIMESPEC *PCRTTIMESPEC;
758
759
760
761/** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
762 * @{
763 */
764
765/** Signed integer which can contain both GC and HC pointers. */
766#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
767typedef int32_t RTINTPTR;
768#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
769typedef int64_t RTINTPTR;
770#else
771# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
772#endif
773/** Pointer to signed integer which can contain both GC and HC pointers. */
774typedef RTINTPTR *PRTINTPTR;
775/** Pointer const to signed integer which can contain both GC and HC pointers. */
776typedef const RTINTPTR *PCRTINTPTR;
777/** The maximum value the RTINTPTR type can hold. */
778#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
779# define RTINTPTR_MAX INT32_MAX
780#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
781# define RTINTPTR_MAX INT64_MAX
782#else
783# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
784#endif
785/** The minimum value the RTINTPTR type can hold. */
786#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
787# define RTINTPTR_MIN INT32_MIN
788#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
789# define RTINTPTR_MIN INT64_MIN
790#else
791# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
792#endif
793
794/** Unsigned integer which can contain both GC and HC pointers. */
795#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
796typedef uint32_t RTUINTPTR;
797#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
798typedef uint64_t RTUINTPTR;
799#else
800# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
801#endif
802/** Pointer to unsigned integer which can contain both GC and HC pointers. */
803typedef RTUINTPTR *PRTUINTPTR;
804/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
805typedef const RTUINTPTR *PCRTUINTPTR;
806/** The maximum value the RTUINTPTR type can hold. */
807#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
808# define RTUINTPTR_MAX UINT32_MAX
809#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
810# define RTUINTPTR_MAX UINT64_MAX
811#else
812# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
813#endif
814
815/** Signed integer. */
816typedef int32_t RTINT;
817/** Pointer to signed integer. */
818typedef RTINT *PRTINT;
819/** Pointer to const signed integer. */
820typedef const RTINT *PCRTINT;
821
822/** Unsigned integer. */
823typedef uint32_t RTUINT;
824/** Pointer to unsigned integer. */
825typedef RTUINT *PRTUINT;
826/** Pointer to const unsigned integer. */
827typedef const RTUINT *PCRTUINT;
828
829/** A file offset / size (off_t). */
830typedef int64_t RTFOFF;
831/** Pointer to a file offset / size. */
832typedef RTFOFF *PRTFOFF;
833/** The max value for RTFOFF. */
834#define RTFOFF_MAX INT64_MAX
835/** The min value for RTFOFF. */
836#define RTFOFF_MIN INT64_MIN
837
838/** File mode (see iprt/fs.h). */
839typedef uint32_t RTFMODE;
840/** Pointer to file mode. */
841typedef RTFMODE *PRTFMODE;
842
843/** Device unix number. */
844typedef uint32_t RTDEV;
845/** Pointer to a device unix number. */
846typedef RTDEV *PRTDEV;
847
848/** @name RTDEV Macros
849 * @{ */
850/**
851 * Our makedev macro.
852 * @returns RTDEV
853 * @param uMajor The major device number.
854 * @param uMinor The minor device number.
855 */
856#define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
857/**
858 * Get the major device node number from an RTDEV type.
859 * @returns The major device number of @a uDev
860 * @param uDev The device number.
861 */
862#define RTDEV_MAJOR(uDev) ((uDev) >> 24)
863/**
864 * Get the minor device node number from an RTDEV type.
865 * @returns The minor device number of @a uDev
866 * @param uDev The device number.
867 */
868#define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
869/** @} */
870
871/** i-node number. */
872typedef uint64_t RTINODE;
873/** Pointer to a i-node number. */
874typedef RTINODE *PRTINODE;
875
876/** User id. */
877typedef uint32_t RTUID;
878/** Pointer to a user id. */
879typedef RTUID *PRTUID;
880/** NIL user id.
881 * @todo check this for portability! */
882#define NIL_RTUID (~(RTUID)0)
883
884/** Group id. */
885typedef uint32_t RTGID;
886/** Pointer to a group id. */
887typedef RTGID *PRTGID;
888/** NIL group id.
889 * @todo check this for portability! */
890#define NIL_RTGID (~(RTGID)0)
891
892/** I/O Port. */
893typedef uint16_t RTIOPORT;
894/** Pointer to I/O Port. */
895typedef RTIOPORT *PRTIOPORT;
896/** Pointer to const I/O Port. */
897typedef const RTIOPORT *PCRTIOPORT;
898
899/** Selector. */
900typedef uint16_t RTSEL;
901/** Pointer to selector. */
902typedef RTSEL *PRTSEL;
903/** Pointer to const selector. */
904typedef const RTSEL *PCRTSEL;
905/** Max selector value. */
906#define RTSEL_MAX UINT16_MAX
907
908/** Far 16-bit pointer. */
909#pragma pack(1)
910typedef struct RTFAR16
911{
912 uint16_t off;
913 RTSEL sel;
914} RTFAR16;
915#pragma pack()
916/** Pointer to Far 16-bit pointer. */
917typedef RTFAR16 *PRTFAR16;
918/** Pointer to const Far 16-bit pointer. */
919typedef const RTFAR16 *PCRTFAR16;
920
921/** Far 32-bit pointer. */
922#pragma pack(1)
923typedef struct RTFAR32
924{
925 uint32_t off;
926 RTSEL sel;
927} RTFAR32;
928#pragma pack()
929/** Pointer to Far 32-bit pointer. */
930typedef RTFAR32 *PRTFAR32;
931/** Pointer to const Far 32-bit pointer. */
932typedef const RTFAR32 *PCRTFAR32;
933
934/** Far 64-bit pointer. */
935#pragma pack(1)
936typedef struct RTFAR64
937{
938 uint64_t off;
939 RTSEL sel;
940} RTFAR64;
941#pragma pack()
942/** Pointer to Far 64-bit pointer. */
943typedef RTFAR64 *PRTFAR64;
944/** Pointer to const Far 64-bit pointer. */
945typedef const RTFAR64 *PCRTFAR64;
946
947/** @} */
948
949
950/** @defgroup grp_rt_types_hc Host Context Basic Types
951 * @{
952 */
953
954/** HC Natural signed integer.
955 * @deprecated silly type. */
956typedef int32_t RTHCINT;
957/** Pointer to HC Natural signed integer.
958 * @deprecated silly type. */
959typedef RTHCINT *PRTHCINT;
960/** Pointer to const HC Natural signed integer.
961 * @deprecated silly type. */
962typedef const RTHCINT *PCRTHCINT;
963
964/** HC Natural unsigned integer.
965 * @deprecated silly type. */
966typedef uint32_t RTHCUINT;
967/** Pointer to HC Natural unsigned integer.
968 * @deprecated silly type. */
969typedef RTHCUINT *PRTHCUINT;
970/** Pointer to const HC Natural unsigned integer.
971 * @deprecated silly type. */
972typedef const RTHCUINT *PCRTHCUINT;
973
974
975/** Signed integer which can contain a HC pointer. */
976#if HC_ARCH_BITS == 32
977typedef int32_t RTHCINTPTR;
978#elif HC_ARCH_BITS == 64
979typedef int64_t RTHCINTPTR;
980#else
981# error Unsupported HC_ARCH_BITS value.
982#endif
983/** Pointer to signed integer which can contain a HC pointer. */
984typedef RTHCINTPTR *PRTHCINTPTR;
985/** Pointer to const signed integer which can contain a HC pointer. */
986typedef const RTHCINTPTR *PCRTHCINTPTR;
987/** Max RTHCINTPTR value. */
988#if HC_ARCH_BITS == 32
989# define RTHCINTPTR_MAX INT32_MAX
990#else
991# define RTHCINTPTR_MAX INT64_MAX
992#endif
993/** Min RTHCINTPTR value. */
994#if HC_ARCH_BITS == 32
995# define RTHCINTPTR_MIN INT32_MIN
996#else
997# define RTHCINTPTR_MIN INT64_MIN
998#endif
999
1000/** Signed integer which can contain a HC ring-3 pointer. */
1001#if R3_ARCH_BITS == 32
1002typedef int32_t RTR3INTPTR;
1003#elif R3_ARCH_BITS == 64
1004typedef int64_t RTR3INTPTR;
1005#else
1006# error Unsupported R3_ARCH_BITS value.
1007#endif
1008/** Pointer to signed integer which can contain a HC ring-3 pointer. */
1009typedef RTR3INTPTR *PRTR3INTPTR;
1010/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
1011typedef const RTR3INTPTR *PCRTR3INTPTR;
1012/** Max RTR3INTPTR value. */
1013#if R3_ARCH_BITS == 32
1014# define RTR3INTPTR_MAX INT32_MAX
1015#else
1016# define RTR3INTPTR_MAX INT64_MAX
1017#endif
1018/** Min RTR3INTPTR value. */
1019#if R3_ARCH_BITS == 32
1020# define RTR3INTPTR_MIN INT32_MIN
1021#else
1022# define RTR3INTPTR_MIN INT64_MIN
1023#endif
1024
1025/** Signed integer which can contain a HC ring-0 pointer. */
1026#if R0_ARCH_BITS == 32
1027typedef int32_t RTR0INTPTR;
1028#elif R0_ARCH_BITS == 64
1029typedef int64_t RTR0INTPTR;
1030#else
1031# error Unsupported R0_ARCH_BITS value.
1032#endif
1033/** Pointer to signed integer which can contain a HC ring-0 pointer. */
1034typedef RTR0INTPTR *PRTR0INTPTR;
1035/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
1036typedef const RTR0INTPTR *PCRTR0INTPTR;
1037/** Max RTR0INTPTR value. */
1038#if R0_ARCH_BITS == 32
1039# define RTR0INTPTR_MAX INT32_MAX
1040#else
1041# define RTR0INTPTR_MAX INT64_MAX
1042#endif
1043/** Min RTHCINTPTR value. */
1044#if R0_ARCH_BITS == 32
1045# define RTR0INTPTR_MIN INT32_MIN
1046#else
1047# define RTR0INTPTR_MIN INT64_MIN
1048#endif
1049
1050
1051/** Unsigned integer which can contain a HC pointer. */
1052#if HC_ARCH_BITS == 32
1053typedef uint32_t RTHCUINTPTR;
1054#elif HC_ARCH_BITS == 64
1055typedef uint64_t RTHCUINTPTR;
1056#else
1057# error Unsupported HC_ARCH_BITS value.
1058#endif
1059/** Pointer to unsigned integer which can contain a HC pointer. */
1060typedef RTHCUINTPTR *PRTHCUINTPTR;
1061/** Pointer to unsigned integer which can contain a HC pointer. */
1062typedef const RTHCUINTPTR *PCRTHCUINTPTR;
1063/** Max RTHCUINTTPR value. */
1064#if HC_ARCH_BITS == 32
1065# define RTHCUINTPTR_MAX UINT32_MAX
1066#else
1067# define RTHCUINTPTR_MAX UINT64_MAX
1068#endif
1069
1070/** Unsigned integer which can contain a HC ring-3 pointer. */
1071#if R3_ARCH_BITS == 32
1072typedef uint32_t RTR3UINTPTR;
1073#elif R3_ARCH_BITS == 64
1074typedef uint64_t RTR3UINTPTR;
1075#else
1076# error Unsupported R3_ARCH_BITS value.
1077#endif
1078/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1079typedef RTR3UINTPTR *PRTR3UINTPTR;
1080/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1081typedef const RTR3UINTPTR *PCRTR3UINTPTR;
1082/** Max RTHCUINTTPR value. */
1083#if R3_ARCH_BITS == 32
1084# define RTR3UINTPTR_MAX UINT32_MAX
1085#else
1086# define RTR3UINTPTR_MAX UINT64_MAX
1087#endif
1088
1089/** Unsigned integer which can contain a HC ring-0 pointer. */
1090#if R0_ARCH_BITS == 32
1091typedef uint32_t RTR0UINTPTR;
1092#elif R0_ARCH_BITS == 64
1093typedef uint64_t RTR0UINTPTR;
1094#else
1095# error Unsupported R0_ARCH_BITS value.
1096#endif
1097/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
1098typedef RTR0UINTPTR *PRTR0UINTPTR;
1099/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
1100typedef const RTR0UINTPTR *PCRTR0UINTPTR;
1101/** Max RTR0UINTTPR value. */
1102#if HC_ARCH_BITS == 32
1103# define RTR0UINTPTR_MAX UINT32_MAX
1104#else
1105# define RTR0UINTPTR_MAX UINT64_MAX
1106#endif
1107
1108
1109/** Host Physical Memory Address. */
1110typedef uint64_t RTHCPHYS;
1111/** Pointer to Host Physical Memory Address. */
1112typedef RTHCPHYS *PRTHCPHYS;
1113/** Pointer to const Host Physical Memory Address. */
1114typedef const RTHCPHYS *PCRTHCPHYS;
1115/** @def NIL_RTHCPHYS
1116 * NIL HC Physical Address.
1117 * NIL_RTHCPHYS is used to signal an invalid physical address, similar
1118 * to the NULL pointer.
1119 */
1120#define NIL_RTHCPHYS (~(RTHCPHYS)0)
1121/** Max RTHCPHYS value. */
1122#define RTHCPHYS_MAX UINT64_MAX
1123
1124
1125/** HC pointer. */
1126#ifndef IN_RC
1127typedef void * RTHCPTR;
1128#else
1129typedef RTHCUINTPTR RTHCPTR;
1130#endif
1131/** Pointer to HC pointer. */
1132typedef RTHCPTR *PRTHCPTR;
1133/** Pointer to const HC pointer. */
1134typedef const RTHCPTR *PCRTHCPTR;
1135/** @def NIL_RTHCPTR
1136 * NIL HC pointer.
1137 */
1138#define NIL_RTHCPTR ((RTHCPTR)0)
1139/** Max RTHCPTR value. */
1140#define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
1141
1142
1143/** HC ring-3 pointer. */
1144#ifdef IN_RING3
1145typedef void * RTR3PTR;
1146#else
1147typedef RTR3UINTPTR RTR3PTR;
1148#endif
1149/** Pointer to HC ring-3 pointer. */
1150typedef RTR3PTR *PRTR3PTR;
1151/** Pointer to const HC ring-3 pointer. */
1152typedef const RTR3PTR *PCRTR3PTR;
1153/** @def NIL_RTR3PTR
1154 * NIL HC ring-3 pointer.
1155 */
1156#ifndef IN_RING3
1157# define NIL_RTR3PTR ((RTR3PTR)0)
1158#else
1159# define NIL_RTR3PTR (NULL)
1160#endif
1161/** Max RTR3PTR value. */
1162#define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
1163
1164/** HC ring-0 pointer. */
1165#ifdef IN_RING0
1166typedef void * RTR0PTR;
1167#else
1168typedef RTR0UINTPTR RTR0PTR;
1169#endif
1170/** Pointer to HC ring-0 pointer. */
1171typedef RTR0PTR *PRTR0PTR;
1172/** Pointer to const HC ring-0 pointer. */
1173typedef const RTR0PTR *PCRTR0PTR;
1174/** @def NIL_RTR0PTR
1175 * NIL HC ring-0 pointer.
1176 */
1177#ifndef IN_RING0
1178# define NIL_RTR0PTR ((RTR0PTR)0)
1179#else
1180# define NIL_RTR0PTR (NULL)
1181#endif
1182/** Max RTR3PTR value. */
1183#define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
1184
1185
1186/** Unsigned integer register in the host context. */
1187#if HC_ARCH_BITS == 32
1188typedef uint32_t RTHCUINTREG;
1189#elif HC_ARCH_BITS == 64
1190typedef uint64_t RTHCUINTREG;
1191#else
1192# error "Unsupported HC_ARCH_BITS!"
1193#endif
1194/** Pointer to an unsigned integer register in the host context. */
1195typedef RTHCUINTREG *PRTHCUINTREG;
1196/** Pointer to a const unsigned integer register in the host context. */
1197typedef const RTHCUINTREG *PCRTHCUINTREG;
1198
1199/** Unsigned integer register in the host ring-3 context. */
1200#if R3_ARCH_BITS == 32
1201typedef uint32_t RTR3UINTREG;
1202#elif R3_ARCH_BITS == 64
1203typedef uint64_t RTR3UINTREG;
1204#else
1205# error "Unsupported R3_ARCH_BITS!"
1206#endif
1207/** Pointer to an unsigned integer register in the host ring-3 context. */
1208typedef RTR3UINTREG *PRTR3UINTREG;
1209/** Pointer to a const unsigned integer register in the host ring-3 context. */
1210typedef const RTR3UINTREG *PCRTR3UINTREG;
1211
1212/** Unsigned integer register in the host ring-3 context. */
1213#if R0_ARCH_BITS == 32
1214typedef uint32_t RTR0UINTREG;
1215#elif R0_ARCH_BITS == 64
1216typedef uint64_t RTR0UINTREG;
1217#else
1218# error "Unsupported R3_ARCH_BITS!"
1219#endif
1220/** Pointer to an unsigned integer register in the host ring-3 context. */
1221typedef RTR0UINTREG *PRTR0UINTREG;
1222/** Pointer to a const unsigned integer register in the host ring-3 context. */
1223typedef const RTR0UINTREG *PCRTR0UINTREG;
1224
1225/** @} */
1226
1227
1228/** @defgroup grp_rt_types_gc Guest Context Basic Types
1229 * @{
1230 */
1231
1232/** Natural signed integer in the GC.
1233 * @deprecated silly type. */
1234#if GC_ARCH_BITS == 32
1235typedef int32_t RTGCINT;
1236#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
1237typedef int64_t RTGCINT;
1238#endif
1239/** Pointer to natural signed integer in GC.
1240 * @deprecated silly type. */
1241typedef RTGCINT *PRTGCINT;
1242/** Pointer to const natural signed integer in GC.
1243 * @deprecated silly type. */
1244typedef const RTGCINT *PCRTGCINT;
1245
1246/** Natural unsigned integer in the GC.
1247 * @deprecated silly type. */
1248#if GC_ARCH_BITS == 32
1249typedef uint32_t RTGCUINT;
1250#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
1251typedef uint64_t RTGCUINT;
1252#endif
1253/** Pointer to natural unsigned integer in GC.
1254 * @deprecated silly type. */
1255typedef RTGCUINT *PRTGCUINT;
1256/** Pointer to const natural unsigned integer in GC.
1257 * @deprecated silly type. */
1258typedef const RTGCUINT *PCRTGCUINT;
1259
1260/** Signed integer which can contain a GC pointer. */
1261#if GC_ARCH_BITS == 32
1262typedef int32_t RTGCINTPTR;
1263#elif GC_ARCH_BITS == 64
1264typedef int64_t RTGCINTPTR;
1265#endif
1266/** Pointer to signed integer which can contain a GC pointer. */
1267typedef RTGCINTPTR *PRTGCINTPTR;
1268/** Pointer to const signed integer which can contain a GC pointer. */
1269typedef const RTGCINTPTR *PCRTGCINTPTR;
1270
1271/** Unsigned integer which can contain a GC pointer. */
1272#if GC_ARCH_BITS == 32
1273typedef uint32_t RTGCUINTPTR;
1274#elif GC_ARCH_BITS == 64
1275typedef uint64_t RTGCUINTPTR;
1276#else
1277# error Unsupported GC_ARCH_BITS value.
1278#endif
1279/** Pointer to unsigned integer which can contain a GC pointer. */
1280typedef RTGCUINTPTR *PRTGCUINTPTR;
1281/** Pointer to unsigned integer which can contain a GC pointer. */
1282typedef const RTGCUINTPTR *PCRTGCUINTPTR;
1283
1284/** Unsigned integer which can contain a 32 bits GC pointer. */
1285typedef uint32_t RTGCUINTPTR32;
1286/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1287typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
1288/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1289typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;
1290
1291/** Unsigned integer which can contain a 64 bits GC pointer. */
1292typedef uint64_t RTGCUINTPTR64;
1293/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1294typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
1295/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1296typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
1297
1298/** Guest Physical Memory Address.*/
1299typedef uint64_t RTGCPHYS;
1300/** Pointer to Guest Physical Memory Address. */
1301typedef RTGCPHYS *PRTGCPHYS;
1302/** Pointer to const Guest Physical Memory Address. */
1303typedef const RTGCPHYS *PCRTGCPHYS;
1304/** @def NIL_RTGCPHYS
1305 * NIL GC Physical Address.
1306 * NIL_RTGCPHYS is used to signal an invalid physical address, similar
1307 * to the NULL pointer. Note that this value may actually be valid in
1308 * some contexts.
1309 */
1310#define NIL_RTGCPHYS (~(RTGCPHYS)0U)
1311/** Max guest physical memory address value. */
1312#define RTGCPHYS_MAX UINT64_MAX
1313
1314
1315/** Guest Physical Memory Address; limited to 32 bits.*/
1316typedef uint32_t RTGCPHYS32;
1317/** Pointer to Guest Physical Memory Address. */
1318typedef RTGCPHYS32 *PRTGCPHYS32;
1319/** Pointer to const Guest Physical Memory Address. */
1320typedef const RTGCPHYS32 *PCRTGCPHYS32;
1321/** @def NIL_RTGCPHYS32
1322 * NIL GC Physical Address.
1323 * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
1324 * to the NULL pointer. Note that this value may actually be valid in
1325 * some contexts.
1326 */
1327#define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
1328
1329
1330/** Guest Physical Memory Address; limited to 64 bits.*/
1331typedef uint64_t RTGCPHYS64;
1332/** Pointer to Guest Physical Memory Address. */
1333typedef RTGCPHYS64 *PRTGCPHYS64;
1334/** Pointer to const Guest Physical Memory Address. */
1335typedef const RTGCPHYS64 *PCRTGCPHYS64;
1336/** @def NIL_RTGCPHYS64
1337 * NIL GC Physical Address.
1338 * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
1339 * to the NULL pointer. Note that this value may actually be valid in
1340 * some contexts.
1341 */
1342#define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
1343
1344/** Guest context pointer, 32 bits.
1345 * Keep in mind that this type is an unsigned integer in
1346 * HC and void pointer in GC.
1347 */
1348typedef RTGCUINTPTR32 RTGCPTR32;
1349/** Pointer to a guest context pointer. */
1350typedef RTGCPTR32 *PRTGCPTR32;
1351/** Pointer to a const guest context pointer. */
1352typedef const RTGCPTR32 *PCRTGCPTR32;
1353/** @def NIL_RTGCPTR32
1354 * NIL GC pointer.
1355 */
1356#define NIL_RTGCPTR32 ((RTGCPTR32)0)
1357
1358/** Guest context pointer, 64 bits.
1359 */
1360typedef RTGCUINTPTR64 RTGCPTR64;
1361/** Pointer to a guest context pointer. */
1362typedef RTGCPTR64 *PRTGCPTR64;
1363/** Pointer to a const guest context pointer. */
1364typedef const RTGCPTR64 *PCRTGCPTR64;
1365/** @def NIL_RTGCPTR64
1366 * NIL GC pointer.
1367 */
1368#define NIL_RTGCPTR64 ((RTGCPTR64)0)
1369
1370/** Guest context pointer.
1371 * Keep in mind that this type is an unsigned integer in
1372 * HC and void pointer in GC.
1373 */
1374#if GC_ARCH_BITS == 64
1375typedef RTGCPTR64 RTGCPTR;
1376/** Pointer to a guest context pointer. */
1377typedef PRTGCPTR64 PRTGCPTR;
1378/** Pointer to a const guest context pointer. */
1379typedef PCRTGCPTR64 PCRTGCPTR;
1380/** @def NIL_RTGCPTR
1381 * NIL GC pointer.
1382 */
1383# define NIL_RTGCPTR NIL_RTGCPTR64
1384/** Max RTGCPTR value. */
1385# define RTGCPTR_MAX UINT64_MAX
1386#elif GC_ARCH_BITS == 32
1387typedef RTGCPTR32 RTGCPTR;
1388/** Pointer to a guest context pointer. */
1389typedef PRTGCPTR32 PRTGCPTR;
1390/** Pointer to a const guest context pointer. */
1391typedef PCRTGCPTR32 PCRTGCPTR;
1392/** @def NIL_RTGCPTR
1393 * NIL GC pointer.
1394 */
1395# define NIL_RTGCPTR NIL_RTGCPTR32
1396/** Max RTGCPTR value. */
1397# define RTGCPTR_MAX UINT32_MAX
1398#else
1399# error "Unsupported GC_ARCH_BITS!"
1400#endif
1401
1402/** Unsigned integer register in the guest context. */
1403typedef uint32_t RTGCUINTREG32;
1404/** Pointer to an unsigned integer register in the guest context. */
1405typedef RTGCUINTREG32 *PRTGCUINTREG32;
1406/** Pointer to a const unsigned integer register in the guest context. */
1407typedef const RTGCUINTREG32 *PCRTGCUINTREG32;
1408
1409typedef uint64_t RTGCUINTREG64;
1410/** Pointer to an unsigned integer register in the guest context. */
1411typedef RTGCUINTREG64 *PRTGCUINTREG64;
1412/** Pointer to a const unsigned integer register in the guest context. */
1413typedef const RTGCUINTREG64 *PCRTGCUINTREG64;
1414
1415#if GC_ARCH_BITS == 64
1416typedef RTGCUINTREG64 RTGCUINTREG;
1417#elif GC_ARCH_BITS == 32
1418typedef RTGCUINTREG32 RTGCUINTREG;
1419#else
1420# error "Unsupported GC_ARCH_BITS!"
1421#endif
1422/** Pointer to an unsigned integer register in the guest context. */
1423typedef RTGCUINTREG *PRTGCUINTREG;
1424/** Pointer to a const unsigned integer register in the guest context. */
1425typedef const RTGCUINTREG *PCRTGCUINTREG;
1426
1427/** @} */
1428
1429/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
1430 * @{
1431 */
1432
1433/** Raw mode context pointer; a 32 bits guest context pointer.
1434 * Keep in mind that this type is an unsigned integer in
1435 * HC and void pointer in RC.
1436 */
1437#ifdef IN_RC
1438typedef void * RTRCPTR;
1439#else
1440typedef uint32_t RTRCPTR;
1441#endif
1442/** Pointer to a raw mode context pointer. */
1443typedef RTRCPTR *PRTRCPTR;
1444/** Pointer to a const raw mode context pointer. */
1445typedef const RTRCPTR *PCRTRCPTR;
1446/** @def NIL_RTGCPTR
1447 * NIL RC pointer.
1448 */
1449#ifndef IN_RC
1450# define NIL_RTRCPTR ((RTRCPTR)0)
1451#else
1452# define NIL_RTRCPTR (NULL)
1453#endif
1454/** @def RTRCPTR_MAX
1455 * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
1456 */
1457#define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
1458
1459/** Raw mode context pointer, unsigned integer variant. */
1460typedef int32_t RTRCINTPTR;
1461/** @def RTRCUINTPTR_MAX
1462 * The maximum value a RTRCUINPTR can have.
1463 */
1464#define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
1465
1466/** Raw mode context pointer, signed integer variant. */
1467typedef uint32_t RTRCUINTPTR;
1468/** @def RTRCINTPTR_MIN
1469 * The minimum value a RTRCINPTR can have.
1470 */
1471#define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
1472/** @def RTRCINTPTR_MAX
1473 * The maximum value a RTRCINPTR can have.
1474 */
1475#define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
1476
1477/** @} */
1478
1479
1480/** @defgroup grp_rt_types_cc Current Context Basic Types
1481 * @{
1482 */
1483
1484/** Current Context Physical Memory Address.*/
1485#ifdef IN_RC
1486typedef RTGCPHYS RTCCPHYS;
1487#else
1488typedef RTHCPHYS RTCCPHYS;
1489#endif
1490/** Pointer to Current Context Physical Memory Address. */
1491typedef RTCCPHYS *PRTCCPHYS;
1492/** Pointer to const Current Context Physical Memory Address. */
1493typedef const RTCCPHYS *PCRTCCPHYS;
1494/** @def NIL_RTCCPHYS
1495 * NIL CC Physical Address.
1496 * NIL_RTCCPHYS is used to signal an invalid physical address, similar
1497 * to the NULL pointer.
1498 */
1499#ifdef IN_RC
1500# define NIL_RTCCPHYS NIL_RTGCPHYS
1501#else
1502# define NIL_RTCCPHYS NIL_RTHCPHYS
1503#endif
1504
1505/** Unsigned integer register in the current context. */
1506#if ARCH_BITS == 32
1507typedef uint32_t RTCCUINTREG;
1508#elif ARCH_BITS == 64
1509typedef uint64_t RTCCUINTREG;
1510#else
1511# error "Unsupported ARCH_BITS!"
1512#endif
1513/** Pointer to an unsigned integer register in the current context. */
1514typedef RTCCUINTREG *PRTCCUINTREG;
1515/** Pointer to a const unsigned integer register in the current context. */
1516typedef RTCCUINTREG const *PCRTCCUINTREG;
1517
1518/** Signed integer register in the current context. */
1519#if ARCH_BITS == 32
1520typedef int32_t RTCCINTREG;
1521#elif ARCH_BITS == 64
1522typedef int64_t RTCCINTREG;
1523#endif
1524/** Pointer to a signed integer register in the current context. */
1525typedef RTCCINTREG *PRTCCINTREG;
1526/** Pointer to a const signed integer register in the current context. */
1527typedef RTCCINTREG const *PCRTCCINTREG;
1528
1529/** @} */
1530
1531
1532
1533/** Pointer to a big integer number. */
1534typedef struct RTBIGNUM *PRTBIGNUM;
1535/** Pointer to a const big integer number. */
1536typedef struct RTBIGNUM const *PCRTBIGNUM;
1537
1538
1539/** Pointer to a critical section. */
1540typedef struct RTCRITSECT *PRTCRITSECT;
1541/** Pointer to a const critical section. */
1542typedef const struct RTCRITSECT *PCRTCRITSECT;
1543
1544/** Pointer to a read/write critical section. */
1545typedef struct RTCRITSECTRW *PRTCRITSECTRW;
1546/** Pointer to a const read/write critical section. */
1547typedef const struct RTCRITSECTRW *PCRTCRITSECTRW;
1548
1549
1550/** Condition variable handle. */
1551typedef R3PTRTYPE(struct RTCONDVARINTERNAL *) RTCONDVAR;
1552/** Pointer to a condition variable handle. */
1553typedef RTCONDVAR *PRTCONDVAR;
1554/** Nil condition variable handle. */
1555#define NIL_RTCONDVAR 0
1556
1557/** Cryptographic (certificate) store handle. */
1558typedef R3R0PTRTYPE(struct RTCRSTOREINT *) RTCRSTORE;
1559/** Pointer to a Cryptographic (certificate) store handle. */
1560typedef RTCRSTORE *PRTCRSTORE;
1561/** Nil Cryptographic (certificate) store handle. */
1562#define NIL_RTCRSTORE 0
1563
1564/** Pointer to a const (store) certificate context. */
1565typedef struct RTCRCERTCTX const *PCRTCRCERTCTX;
1566
1567/** Cryptographic message digest handle. */
1568typedef R3R0PTRTYPE(struct RTCRDIGESTINT *) RTCRDIGEST;
1569/** Pointer to a cryptographic message digest handle. */
1570typedef RTCRDIGEST *PRTCRDIGEST;
1571/** NIL cryptographic message digest handle. */
1572#define NIL_RTCRDIGEST (0)
1573
1574/** Public key encryption schema handle. */
1575typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT *) RTCRPKIXENCRYPTION;
1576/** Pointer to a public key encryption schema handle. */
1577typedef RTCRPKIXENCRYPTION *PRTCRPKIXENCRYPTION;
1578/** NIL public key encryption schema handle */
1579#define NIL_RTCRPKIXENCRYPTION (0)
1580
1581/** Public key signature schema handle. */
1582typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT *) RTCRPKIXSIGNATURE;
1583/** Pointer to a public key signature schema handle. */
1584typedef RTCRPKIXSIGNATURE *PRTCRPKIXSIGNATURE;
1585/** NIL public key signature schema handle */
1586#define NIL_RTCRPKIXSIGNATURE (0)
1587
1588/** X.509 certificate paths builder & validator handle. */
1589typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT *) RTCRX509CERTPATHS;
1590/** Pointer to a certificate paths builder & validator handle. */
1591typedef RTCRX509CERTPATHS *PRTCRX509CERTPATHS;
1592/** Nil certificate paths builder & validator handle. */
1593#define NIL_RTCRX509CERTPATHS 0
1594
1595/** File handle. */
1596typedef R3R0PTRTYPE(struct RTFILEINT *) RTFILE;
1597/** Pointer to file handle. */
1598typedef RTFILE *PRTFILE;
1599/** Nil file handle. */
1600#define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
1601
1602/** Async I/O request handle. */
1603typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL *) RTFILEAIOREQ;
1604/** Pointer to an async I/O request handle. */
1605typedef RTFILEAIOREQ *PRTFILEAIOREQ;
1606/** Nil request handle. */
1607#define NIL_RTFILEAIOREQ 0
1608
1609/** Async I/O completion context handle. */
1610typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL *) RTFILEAIOCTX;
1611/** Pointer to an async I/O completion context handle. */
1612typedef RTFILEAIOCTX *PRTFILEAIOCTX;
1613/** Nil context handle. */
1614#define NIL_RTFILEAIOCTX 0
1615
1616/** Loader module handle. */
1617typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
1618/** Pointer to a loader module handle. */
1619typedef RTLDRMOD *PRTLDRMOD;
1620/** Nil loader module handle. */
1621#define NIL_RTLDRMOD 0
1622
1623/** Lock validator class handle. */
1624typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT *) RTLOCKVALCLASS;
1625/** Pointer to a lock validator class handle. */
1626typedef RTLOCKVALCLASS *PRTLOCKVALCLASS;
1627/** Nil lock validator class handle. */
1628#define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
1629
1630/** Ring-0 memory object handle. */
1631typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *) RTR0MEMOBJ;
1632/** Pointer to a Ring-0 memory object handle. */
1633typedef RTR0MEMOBJ *PRTR0MEMOBJ;
1634/** Nil ring-0 memory object handle. */
1635#define NIL_RTR0MEMOBJ 0
1636
1637/** Native thread handle. */
1638typedef RTHCUINTPTR RTNATIVETHREAD;
1639/** Pointer to an native thread handle. */
1640typedef RTNATIVETHREAD *PRTNATIVETHREAD;
1641/** Nil native thread handle. */
1642#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
1643
1644/** Pipe handle. */
1645typedef R3R0PTRTYPE(struct RTPIPEINTERNAL *) RTPIPE;
1646/** Pointer to a pipe handle. */
1647typedef RTPIPE *PRTPIPE;
1648/** Nil pipe handle.
1649 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
1650#define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
1651
1652/** @typedef RTPOLLSET
1653 * Poll set handle. */
1654typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL *) RTPOLLSET;
1655/** Pointer to a poll set handle. */
1656typedef RTPOLLSET *PRTPOLLSET;
1657/** Nil poll set handle handle. */
1658#define NIL_RTPOLLSET ((RTPOLLSET)0)
1659
1660/** Process identifier. */
1661typedef uint32_t RTPROCESS;
1662/** Pointer to a process identifier. */
1663typedef RTPROCESS *PRTPROCESS;
1664/** Nil process identifier. */
1665#define NIL_RTPROCESS (~(RTPROCESS)0)
1666
1667/** Process ring-0 handle. */
1668typedef RTR0UINTPTR RTR0PROCESS;
1669/** Pointer to a ring-0 process handle. */
1670typedef RTR0PROCESS *PRTR0PROCESS;
1671/** Nil ring-0 process handle. */
1672#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
1673
1674/** @typedef RTSEMEVENT
1675 * Event Semaphore handle. */
1676typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *) RTSEMEVENT;
1677/** Pointer to an event semaphore handle. */
1678typedef RTSEMEVENT *PRTSEMEVENT;
1679/** Nil event semaphore handle. */
1680#define NIL_RTSEMEVENT 0
1681
1682/** @typedef RTSEMEVENTMULTI
1683 * Event Multiple Release Semaphore handle. */
1684typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
1685/** Pointer to an event multiple release semaphore handle. */
1686typedef RTSEMEVENTMULTI *PRTSEMEVENTMULTI;
1687/** Nil multiple release event semaphore handle. */
1688#define NIL_RTSEMEVENTMULTI 0
1689
1690/** @typedef RTSEMFASTMUTEX
1691 * Fast mutex Semaphore handle. */
1692typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
1693/** Pointer to a fast mutex semaphore handle. */
1694typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
1695/** Nil fast mutex semaphore handle. */
1696#define NIL_RTSEMFASTMUTEX 0
1697
1698/** @typedef RTSEMMUTEX
1699 * Mutex Semaphore handle. */
1700typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *) RTSEMMUTEX;
1701/** Pointer to a mutex semaphore handle. */
1702typedef RTSEMMUTEX *PRTSEMMUTEX;
1703/** Nil mutex semaphore handle. */
1704#define NIL_RTSEMMUTEX 0
1705
1706/** @typedef RTSEMSPINMUTEX
1707 * Spinning mutex Semaphore handle. */
1708typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL *) RTSEMSPINMUTEX;
1709/** Pointer to a spinning mutex semaphore handle. */
1710typedef RTSEMSPINMUTEX *PRTSEMSPINMUTEX;
1711/** Nil spinning mutex semaphore handle. */
1712#define NIL_RTSEMSPINMUTEX 0
1713
1714/** @typedef RTSEMRW
1715 * Read/Write Semaphore handle. */
1716typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *) RTSEMRW;
1717/** Pointer to a read/write semaphore handle. */
1718typedef RTSEMRW *PRTSEMRW;
1719/** Nil read/write semaphore handle. */
1720#define NIL_RTSEMRW 0
1721
1722/** @typedef RTSEMXROADS
1723 * Crossroads semaphore handle. */
1724typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL *) RTSEMXROADS;
1725/** Pointer to a crossroads semaphore handle. */
1726typedef RTSEMXROADS *PRTSEMXROADS;
1727/** Nil crossroads semaphore handle. */
1728#define NIL_RTSEMXROADS ((RTSEMXROADS)0)
1729
1730/** Spinlock handle. */
1731typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *) RTSPINLOCK;
1732/** Pointer to a spinlock handle. */
1733typedef RTSPINLOCK *PRTSPINLOCK;
1734/** Nil spinlock handle. */
1735#define NIL_RTSPINLOCK 0
1736
1737/** Socket handle. */
1738typedef R3R0PTRTYPE(struct RTSOCKETINT *) RTSOCKET;
1739/** Pointer to socket handle. */
1740typedef RTSOCKET *PRTSOCKET;
1741/** Nil socket handle. */
1742#define NIL_RTSOCKET ((RTSOCKET)0)
1743
1744/** Pointer to a RTTCPSERVER handle. */
1745typedef struct RTTCPSERVER *PRTTCPSERVER;
1746/** Pointer to a RTTCPSERVER handle. */
1747typedef PRTTCPSERVER *PPRTTCPSERVER;
1748/** Nil RTTCPSERVER handle. */
1749#define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
1750
1751/** Pointer to a RTUDPSERVER handle. */
1752typedef struct RTUDPSERVER *PRTUDPSERVER;
1753/** Pointer to a RTUDPSERVER handle. */
1754typedef PRTUDPSERVER *PPRTUDPSERVER;
1755/** Nil RTUDPSERVER handle. */
1756#define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
1757
1758/** Thread handle.*/
1759typedef R3R0PTRTYPE(struct RTTHREADINT *) RTTHREAD;
1760/** Pointer to thread handle. */
1761typedef RTTHREAD *PRTTHREAD;
1762/** Nil thread handle. */
1763#define NIL_RTTHREAD 0
1764
1765/** Thread context switching hook handle. */
1766typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT *) RTTHREADCTXHOOK;
1767/** Pointer to Thread context switching hook handle. */
1768typedef RTTHREADCTXHOOK *PRTTHREADCTXHOOK;
1769/** Nil Thread context switching hook handle. */
1770#define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
1771
1772/** A TLS index. */
1773typedef RTHCINTPTR RTTLS;
1774/** Pointer to a TLS index. */
1775typedef RTTLS *PRTTLS;
1776/** Pointer to a const TLS index. */
1777typedef RTTLS const *PCRTTLS;
1778/** NIL TLS index value. */
1779#define NIL_RTTLS ((RTTLS)-1)
1780
1781/** Trace buffer handle.
1782 * @remarks This is not a R3/R0 type like most other handles!
1783 */
1784typedef struct RTTRACEBUFINT *RTTRACEBUF;
1785/** Pointer to a trace buffer handle. */
1786typedef RTTRACEBUF *PRTTRACEBUF;
1787/** Nil trace buffer handle. */
1788#define NIL_RTTRACEBUF ((RTTRACEBUF)0)
1789/** The handle of the default trace buffer.
1790 * This can be used with any of the RTTraceBufAdd APIs. */
1791#define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
1792
1793/** Handle to a simple heap. */
1794typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *) RTHEAPSIMPLE;
1795/** Pointer to a handle to a simple heap. */
1796typedef RTHEAPSIMPLE *PRTHEAPSIMPLE;
1797/** NIL simple heap handle. */
1798#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
1799
1800/** Handle to an offset based heap. */
1801typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL *) RTHEAPOFFSET;
1802/** Pointer to a handle to an offset based heap. */
1803typedef RTHEAPOFFSET *PRTHEAPOFFSET;
1804/** NIL offset based heap handle. */
1805#define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
1806
1807/** Handle to an environment block. */
1808typedef R3PTRTYPE(struct RTENVINTERNAL *) RTENV;
1809/** Pointer to a handle to an environment block. */
1810typedef RTENV *PRTENV;
1811/** NIL simple heap handle. */
1812#define NIL_RTENV ((RTENV)0)
1813
1814/** A CPU identifier.
1815 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
1816 * does it have to correspond to the bits in the affinity mask, at
1817 * least not until we've sorted out Windows NT. */
1818typedef uint32_t RTCPUID;
1819/** Pointer to a CPU identifier. */
1820typedef RTCPUID *PRTCPUID;
1821/** Pointer to a const CPU identifier. */
1822typedef RTCPUID const *PCRTCPUID;
1823/** Nil CPU Id. */
1824#define NIL_RTCPUID ((RTCPUID)~0)
1825
1826/** The maximum number of CPUs a set can contain and IPRT is able
1827 * to reference. (Should be max of support arch/platforms.)
1828 * @remarks Must be a multiple of 64 (see RTCPUSET). */
1829#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
1830# define RTCPUSET_MAX_CPUS 256
1831#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
1832# define RTCPUSET_MAX_CPUS 1024
1833#else
1834# define RTCPUSET_MAX_CPUS 64
1835#endif
1836/** A CPU set.
1837 * @note Treat this as an opaque type and always use RTCpuSet* for
1838 * manipulating it. */
1839typedef struct RTCPUSET
1840{
1841 /** The bitmap. */
1842 uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
1843} RTCPUSET;
1844/** Pointer to a CPU set. */
1845typedef RTCPUSET *PRTCPUSET;
1846/** Pointer to a const CPU set. */
1847typedef RTCPUSET const *PCRTCPUSET;
1848
1849/** A handle table handle. */
1850typedef R3R0PTRTYPE(struct RTHANDLETABLEINT *) RTHANDLETABLE;
1851/** A pointer to a handle table handle. */
1852typedef RTHANDLETABLE *PRTHANDLETABLE;
1853/** @def NIL_RTHANDLETABLE
1854 * NIL handle table handle. */
1855#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
1856
1857/** A handle to a low resolution timer. */
1858typedef R3R0PTRTYPE(struct RTTIMERLRINT *) RTTIMERLR;
1859/** A pointer to a low resolution timer handle. */
1860typedef RTTIMERLR *PRTTIMERLR;
1861/** @def NIL_RTTIMERLR
1862 * NIL low resolution timer handle value. */
1863#define NIL_RTTIMERLR ((RTTIMERLR)0)
1864
1865/** Handle to a random number generator. */
1866typedef R3R0PTRTYPE(struct RTRANDINT *) RTRAND;
1867/** Pointer to a random number generator handle. */
1868typedef RTRAND *PRTRAND;
1869/** NIL random number generator handle value. */
1870#define NIL_RTRAND ((RTRAND)0)
1871
1872/** Debug address space handle. */
1873typedef R3R0PTRTYPE(struct RTDBGASINT *) RTDBGAS;
1874/** Pointer to a debug address space handle. */
1875typedef RTDBGAS *PRTDBGAS;
1876/** NIL debug address space handle. */
1877#define NIL_RTDBGAS ((RTDBGAS)0)
1878
1879/** Debug module handle. */
1880typedef R3R0PTRTYPE(struct RTDBGMODINT *) RTDBGMOD;
1881/** Pointer to a debug module handle. */
1882typedef RTDBGMOD *PRTDBGMOD;
1883/** NIL debug module handle. */
1884#define NIL_RTDBGMOD ((RTDBGMOD)0)
1885
1886/** Manifest handle. */
1887typedef struct RTMANIFESTINT *RTMANIFEST;
1888/** Pointer to a manifest handle. */
1889typedef RTMANIFEST *PRTMANIFEST;
1890/** NIL manifest handle. */
1891#define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
1892
1893/** Memory pool handle. */
1894typedef R3R0PTRTYPE(struct RTMEMPOOLINT *) RTMEMPOOL;
1895/** Pointer to a memory pool handle. */
1896typedef RTMEMPOOL *PRTMEMPOOL;
1897/** NIL memory pool handle. */
1898#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
1899/** The default memory pool handle. */
1900#define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
1901
1902/** String cache handle. */
1903typedef R3R0PTRTYPE(struct RTSTRCACHEINT *) RTSTRCACHE;
1904/** Pointer to a string cache handle. */
1905typedef RTSTRCACHE *PRTSTRCACHE;
1906/** NIL string cache handle. */
1907#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
1908/** The default string cache handle. */
1909#define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
1910
1911
1912/** Virtual Filesystem handle. */
1913typedef struct RTVFSINTERNAL *RTVFS;
1914/** Pointer to a VFS handle. */
1915typedef RTVFS *PRTVFS;
1916/** A NIL VFS handle. */
1917#define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
1918
1919/** Virtual Filesystem base object handle. */
1920typedef struct RTVFSOBJINTERNAL *RTVFSOBJ;
1921/** Pointer to a VFS base object handle. */
1922typedef RTVFSOBJ *PRTVFSOBJ;
1923/** A NIL VFS base object handle. */
1924#define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
1925
1926/** Virtual Filesystem directory handle. */
1927typedef struct RTVFSDIRINTERNAL *RTVFSDIR;
1928/** Pointer to a VFS directory handle. */
1929typedef RTVFSDIR *PRTVFSDIR;
1930/** A NIL VFS directory handle. */
1931#define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
1932
1933/** Virtual Filesystem filesystem stream handle. */
1934typedef struct RTVFSFSSTREAMINTERNAL *RTVFSFSSTREAM;
1935/** Pointer to a VFS filesystem stream handle. */
1936typedef RTVFSFSSTREAM *PRTVFSFSSTREAM;
1937/** A NIL VFS filesystem stream handle. */
1938#define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
1939
1940/** Virtual Filesystem I/O stream handle. */
1941typedef struct RTVFSIOSTREAMINTERNAL *RTVFSIOSTREAM;
1942/** Pointer to a VFS I/O stream handle. */
1943typedef RTVFSIOSTREAM *PRTVFSIOSTREAM;
1944/** A NIL VFS I/O stream handle. */
1945#define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
1946
1947/** Virtual Filesystem file handle. */
1948typedef struct RTVFSFILEINTERNAL *RTVFSFILE;
1949/** Pointer to a VFS file handle. */
1950typedef RTVFSFILE *PRTVFSFILE;
1951/** A NIL VFS file handle. */
1952#define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
1953
1954/** Virtual Filesystem symbolic link handle. */
1955typedef struct RTVFSSYMLINKINTERNAL *RTVFSSYMLINK;
1956/** Pointer to a VFS symbolic link handle. */
1957typedef RTVFSSYMLINK *PRTVFSSYMLINK;
1958/** A NIL VFS symbolic link handle. */
1959#define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
1960
1961/** Async I/O manager handle. */
1962typedef struct RTAIOMGRINT *RTAIOMGR;
1963/** Pointer to a async I/O manager handle. */
1964typedef RTAIOMGR *PRTAIOMGR;
1965/** A NIL async I/O manager handle. */
1966#define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
1967
1968/** Async I/O manager file handle. */
1969typedef struct RTAIOMGRFILEINT *RTAIOMGRFILE;
1970/** Pointer to a async I/O manager file handle. */
1971typedef RTAIOMGRFILE *PRTAIOMGRFILE;
1972/** A NIL async I/O manager file handle. */
1973#define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
1974
1975/**
1976 * Handle type.
1977 *
1978 * This is usually used together with RTHANDLEUNION.
1979 */
1980typedef enum RTHANDLETYPE
1981{
1982 /** The invalid zero value. */
1983 RTHANDLETYPE_INVALID = 0,
1984 /** File handle. */
1985 RTHANDLETYPE_FILE,
1986 /** Pipe handle */
1987 RTHANDLETYPE_PIPE,
1988 /** Socket handle. */
1989 RTHANDLETYPE_SOCKET,
1990 /** Thread handle. */
1991 RTHANDLETYPE_THREAD,
1992 /** The end of the valid values. */
1993 RTHANDLETYPE_END,
1994 /** The 32-bit type blow up. */
1995 RTHANDLETYPE_32BIT_HACK = 0x7fffffff
1996} RTHANDLETYPE;
1997/** Pointer to a handle type. */
1998typedef RTHANDLETYPE *PRTHANDLETYPE;
1999
2000/**
2001 * Handle union.
2002 *
2003 * This is usually used together with RTHANDLETYPE or as RTHANDLE.
2004 */
2005typedef union RTHANDLEUNION
2006{
2007 RTFILE hFile; /**< File handle. */
2008 RTPIPE hPipe; /**< Pipe handle. */
2009 RTSOCKET hSocket; /**< Socket handle. */
2010 RTTHREAD hThread; /**< Thread handle. */
2011 /** Generic integer handle value.
2012 * Note that RTFILE is not yet pointer sized, so accessing it via this member
2013 * isn't necessarily safe or fully portable. */
2014 RTHCUINTPTR uInt;
2015} RTHANDLEUNION;
2016/** Pointer to a handle union. */
2017typedef RTHANDLEUNION *PRTHANDLEUNION;
2018/** Pointer to a const handle union. */
2019typedef RTHANDLEUNION const *PCRTHANDLEUNION;
2020
2021/**
2022 * Generic handle.
2023 */
2024typedef struct RTHANDLE
2025{
2026 /** The handle type. */
2027 RTHANDLETYPE enmType;
2028 /** The handle value. */
2029 RTHANDLEUNION u;
2030} RTHANDLE;
2031/** Pointer to a generic handle. */
2032typedef RTHANDLE *PRTHANDLE;
2033/** Pointer to a const generic handle. */
2034typedef RTHANDLE const *PCRTHANDLE;
2035
2036
2037/**
2038 * Standard handles.
2039 *
2040 * @remarks These have the correct file descriptor values for unixy systems and
2041 * can be used directly in code specific to those platforms.
2042 */
2043typedef enum RTHANDLESTD
2044{
2045 /** Invalid standard handle. */
2046 RTHANDLESTD_INVALID = -1,
2047 /** The standard input handle. */
2048 RTHANDLESTD_INPUT = 0,
2049 /** The standard output handle. */
2050 RTHANDLESTD_OUTPUT,
2051 /** The standard error handle. */
2052 RTHANDLESTD_ERROR,
2053 /** The typical 32-bit type hack. */
2054 RTHANDLESTD_32BIT_HACK = 0x7fffffff
2055} RTHANDLESTD;
2056
2057
2058/**
2059 * Error info.
2060 *
2061 * See RTErrInfo*.
2062 */
2063typedef struct RTERRINFO
2064{
2065 /** Flags, see RTERRINFO_FLAGS_XXX. */
2066 uint32_t fFlags;
2067 /** The status code. */
2068 int32_t rc;
2069 /** The size of the message */
2070 size_t cbMsg;
2071 /** The error buffer. */
2072 char *pszMsg;
2073 /** Reserved for future use. */
2074 void *apvReserved[2];
2075} RTERRINFO;
2076/** Pointer to an error info structure. */
2077typedef RTERRINFO *PRTERRINFO;
2078/** Pointer to a const error info structure. */
2079typedef RTERRINFO const *PCRTERRINFO;
2080
2081/**
2082 * Static error info structure, see RTErrInfoInitStatic.
2083 */
2084typedef struct RTERRINFOSTATIC
2085{
2086 /** The core error info. */
2087 RTERRINFO Core;
2088 /** The static message buffer. */
2089 char szMsg[3072];
2090} RTERRINFOSTATIC;
2091/** Pointer to a error info buffer. */
2092typedef RTERRINFOSTATIC *PRTERRINFOSTATIC;
2093/** Pointer to a const static error info buffer. */
2094typedef RTERRINFOSTATIC const *PCRTERRINFOSTATIC;
2095
2096
2097/**
2098 * UUID data type.
2099 *
2100 * See RTUuid*.
2101 *
2102 * @remarks IPRT defines that the first three integers in the @c Gen struct
2103 * interpretation are in little endian representation. This is
2104 * different to many other UUID implementation, and requires
2105 * conversion if you need to achieve consistent results.
2106 */
2107typedef union RTUUID
2108{
2109 /** 8-bit view. */
2110 uint8_t au8[16];
2111 /** 16-bit view. */
2112 uint16_t au16[8];
2113 /** 32-bit view. */
2114 uint32_t au32[4];
2115 /** 64-bit view. */
2116 uint64_t au64[2];
2117 /** The way the UUID is declared by the DCE specification. */
2118 struct
2119 {
2120 uint32_t u32TimeLow;
2121 uint16_t u16TimeMid;
2122 uint16_t u16TimeHiAndVersion;
2123 uint8_t u8ClockSeqHiAndReserved;
2124 uint8_t u8ClockSeqLow;
2125 uint8_t au8Node[6];
2126 } Gen;
2127} RTUUID;
2128/** Pointer to UUID data. */
2129typedef RTUUID *PRTUUID;
2130/** Pointer to readonly UUID data. */
2131typedef const RTUUID *PCRTUUID;
2132
2133/** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
2134#define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
2135
2136/** UUID string maximum length. */
2137#define RTUUID_STR_LENGTH 37
2138
2139
2140/** Compression handle. */
2141typedef struct RTZIPCOMP *PRTZIPCOMP;
2142/** Decompressor handle. */
2143typedef struct RTZIPDECOMP *PRTZIPDECOMP;
2144
2145
2146/**
2147 * Unicode Code Point.
2148 */
2149typedef uint32_t RTUNICP;
2150/** Pointer to an Unicode Code Point. */
2151typedef RTUNICP *PRTUNICP;
2152/** Pointer to an Unicode Code Point. */
2153typedef const RTUNICP *PCRTUNICP;
2154/** Max value a RTUNICP type can hold. */
2155#define RTUNICP_MAX ( ~(RTUNICP)0 )
2156/** Invalid code point.
2157 * This is returned when encountered invalid encodings or invalid
2158 * unicode code points. */
2159#define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
2160
2161
2162/**
2163 * UTF-16 character.
2164 * @remark wchar_t is not usable since it's compiler defined.
2165 * @remark When we use the term character we're not talking about unicode code point, but
2166 * the basic unit of the string encoding. Thus cwc - count of wide chars - means
2167 * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
2168 * and cch means count of the typedef 'char', which is assumed to be an octet.
2169 */
2170typedef uint16_t RTUTF16;
2171/** Pointer to a UTF-16 character. */
2172typedef RTUTF16 *PRTUTF16;
2173/** Pointer to a const UTF-16 character. */
2174typedef const RTUTF16 *PCRTUTF16;
2175
2176
2177/**
2178 * Wait for ever if we have to.
2179 */
2180#define RT_INDEFINITE_WAIT (~0U)
2181
2182
2183/**
2184 * Generic process callback.
2185 *
2186 * @returns VBox status code. Failure will cancel the operation.
2187 * @param uPercentage The percentage of the operation which has been completed.
2188 * @param pvUser The user specified argument.
2189 */
2190typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
2191/** Pointer to a generic progress callback function, FNRTPROCESS(). */
2192typedef FNRTPROGRESS *PFNRTPROGRESS;
2193
2194/**
2195 * Generic vprintf-like callback function for dumpers.
2196 *
2197 * @param pvUser User argument.
2198 * @param pszFormat The format string.
2199 * @param va Arguments for the format string.
2200 */
2201typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va);
2202/** Pointer to a generic printf-like function for dumping. */
2203typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
2204
2205
2206/**
2207 * A point in a two dimentional coordinate system.
2208 */
2209typedef struct RTPOINT
2210{
2211 /** X coordinate. */
2212 int32_t x;
2213 /** Y coordinate. */
2214 int32_t y;
2215} RTPOINT;
2216/** Pointer to a point. */
2217typedef RTPOINT *PRTPOINT;
2218/** Pointer to a const point. */
2219typedef const RTPOINT *PCRTPOINT;
2220
2221
2222/**
2223 * Rectangle data type, double point.
2224 */
2225typedef struct RTRECT
2226{
2227 /** left X coordinate. */
2228 int32_t xLeft;
2229 /** top Y coordinate. */
2230 int32_t yTop;
2231 /** right X coordinate. (exclusive) */
2232 int32_t xRight;
2233 /** bottom Y coordinate. (exclusive) */
2234 int32_t yBottom;
2235} RTRECT;
2236/** Pointer to a double point rectangle. */
2237typedef RTRECT *PRTRECT;
2238/** Pointer to a const double point rectangle. */
2239typedef const RTRECT *PCRTRECT;
2240
2241
2242/**
2243 * Rectangle data type, point + size.
2244 */
2245typedef struct RTRECT2
2246{
2247 /** X coordinate.
2248 * Unless stated otherwise, this is the top left corner. */
2249 int32_t x;
2250 /** Y coordinate.
2251 * Unless stated otherwise, this is the top left corner. */
2252 int32_t y;
2253 /** The width.
2254 * Unless stated otherwise, this is to the right of (x,y) and will not
2255 * be a negative number. */
2256 int32_t cx;
2257 /** The height.
2258 * Unless stated otherwise, this is down from (x,y) and will not be a
2259 * negative number. */
2260 int32_t cy;
2261} RTRECT2;
2262/** Pointer to a point + size rectangle. */
2263typedef RTRECT2 *PRTRECT2;
2264/** Pointer to a const point + size rectangle. */
2265typedef const RTRECT2 *PCRTRECT2;
2266
2267
2268/**
2269 * The size of a rectangle.
2270 */
2271typedef struct RTRECTSIZE
2272{
2273 /** The width (along the x-axis). */
2274 uint32_t cx;
2275 /** The height (along the y-axis). */
2276 uint32_t cy;
2277} RTRECTSIZE;
2278/** Pointer to a rectangle size. */
2279typedef RTRECTSIZE *PRTRECTSIZE;
2280/** Pointer to a const rectangle size. */
2281typedef const RTRECTSIZE *PCRTRECTSIZE;
2282
2283
2284/**
2285 * Ethernet MAC address.
2286 *
2287 * The first 24 bits make up the Organisationally Unique Identifier (OUI),
2288 * where the first bit (little endian) indicates multicast (set) / unicast,
2289 * and the second bit indicates locally (set) / global administered. If all
2290 * bits are set, it's a broadcast.
2291 */
2292typedef union RTMAC
2293{
2294 /** @todo add a bitfield view of this stuff. */
2295 /** 8-bit view. */
2296 uint8_t au8[6];
2297 /** 16-bit view. */
2298 uint16_t au16[3];
2299} RTMAC;
2300/** Pointer to a MAC address. */
2301typedef RTMAC *PRTMAC;
2302/** Pointer to a readonly MAC address. */
2303typedef const RTMAC *PCRTMAC;
2304
2305
2306/** Pointer to a lock validator record.
2307 * The structure definition is found in iprt/lockvalidator.h. */
2308typedef struct RTLOCKVALRECEXCL *PRTLOCKVALRECEXCL;
2309/** Pointer to a record of one ownership share.
2310 * The structure definition is found in iprt/lockvalidator.h. */
2311typedef struct RTLOCKVALRECSHRD *PRTLOCKVALRECSHRD;
2312/** Pointer to a lock validator source position.
2313 * The structure definition is found in iprt/lockvalidator.h. */
2314typedef struct RTLOCKVALSRCPOS *PRTLOCKVALSRCPOS;
2315/** Pointer to a const lock validator source position.
2316 * The structure definition is found in iprt/lockvalidator.h. */
2317typedef struct RTLOCKVALSRCPOS const *PCRTLOCKVALSRCPOS;
2318
2319/** @name Special sub-class values.
2320 * The range 16..UINT32_MAX is available to the user, the range 0..15 is
2321 * reserved for the lock validator. In the user range the locks can only be
2322 * taking in ascending order.
2323 * @{ */
2324/** Invalid value. */
2325#define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
2326/** Not allowed to be taken with any other locks in the same class.
2327 * This is the recommended value. */
2328#define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
2329/** Any order is allowed within the class. */
2330#define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
2331/** The first user value. */
2332#define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
2333/** @} */
2334
2335
2336/**
2337 * Digest types.
2338 */
2339typedef enum RTDIGESTTYPE
2340{
2341 /** Invalid digest value. */
2342 RTDIGESTTYPE_INVALID = 0,
2343 /** Unknown digest type. */
2344 RTDIGESTTYPE_UNKNOWN,
2345 /** CRC32 checksum. */
2346 RTDIGESTTYPE_CRC32,
2347 /** CRC64 checksum. */
2348 RTDIGESTTYPE_CRC64,
2349 /** MD2 checksum (unsafe!). */
2350 RTDIGESTTYPE_MD2,
2351 /** MD4 checksum (unsafe!!). */
2352 RTDIGESTTYPE_MD4,
2353 /** MD5 checksum (unsafe!). */
2354 RTDIGESTTYPE_MD5,
2355 /** SHA-1 checksum (unsafe!). */
2356 RTDIGESTTYPE_SHA1,
2357 /** SHA-224 checksum. */
2358 RTDIGESTTYPE_SHA224,
2359 /** SHA-256 checksum. */
2360 RTDIGESTTYPE_SHA256,
2361 /** SHA-384 checksum. */
2362 RTDIGESTTYPE_SHA384,
2363 /** SHA-512 checksum. */
2364 RTDIGESTTYPE_SHA512,
2365 /** SHA-512/224 checksum. */
2366 RTDIGESTTYPE_SHA512T224,
2367 /** SHA-512/256 checksum. */
2368 RTDIGESTTYPE_SHA512T256,
2369 /** End of valid types. */
2370 RTDIGESTTYPE_END,
2371 /** Usual 32-bit type blowup. */
2372 RTDIGESTTYPE_32BIT_HACK = 0x7fffffff
2373} RTDIGESTTYPE;
2374
2375/**
2376 * Process exit codes.
2377 */
2378typedef enum RTEXITCODE
2379{
2380 /** Success. */
2381 RTEXITCODE_SUCCESS = 0,
2382 /** General failure. */
2383 RTEXITCODE_FAILURE = 1,
2384 /** Invalid arguments. */
2385 RTEXITCODE_SYNTAX = 2,
2386 /** Initialization failure (usually IPRT, but could be used for other
2387 * components as well). */
2388 RTEXITCODE_INIT = 3,
2389 /** Test skipped. */
2390 RTEXITCODE_SKIPPED = 4,
2391 /** The end of valid exit codes. */
2392 RTEXITCODE_END,
2393 /** The usual 32-bit type hack. */
2394 RTEXITCODE_32BIT_HACK = 0x7fffffff
2395} RTEXITCODE;
2396
2397/**
2398 * Range descriptor.
2399 */
2400typedef struct RTRANGE
2401{
2402 /** Start offset. */
2403 uint64_t offStart;
2404 /** Range size. */
2405 size_t cbRange;
2406} RTRANGE;
2407/** Pointer to a range descriptor. */
2408typedef RTRANGE *PRTRANGE;
2409/** Pointer to a readonly range descriptor. */
2410typedef const RTRANGE *PCRTRANGE;
2411
2412
2413/**
2414 * Generic pointer union.
2415 */
2416typedef union RTPTRUNION
2417{
2418 /** Pointer into the void... */
2419 void *pv;
2420 /** As a signed integer. */
2421 intptr_t i;
2422 /** As an unsigned integer. */
2423 intptr_t u;
2424 /** Pointer to char value. */
2425 char *pch;
2426 /** Pointer to char value. */
2427 unsigned char *puch;
2428 /** Pointer to a int value. */
2429 int *pi;
2430 /** Pointer to a unsigned int value. */
2431 unsigned int *pu;
2432 /** Pointer to a long value. */
2433 long *pl;
2434 /** Pointer to a long value. */
2435 unsigned long *pul;
2436 /** Pointer to a 8-bit unsigned value. */
2437 uint8_t *pu8;
2438 /** Pointer to a 16-bit unsigned value. */
2439 uint16_t *pu16;
2440 /** Pointer to a 32-bit unsigned value. */
2441 uint32_t *pu32;
2442 /** Pointer to a 64-bit unsigned value. */
2443 uint64_t *pu64;
2444 /** Pointer to a UTF-16 character. */
2445 PRTUTF16 pwc;
2446 /** Pointer to a UUID character. */
2447 PRTUUID pUuid;
2448} RTPTRUNION;
2449/** Pointer to a pointer union. */
2450typedef RTPTRUNION *PRTPTRUNION;
2451
2452/**
2453 * Generic const pointer union.
2454 */
2455typedef union RTCPTRUNION
2456{
2457 /** Pointer into the void... */
2458 void const *pv;
2459 /** As a signed integer. */
2460 intptr_t i;
2461 /** As an unsigned integer. */
2462 intptr_t u;
2463 /** Pointer to char value. */
2464 char const *pch;
2465 /** Pointer to char value. */
2466 unsigned char const *puch;
2467 /** Pointer to a int value. */
2468 int const *pi;
2469 /** Pointer to a unsigned int value. */
2470 unsigned int const *pu;
2471 /** Pointer to a long value. */
2472 long const *pl;
2473 /** Pointer to a long value. */
2474 unsigned long const *pul;
2475 /** Pointer to a 8-bit unsigned value. */
2476 uint8_t const *pu8;
2477 /** Pointer to a 16-bit unsigned value. */
2478 uint16_t const *pu16;
2479 /** Pointer to a 32-bit unsigned value. */
2480 uint32_t const *pu32;
2481 /** Pointer to a 64-bit unsigned value. */
2482 uint64_t const *pu64;
2483 /** Pointer to a UTF-16 character. */
2484 PCRTUTF16 pwc;
2485 /** Pointer to a UUID character. */
2486 PCRTUUID pUuid;
2487} RTCPTRUNION;
2488/** Pointer to a const pointer union. */
2489typedef RTCPTRUNION *PRTCPTRUNION;
2490
2491/**
2492 * Generic volatile pointer union.
2493 */
2494typedef union RTVPTRUNION
2495{
2496 /** Pointer into the void... */
2497 void volatile *pv;
2498 /** As a signed integer. */
2499 intptr_t i;
2500 /** As an unsigned integer. */
2501 intptr_t u;
2502 /** Pointer to char value. */
2503 char volatile *pch;
2504 /** Pointer to char value. */
2505 unsigned char volatile *puch;
2506 /** Pointer to a int value. */
2507 int volatile *pi;
2508 /** Pointer to a unsigned int value. */
2509 unsigned int volatile *pu;
2510 /** Pointer to a long value. */
2511 long volatile *pl;
2512 /** Pointer to a long value. */
2513 unsigned long volatile *pul;
2514 /** Pointer to a 8-bit unsigned value. */
2515 uint8_t volatile *pu8;
2516 /** Pointer to a 16-bit unsigned value. */
2517 uint16_t volatile *pu16;
2518 /** Pointer to a 32-bit unsigned value. */
2519 uint32_t volatile *pu32;
2520 /** Pointer to a 64-bit unsigned value. */
2521 uint64_t volatile *pu64;
2522 /** Pointer to a UTF-16 character. */
2523 RTUTF16 volatile *pwc;
2524 /** Pointer to a UUID character. */
2525 RTUUID volatile *pUuid;
2526} RTVPTRUNION;
2527/** Pointer to a const pointer union. */
2528typedef RTVPTRUNION *PRTVPTRUNION;
2529
2530/**
2531 * Generic const volatile pointer union.
2532 */
2533typedef union RTCVPTRUNION
2534{
2535 /** Pointer into the void... */
2536 void const volatile *pv;
2537 /** As a signed integer. */
2538 intptr_t i;
2539 /** As an unsigned integer. */
2540 intptr_t u;
2541 /** Pointer to char value. */
2542 char const volatile *pch;
2543 /** Pointer to char value. */
2544 unsigned char const volatile *puch;
2545 /** Pointer to a int value. */
2546 int const volatile *pi;
2547 /** Pointer to a unsigned int value. */
2548 unsigned int const volatile *pu;
2549 /** Pointer to a long value. */
2550 long const volatile *pl;
2551 /** Pointer to a long value. */
2552 unsigned long const volatile *pul;
2553 /** Pointer to a 8-bit unsigned value. */
2554 uint8_t const volatile *pu8;
2555 /** Pointer to a 16-bit unsigned value. */
2556 uint16_t const volatile *pu16;
2557 /** Pointer to a 32-bit unsigned value. */
2558 uint32_t const volatile *pu32;
2559 /** Pointer to a 64-bit unsigned value. */
2560 uint64_t const volatile *pu64;
2561 /** Pointer to a UTF-16 character. */
2562 RTUTF16 const volatile *pwc;
2563 /** Pointer to a UUID character. */
2564 RTUUID const volatile *pUuid;
2565} RTCVPTRUNION;
2566/** Pointer to a const pointer union. */
2567typedef RTCVPTRUNION *PRTCVPTRUNION;
2568
2569
2570
2571#ifdef __cplusplus
2572/**
2573 * Strict type validation helper class.
2574 *
2575 * See RTErrStrictType and RT_SUCCESS_NP.
2576 */
2577class RTErrStrictType2
2578{
2579protected:
2580 /** The status code. */
2581 int32_t m_rc;
2582
2583public:
2584 /**
2585 * Constructor.
2586 * @param rc IPRT style status code.
2587 */
2588 RTErrStrictType2(int32_t rc) : m_rc(rc)
2589 {
2590 }
2591
2592 /**
2593 * Get the status code.
2594 * @returns IPRT style status code.
2595 */
2596 int32_t getValue() const
2597 {
2598 return m_rc;
2599 }
2600};
2601#endif /* __cplusplus */
2602/** @} */
2603
2604#endif
2605
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette