VirtualBox

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

最後變更 在這個檔案從67116是 66882,由 vboxsync 提交於 8 年 前

iprt: Added RTUINT256U and RTUINT512U. Hacked up simple formatting methods for each.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 94.2 KB
 
1/** @file
2 * IPRT - Types.
3 */
4
5/*
6 * Copyright (C) 2006-2016 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.alldomusa.eu.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_NETBSD) && defined(_KERNEL)
92
93# include <sys/types.h>
94
95 /*
96 * Kludge for NetBSD-6.x where the definition of bool in
97 * <sys/types.h> does not check for C++.
98 */
99# if defined(__cplusplus) && defined(bool)
100# undef bool
101# undef true
102# undef false
103# endif
104
105 /*
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
109 * _KERNEL code.
110 */
111# ifdef _BSD_PTRDIFF_T_
112 typedef _BSD_PTRDIFF_T_ ptrdiff_t;
113# endif
114
115# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
116 /*
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.
123 */
124# include <stddef.h>
125# if defined(__cplusplus)
126 typedef bool _Bool;
127# endif
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>
135# else
136# ifndef AUTOCONF_INCLUDED
137# include <linux/autoconf.h>
138# endif
139# endif
140# include <linux/compiler.h>
141# if defined(__cplusplus)
142 /*
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.
146 */
147# undef inline
148# define inline inline
149# undef __inline__
150# define __inline__ __inline__
151# undef __inline
152# define __inline __inline
153# endif
154# include <linux/types.h>
155# include <linux/stddef.h>
156 /*
157 * Starting with 3.4, <linux/stddef.h> defines NULL as '((void*)0)' which
158 * does not work for C++ code.
159 */
160# undef NULL
161# undef uintptr_t
162# ifdef __GNUC__
163# if !RT_GNUC_PREREQ(4, 1)
164 /*
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.
169 */
170# undef __inline__
171# define __inline__ __inline__
172# endif
173# endif
174# undef false
175# undef true
176# undef bool
177# else
178# include <stddef.h>
179# include <sys/types.h>
180# endif
181
182
183/* Define any types missing from sys/types.h on windows. */
184# ifdef _MSC_VER
185# undef ssize_t
186 typedef intptr_t ssize_t;
187# endif
188
189#else /* no crt */
190# include <iprt/nocrt/compiler/compiler.h>
191#endif /* no crt */
192
193
194
195/** @def NULL
196 * NULL pointer.
197 */
198#ifndef NULL
199# ifdef __cplusplus
200# define NULL 0
201# else
202# define NULL ((void*)0)
203# endif
204#endif
205
206
207
208/** @defgroup grp_rt_types IPRT Base Types
209 * @{
210 */
211
212/* define wchar_t, we don't wanna include all the wcsstuff to get this. */
213#ifdef _MSC_VER
214# ifndef _WCHAR_T_DEFINED
215 typedef unsigned short wchar_t;
216# define _WCHAR_T_DEFINED
217# endif
218#endif
219#ifdef __GNUC__
220/** @todo wchar_t on GNUC */
221#endif
222
223/*
224 * C doesn't have bool, nor does VisualAge for C++ v3.08.
225 */
226#if !defined(__cplusplus) || (defined(__IBMCPP__) && defined(RT_OS_OS2))
227# if defined(__GNUC__)
228# if defined(RT_OS_LINUX) && __GNUC__ < 3
229typedef uint8_t bool;
230# elif defined(RT_OS_FREEBSD)
231# ifndef __bool_true_false_are_defined
232typedef _Bool bool;
233# endif
234# elif defined(RT_OS_NETBSD)
235# if !defined(_KERNEL)
236 /*
237 * For the kernel code <stdbool.h> is not available, but bool is
238 * provided by <sys/types.h> included above.
239 */
240# include <stdbool.h>
241
242 /*
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.
251 */
252# undef bool
253 typedef _Bool bool;
254# endif
255# else
256# if (defined(RT_OS_DARWIN) || defined(RT_OS_HAIKU)) && (defined(_STDBOOL_H) || defined(__STDBOOL_H))
257# undef bool
258# endif
259typedef _Bool bool;
260# endif
261# else
262# if RT_MSC_PREREQ(RT_MSC_VER_VC120)
263# include <stdbool.h>
264# else
265typedef unsigned char bool;
266# endif
267# endif
268# ifndef true
269# define true (1)
270# endif
271# ifndef false
272# define false (0)
273# endif
274#endif
275
276/**
277 * 128-bit unsigned integer.
278 */
279#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
280typedef __uint128_t uint128_t;
281#else
282typedef struct uint128_s
283{
284# ifdef RT_BIG_ENDIAN
285 uint64_t Hi;
286 uint64_t Lo;
287# else
288 uint64_t Lo;
289 uint64_t Hi;
290# endif
291} uint128_t;
292#endif
293
294
295/**
296 * 128-bit signed integer.
297 */
298#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
299typedef __int128_t int128_t;
300#else
301typedef struct int128_s
302{
303# ifdef RT_BIG_ENDIAN
304 int64_t Hi;
305 uint64_t Lo;
306# else
307 uint64_t Lo;
308 int64_t Hi;
309# endif
310} int128_t;
311#endif
312
313
314/**
315 * 16-bit unsigned integer union.
316 */
317typedef union RTUINT16U
318{
319 /** natural view. */
320 uint16_t u;
321
322 /** 16-bit view. */
323 uint16_t au16[1];
324 /** 8-bit view. */
325 uint8_t au8[2];
326 /** 16-bit hi/lo view. */
327 struct
328 {
329#ifdef RT_BIG_ENDIAN
330 uint8_t Hi;
331 uint8_t Lo;
332#else
333 uint8_t Lo;
334 uint8_t Hi;
335#endif
336 } s;
337} RTUINT16U;
338/** Pointer to a 16-bit unsigned integer union. */
339typedef RTUINT16U *PRTUINT16U;
340/** Pointer to a const 32-bit unsigned integer union. */
341typedef const RTUINT16U *PCRTUINT16U;
342
343
344/**
345 * 32-bit unsigned integer union.
346 */
347typedef union RTUINT32U
348{
349 /** natural view. */
350 uint32_t u;
351 /** Hi/Low view. */
352 struct
353 {
354#ifdef RT_BIG_ENDIAN
355 uint16_t Hi;
356 uint16_t Lo;
357#else
358 uint16_t Lo;
359 uint16_t Hi;
360#endif
361 } s;
362 /** Word view. */
363 struct
364 {
365#ifdef RT_BIG_ENDIAN
366 uint16_t w1;
367 uint16_t w0;
368#else
369 uint16_t w0;
370 uint16_t w1;
371#endif
372 } Words;
373
374 /** 32-bit view. */
375 uint32_t au32[1];
376 /** 16-bit view. */
377 uint16_t au16[2];
378 /** 8-bit view. */
379 uint8_t au8[4];
380} RTUINT32U;
381/** Pointer to a 32-bit unsigned integer union. */
382typedef RTUINT32U *PRTUINT32U;
383/** Pointer to a const 32-bit unsigned integer union. */
384typedef const RTUINT32U *PCRTUINT32U;
385
386
387/**
388 * 64-bit unsigned integer union.
389 */
390typedef union RTUINT64U
391{
392 /** Natural view. */
393 uint64_t u;
394 /** Hi/Low view. */
395 struct
396 {
397#ifdef RT_BIG_ENDIAN
398 uint32_t Hi;
399 uint32_t Lo;
400#else
401 uint32_t Lo;
402 uint32_t Hi;
403#endif
404 } s;
405 /** Double-Word view. */
406 struct
407 {
408#ifdef RT_BIG_ENDIAN
409 uint32_t dw1;
410 uint32_t dw0;
411#else
412 uint32_t dw0;
413 uint32_t dw1;
414#endif
415 } DWords;
416 /** Word view. */
417 struct
418 {
419#ifdef RT_BIG_ENDIAN
420 uint16_t w3;
421 uint16_t w2;
422 uint16_t w1;
423 uint16_t w0;
424#else
425 uint16_t w0;
426 uint16_t w1;
427 uint16_t w2;
428 uint16_t w3;
429#endif
430 } Words;
431
432 /** 64-bit view. */
433 uint64_t au64[1];
434 /** 32-bit view. */
435 uint32_t au32[2];
436 /** 16-bit view. */
437 uint16_t au16[4];
438 /** 8-bit view. */
439 uint8_t au8[8];
440} RTUINT64U;
441/** Pointer to a 64-bit unsigned integer union. */
442typedef RTUINT64U *PRTUINT64U;
443/** Pointer to a const 64-bit unsigned integer union. */
444typedef const RTUINT64U *PCRTUINT64U;
445
446
447/**
448 * 128-bit unsigned integer union.
449 */
450#pragma pack(1)
451typedef union RTUINT128U
452{
453 /** Hi/Low view.
454 * @remarks We put this first so we can have portable initializers
455 * (RTUINT128_INIT) */
456 struct
457 {
458#ifdef RT_BIG_ENDIAN
459 uint64_t Hi;
460 uint64_t Lo;
461#else
462 uint64_t Lo;
463 uint64_t Hi;
464#endif
465 } s;
466
467 /** Natural view.
468 * WARNING! This member depends on the compiler supporting 128-bit stuff. */
469 uint128_t u;
470
471 /** Quad-Word view. */
472 struct
473 {
474#ifdef RT_BIG_ENDIAN
475 uint64_t qw1;
476 uint64_t qw0;
477#else
478 uint64_t qw0;
479 uint64_t qw1;
480#endif
481 } QWords;
482 /** Double-Word view. */
483 struct
484 {
485#ifdef RT_BIG_ENDIAN
486 uint32_t dw3;
487 uint32_t dw2;
488 uint32_t dw1;
489 uint32_t dw0;
490#else
491 uint32_t dw0;
492 uint32_t dw1;
493 uint32_t dw2;
494 uint32_t dw3;
495#endif
496 } DWords;
497 /** Word view. */
498 struct
499 {
500#ifdef RT_BIG_ENDIAN
501 uint16_t w7;
502 uint16_t w6;
503 uint16_t w5;
504 uint16_t w4;
505 uint16_t w3;
506 uint16_t w2;
507 uint16_t w1;
508 uint16_t w0;
509#else
510 uint16_t w0;
511 uint16_t w1;
512 uint16_t w2;
513 uint16_t w3;
514 uint16_t w4;
515 uint16_t w5;
516 uint16_t w6;
517 uint16_t w7;
518#endif
519 } Words;
520
521 /** 64-bit view. */
522 uint64_t au64[2];
523 /** 32-bit view. */
524 uint32_t au32[4];
525 /** 16-bit view. */
526 uint16_t au16[8];
527 /** 8-bit view. */
528 uint8_t au8[16];
529} RTUINT128U;
530#pragma pack()
531/** Pointer to a 128-bit unsigned integer union. */
532typedef RTUINT128U *PRTUINT128U;
533/** Pointer to a const 128-bit unsigned integer union. */
534typedef const RTUINT128U *PCRTUINT128U;
535
536/** @def RTUINT128_INIT
537 * Portable RTUINT128U initializer. */
538#ifdef RT_BIG_ENDIAN
539# define RTUINT128_INIT(a_Hi, a_Lo) { { a_Hi, a_Lo } }
540#else
541# define RTUINT128_INIT(a_Hi, a_Lo) { { a_Lo, a_Hi } }
542#endif
543
544/** @def RTUINT128_INIT_C
545 * Portable RTUINT128U initializer for 64-bit constants. */
546#ifdef RT_BIG_ENDIAN
547# define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Hi), UINT64_C(a_Lo) } }
548#else
549# define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Lo), UINT64_C(a_Hi) } }
550#endif
551
552
553/**
554 * 256-bit unsigned integer union.
555 */
556#pragma pack(1)
557typedef union RTUINT256U
558{
559 /** Quad-Word view (first as it's used by RTUINT256_INIT). */
560 struct
561 {
562#ifdef RT_BIG_ENDIAN
563 uint64_t qw3;
564 uint64_t qw2;
565 uint64_t qw1;
566 uint64_t qw0;
567#else
568 uint64_t qw0;
569 uint64_t qw1;
570 uint64_t qw2;
571 uint64_t qw3;
572#endif
573 } QWords;
574 /** Double-Word view. */
575 struct
576 {
577#ifdef RT_BIG_ENDIAN
578 uint32_t dw7;
579 uint32_t dw6;
580 uint32_t dw5;
581 uint32_t dw4;
582 uint32_t dw3;
583 uint32_t dw2;
584 uint32_t dw1;
585 uint32_t dw0;
586#else
587 uint32_t dw0;
588 uint32_t dw1;
589 uint32_t dw2;
590 uint32_t dw3;
591 uint32_t dw4;
592 uint32_t dw5;
593 uint32_t dw6;
594 uint32_t dw7;
595#endif
596 } DWords;
597 /** Word view. */
598 struct
599 {
600#ifdef RT_BIG_ENDIAN
601 uint16_t w15;
602 uint16_t w14;
603 uint16_t w13;
604 uint16_t w12;
605 uint16_t w11;
606 uint16_t w10;
607 uint16_t w9;
608 uint16_t w8;
609 uint16_t w7;
610 uint16_t w6;
611 uint16_t w5;
612 uint16_t w4;
613 uint16_t w3;
614 uint16_t w2;
615 uint16_t w1;
616 uint16_t w0;
617#else
618 uint16_t w0;
619 uint16_t w1;
620 uint16_t w2;
621 uint16_t w3;
622 uint16_t w4;
623 uint16_t w5;
624 uint16_t w6;
625 uint16_t w7;
626 uint16_t w8;
627 uint16_t w9;
628 uint16_t w10;
629 uint16_t w11;
630 uint16_t w12;
631 uint16_t w13;
632 uint16_t w14;
633 uint16_t w15;
634#endif
635 } Words;
636
637 /** Double-Quad-Word view. */
638 struct
639 {
640#ifdef RT_BIG_ENDIAN
641 RTUINT128U dqw1;
642 RTUINT128U dqw0;
643#else
644 RTUINT128U dqw0;
645 RTUINT128U dqw1;
646#endif
647 } DQWords;
648
649 /** 128-bit view. */
650 RTUINT128U au128[2];
651 /** 64-bit view. */
652 uint64_t au64[4];
653 /** 32-bit view. */
654 uint32_t au32[8];
655 /** 16-bit view. */
656 uint16_t au16[16];
657 /** 8-bit view. */
658 uint8_t au8[32];
659} RTUINT256U;
660#pragma pack()
661/** Pointer to a 256-bit unsigned integer union. */
662typedef RTUINT256U *PRTUINT256U;
663/** Pointer to a const 256-bit unsigned integer union. */
664typedef const RTUINT256U *PCRTUINT256U;
665
666/** @def RTUINT256_INIT
667 * Portable RTUINT256U initializer. */
668#ifdef RT_BIG_ENDIAN
669# define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
670#else
671# define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw0, a_Qw1, a_Qw2, a_Qw3 } }
672#endif
673
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))
678
679
680/**
681 * 512-bit unsigned integer union.
682 */
683#pragma pack(1)
684typedef union RTUINT512U
685{
686 /** Quad-Word view (first as it's used by RTUINT512_INIT). */
687 struct
688 {
689#ifdef RT_BIG_ENDIAN
690 uint64_t qw7;
691 uint64_t qw6;
692 uint64_t qw5;
693 uint64_t qw4;
694 uint64_t qw3;
695 uint64_t qw2;
696 uint64_t qw1;
697 uint64_t qw0;
698#else
699 uint64_t qw0;
700 uint64_t qw1;
701 uint64_t qw2;
702 uint64_t qw3;
703 uint64_t qw4;
704 uint64_t qw5;
705 uint64_t qw6;
706 uint64_t qw7;
707#endif
708 } QWords;
709 /** Double-Word view. */
710 struct
711 {
712#ifdef RT_BIG_ENDIAN
713 uint32_t dw15;
714 uint32_t dw14;
715 uint32_t dw13;
716 uint32_t dw12;
717 uint32_t dw11;
718 uint32_t dw10;
719 uint32_t dw9;
720 uint32_t dw8;
721 uint32_t dw7;
722 uint32_t dw6;
723 uint32_t dw5;
724 uint32_t dw4;
725 uint32_t dw3;
726 uint32_t dw2;
727 uint32_t dw1;
728 uint32_t dw0;
729#else
730 uint32_t dw0;
731 uint32_t dw1;
732 uint32_t dw2;
733 uint32_t dw3;
734 uint32_t dw4;
735 uint32_t dw5;
736 uint32_t dw6;
737 uint32_t dw7;
738 uint32_t dw8;
739 uint32_t dw9;
740 uint32_t dw10;
741 uint32_t dw11;
742 uint32_t dw12;
743 uint32_t dw13;
744 uint32_t dw14;
745 uint32_t dw15;
746#endif
747 } DWords;
748 /** Word view. */
749 struct
750 {
751#ifdef RT_BIG_ENDIAN
752 uint16_t w31;
753 uint16_t w30;
754 uint16_t w29;
755 uint16_t w28;
756 uint16_t w27;
757 uint16_t w26;
758 uint16_t w25;
759 uint16_t w24;
760 uint16_t w23;
761 uint16_t w22;
762 uint16_t w21;
763 uint16_t w20;
764 uint16_t w19;
765 uint16_t w18;
766 uint16_t w17;
767 uint16_t w16;
768 uint16_t w15;
769 uint16_t w14;
770 uint16_t w13;
771 uint16_t w12;
772 uint16_t w11;
773 uint16_t w10;
774 uint16_t w9;
775 uint16_t w8;
776 uint16_t w7;
777 uint16_t w6;
778 uint16_t w5;
779 uint16_t w4;
780 uint16_t w3;
781 uint16_t w2;
782 uint16_t w1;
783 uint16_t w0;
784#else
785 uint16_t w0;
786 uint16_t w1;
787 uint16_t w2;
788 uint16_t w3;
789 uint16_t w4;
790 uint16_t w5;
791 uint16_t w6;
792 uint16_t w7;
793 uint16_t w8;
794 uint16_t w9;
795 uint16_t w10;
796 uint16_t w11;
797 uint16_t w12;
798 uint16_t w13;
799 uint16_t w14;
800 uint16_t w15;
801 uint16_t w16;
802 uint16_t w17;
803 uint16_t w18;
804 uint16_t w19;
805 uint16_t w20;
806 uint16_t w21;
807 uint16_t w22;
808 uint16_t w23;
809 uint16_t w24;
810 uint16_t w25;
811 uint16_t w26;
812 uint16_t w27;
813 uint16_t w28;
814 uint16_t w29;
815 uint16_t w30;
816 uint16_t w31;
817#endif
818 } Words;
819
820 /** Double-Quad-Word view. */
821 struct
822 {
823#ifdef RT_BIG_ENDIAN
824 RTUINT128U dqw3;
825 RTUINT128U dqw2;
826 RTUINT128U dqw1;
827 RTUINT128U dqw0;
828#else
829 RTUINT128U dqw0;
830 RTUINT128U dqw1;
831 RTUINT128U dqw2;
832 RTUINT128U dqw3;
833#endif
834 } DQWords;
835
836 /** Octo-Word view. */
837 struct
838 {
839#ifdef RT_BIG_ENDIAN
840 RTUINT256U ow3;
841 RTUINT256U ow2;
842 RTUINT256U ow1;
843 RTUINT256U ow0;
844#else
845 RTUINT256U ow0;
846 RTUINT256U ow1;
847 RTUINT256U ow2;
848 RTUINT256U ow3;
849#endif
850 } OWords;
851
852 /** 256-bit view. */
853 RTUINT256U au256[2];
854 /** 128-bit view. */
855 RTUINT128U au128[4];
856 /** 64-bit view. */
857 uint64_t au64[8];
858 /** 32-bit view. */
859 uint32_t au32[16];
860 /** 16-bit view. */
861 uint16_t au16[32];
862 /** 8-bit view. */
863 uint8_t au8[64];
864} RTUINT512U;
865#pragma pack()
866/** Pointer to a 512-bit unsigned integer union. */
867typedef RTUINT512U *PRTUINT512U;
868/** Pointer to a const 512-bit unsigned integer union. */
869typedef const RTUINT512U *PCRTUINT512U;
870
871/** @def RTUINT512_INIT
872 * Portable RTUINT512U initializer. */
873#ifdef RT_BIG_ENDIAN
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 } }
876#else
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 } }
879#endif
880
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))
886
887
888/**
889 * Double precision floating point format (64-bit).
890 */
891typedef union RTFLOAT64U
892{
893#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
894 /** Double view. */
895 double rd;
896#endif
897 /** Format using regular bitfields. */
898 struct
899 {
900# ifdef RT_BIG_ENDIAN
901 /** The sign indicator. */
902 uint32_t fSign : 1;
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;
909# else
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. */
917 uint32_t fSign : 1;
918# endif
919 } s;
920
921#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
922 /** Format using 64-bit bitfields. */
923 RT_GCC_EXTENSION struct
924 {
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;
930 /** The fraction. */
931 RT_GCC_EXTENSION uint64_t uFraction : 52;
932# else
933 /** The fraction. */
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;
939# endif
940 } s64;
941#endif
942
943 /** 64-bit view. */
944 uint64_t au64[1];
945 /** 32-bit view. */
946 uint32_t au32[2];
947 /** 16-bit view. */
948 uint16_t au16[4];
949 /** 8-bit view. */
950 uint8_t au8[8];
951} RTFLOAT64U;
952/** Pointer to a double precision floating point format union. */
953typedef RTFLOAT64U *PRTFLOAT64U;
954/** Pointer to a const double precision floating point format union. */
955typedef const RTFLOAT64U *PCRTFLOAT64U;
956
957
958#if !defined(__IBMCPP__) && !defined(__IBMC__)
959
960/**
961 * Extended Double precision floating point format (80-bit).
962 */
963#pragma pack(1)
964typedef union RTFLOAT80U
965{
966 /** Format using bitfields. */
967 RT_GCC_EXTENSION struct
968 {
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;
974 /** The mantissa. */
975 uint64_t u64Mantissa;
976# else
977 /** The mantissa. */
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;
983# endif
984 } s;
985
986 /** 64-bit view. */
987 uint64_t au64[1];
988 /** 32-bit view. */
989 uint32_t au32[2];
990 /** 16-bit view. */
991 uint16_t au16[5];
992 /** 8-bit view. */
993 uint8_t au8[10];
994} RTFLOAT80U;
995#pragma pack()
996/** Pointer to a extended precision floating point format union. */
997typedef RTFLOAT80U *PRTFLOAT80U;
998/** Pointer to a const extended precision floating point format union. */
999typedef const RTFLOAT80U *PCRTFLOAT80U;
1000
1001
1002/**
1003 * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
1004 * compiler implements long double.
1005 */
1006#pragma pack(1)
1007typedef union RTFLOAT80U2
1008{
1009#ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
1010 /** Long double view. */
1011 long double lrd;
1012#endif
1013 /** Format using bitfields. */
1014 RT_GCC_EXTENSION struct
1015 {
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;
1023#else
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;
1030#endif
1031 } s;
1032
1033 /** Bitfield exposing the J bit and the fraction. */
1034 RT_GCC_EXTENSION struct
1035 {
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. */
1042 uint32_t fInteger;
1043 /** The fraction, bits 32 thru 62. */
1044 uint32_t u31FractionHigh : 31;
1045 /** The fraction, bits 0 thru 31. */
1046 uint32_t u32FractionLow : 32;
1047#else
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. */
1053 uint32_t fInteger;
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;
1058#endif
1059 } sj;
1060
1061#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
1062 /** 64-bit bitfields exposing the J bit and the fraction. */
1063 RT_GCC_EXTENSION struct
1064 {
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;
1074# else
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;
1083# endif
1084 } sj64;
1085#endif
1086
1087 /** 64-bit view. */
1088 uint64_t au64[1];
1089 /** 32-bit view. */
1090 uint32_t au32[2];
1091 /** 16-bit view. */
1092 uint16_t au16[5];
1093 /** 8-bit view. */
1094 uint8_t au8[10];
1095} RTFLOAT80U2;
1096#pragma pack()
1097/** Pointer to a extended precision floating point format union, 2nd
1098 * variant. */
1099typedef RTFLOAT80U2 *PRTFLOAT80U2;
1100/** Pointer to a const extended precision floating point format union, 2nd
1101 * variant. */
1102typedef const RTFLOAT80U2 *PCRTFLOAT80U2;
1103
1104#endif /* uint16_t bitfields doesn't work */
1105
1106
1107/** Generic function type.
1108 * @see PFNRT
1109 */
1110typedef DECLCALLBACK(void) FNRT(void);
1111
1112/** Generic function pointer.
1113 * With -pedantic, gcc-4 complains when casting a function to a data object, for
1114 * example:
1115 *
1116 * @code
1117 * void foo(void)
1118 * {
1119 * }
1120 *
1121 * void *bar = (void *)foo;
1122 * @endcode
1123 *
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.
1128 */
1129typedef FNRT *PFNRT;
1130
1131/** Millisecond interval. */
1132typedef uint32_t RTMSINTERVAL;
1133/** Pointer to a millisecond interval. */
1134typedef RTMSINTERVAL *PRTMSINTERVAL;
1135/** Pointer to a const millisecond interval. */
1136typedef const RTMSINTERVAL *PCRTMSINTERVAL;
1137
1138/** Pointer to a time spec structure. */
1139typedef struct RTTIMESPEC *PRTTIMESPEC;
1140/** Pointer to a const time spec structure. */
1141typedef const struct RTTIMESPEC *PCRTTIMESPEC;
1142
1143
1144
1145/** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
1146 * @{
1147 */
1148
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)
1151typedef int32_t RTINTPTR;
1152#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1153typedef int64_t RTINTPTR;
1154#else
1155# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1156#endif
1157/** Pointer to signed integer which can contain both GC and HC pointers. */
1158typedef RTINTPTR *PRTINTPTR;
1159/** Pointer const to signed integer which can contain both GC and HC pointers. */
1160typedef const RTINTPTR *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
1166#else
1167# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1168#endif
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
1174#else
1175# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1176#endif
1177
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)
1180typedef uint32_t RTUINTPTR;
1181#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1182typedef uint64_t RTUINTPTR;
1183#else
1184# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1185#endif
1186/** Pointer to unsigned integer which can contain both GC and HC pointers. */
1187typedef RTUINTPTR *PRTUINTPTR;
1188/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
1189typedef const RTUINTPTR *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
1195#else
1196# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1197#endif
1198
1199/** Signed integer. */
1200typedef int32_t RTINT;
1201/** Pointer to signed integer. */
1202typedef RTINT *PRTINT;
1203/** Pointer to const signed integer. */
1204typedef const RTINT *PCRTINT;
1205
1206/** Unsigned integer. */
1207typedef uint32_t RTUINT;
1208/** Pointer to unsigned integer. */
1209typedef RTUINT *PRTUINT;
1210/** Pointer to const unsigned integer. */
1211typedef const RTUINT *PCRTUINT;
1212
1213/** A file offset / size (off_t). */
1214typedef int64_t RTFOFF;
1215/** Pointer to a file offset / size. */
1216typedef RTFOFF *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
1221
1222/** File mode (see iprt/fs.h). */
1223typedef uint32_t RTFMODE;
1224/** Pointer to file mode. */
1225typedef RTFMODE *PRTFMODE;
1226
1227/** Device unix number. */
1228typedef uint32_t RTDEV;
1229/** Pointer to a device unix number. */
1230typedef RTDEV *PRTDEV;
1231
1232/** @name RTDEV Macros
1233 * @{ */
1234/**
1235 * Our makedev macro.
1236 * @returns RTDEV
1237 * @param uMajor The major device number.
1238 * @param uMinor The minor device number.
1239 */
1240#define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
1241/**
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.
1245 */
1246#define RTDEV_MAJOR(uDev) ((uDev) >> 24)
1247/**
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.
1251 */
1252#define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
1253/** @} */
1254
1255/** i-node number. */
1256typedef uint64_t RTINODE;
1257/** Pointer to a i-node number. */
1258typedef RTINODE *PRTINODE;
1259
1260/** User id. */
1261typedef uint32_t RTUID;
1262/** Pointer to a user id. */
1263typedef RTUID *PRTUID;
1264/** NIL user id.
1265 * @todo check this for portability! */
1266#define NIL_RTUID (~(RTUID)0)
1267
1268/** Group id. */
1269typedef uint32_t RTGID;
1270/** Pointer to a group id. */
1271typedef RTGID *PRTGID;
1272/** NIL group id.
1273 * @todo check this for portability! */
1274#define NIL_RTGID (~(RTGID)0)
1275
1276/** I/O Port. */
1277typedef uint16_t RTIOPORT;
1278/** Pointer to I/O Port. */
1279typedef RTIOPORT *PRTIOPORT;
1280/** Pointer to const I/O Port. */
1281typedef const RTIOPORT *PCRTIOPORT;
1282
1283/** Selector. */
1284typedef uint16_t RTSEL;
1285/** Pointer to selector. */
1286typedef RTSEL *PRTSEL;
1287/** Pointer to const selector. */
1288typedef const RTSEL *PCRTSEL;
1289/** Max selector value. */
1290#define RTSEL_MAX UINT16_MAX
1291
1292/** Far 16-bit pointer. */
1293#pragma pack(1)
1294typedef struct RTFAR16
1295{
1296 uint16_t off;
1297 RTSEL sel;
1298} RTFAR16;
1299#pragma pack()
1300/** Pointer to Far 16-bit pointer. */
1301typedef RTFAR16 *PRTFAR16;
1302/** Pointer to const Far 16-bit pointer. */
1303typedef const RTFAR16 *PCRTFAR16;
1304
1305/** Far 32-bit pointer. */
1306#pragma pack(1)
1307typedef struct RTFAR32
1308{
1309 uint32_t off;
1310 RTSEL sel;
1311} RTFAR32;
1312#pragma pack()
1313/** Pointer to Far 32-bit pointer. */
1314typedef RTFAR32 *PRTFAR32;
1315/** Pointer to const Far 32-bit pointer. */
1316typedef const RTFAR32 *PCRTFAR32;
1317
1318/** Far 64-bit pointer. */
1319#pragma pack(1)
1320typedef struct RTFAR64
1321{
1322 uint64_t off;
1323 RTSEL sel;
1324} RTFAR64;
1325#pragma pack()
1326/** Pointer to Far 64-bit pointer. */
1327typedef RTFAR64 *PRTFAR64;
1328/** Pointer to const Far 64-bit pointer. */
1329typedef const RTFAR64 *PCRTFAR64;
1330
1331/** @} */
1332
1333
1334/** @defgroup grp_rt_types_hc Host Context Basic Types
1335 * @{
1336 */
1337
1338/** HC Natural signed integer.
1339 * @deprecated silly type. */
1340typedef int32_t RTHCINT;
1341/** Pointer to HC Natural signed integer.
1342 * @deprecated silly type. */
1343typedef RTHCINT *PRTHCINT;
1344/** Pointer to const HC Natural signed integer.
1345 * @deprecated silly type. */
1346typedef const RTHCINT *PCRTHCINT;
1347
1348/** HC Natural unsigned integer.
1349 * @deprecated silly type. */
1350typedef uint32_t RTHCUINT;
1351/** Pointer to HC Natural unsigned integer.
1352 * @deprecated silly type. */
1353typedef RTHCUINT *PRTHCUINT;
1354/** Pointer to const HC Natural unsigned integer.
1355 * @deprecated silly type. */
1356typedef const RTHCUINT *PCRTHCUINT;
1357
1358
1359/** Signed integer which can contain a HC pointer. */
1360#if HC_ARCH_BITS == 32
1361typedef int32_t RTHCINTPTR;
1362#elif HC_ARCH_BITS == 64
1363typedef int64_t RTHCINTPTR;
1364#elif HC_ARCH_BITS == 16
1365typedef int16_t RTHCINTPTR;
1366#else
1367# error Unsupported HC_ARCH_BITS value.
1368#endif
1369/** Pointer to signed integer which can contain a HC pointer. */
1370typedef RTHCINTPTR *PRTHCINTPTR;
1371/** Pointer to const signed integer which can contain a HC pointer. */
1372typedef const RTHCINTPTR *PCRTHCINTPTR;
1373/** Max RTHCINTPTR value. */
1374#if HC_ARCH_BITS == 32
1375# define RTHCINTPTR_MAX INT32_MAX
1376#elif HC_ARCH_BITS == 64
1377# define RTHCINTPTR_MAX INT64_MAX
1378#else
1379# define RTHCINTPTR_MAX INT16_MAX
1380#endif
1381/** Min RTHCINTPTR value. */
1382#if HC_ARCH_BITS == 32
1383# define RTHCINTPTR_MIN INT32_MIN
1384#elif HC_ARCH_BITS == 64
1385# define RTHCINTPTR_MIN INT64_MIN
1386#else
1387# define RTHCINTPTR_MIN INT16_MIN
1388#endif
1389
1390/** Signed integer which can contain a HC ring-3 pointer. */
1391#if R3_ARCH_BITS == 32
1392typedef int32_t RTR3INTPTR;
1393#elif R3_ARCH_BITS == 64
1394typedef int64_t RTR3INTPTR;
1395#elif R3_ARCH_BITS == 16
1396typedef int16_t RTR3INTPTR;
1397#else
1398# error Unsupported R3_ARCH_BITS value.
1399#endif
1400/** Pointer to signed integer which can contain a HC ring-3 pointer. */
1401typedef RTR3INTPTR *PRTR3INTPTR;
1402/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
1403typedef const RTR3INTPTR *PCRTR3INTPTR;
1404/** Max RTR3INTPTR value. */
1405#if R3_ARCH_BITS == 32
1406# define RTR3INTPTR_MAX INT32_MAX
1407#elif R3_ARCH_BITS == 64
1408# define RTR3INTPTR_MAX INT64_MAX
1409#else
1410# define RTR3INTPTR_MAX INT16_MAX
1411#endif
1412/** Min RTR3INTPTR value. */
1413#if R3_ARCH_BITS == 32
1414# define RTR3INTPTR_MIN INT32_MIN
1415#elif R3_ARCH_BITS == 64
1416# define RTR3INTPTR_MIN INT64_MIN
1417#else
1418# define RTR3INTPTR_MIN INT16_MIN
1419#endif
1420
1421/** Signed integer which can contain a HC ring-0 pointer. */
1422#if R0_ARCH_BITS == 32
1423typedef int32_t RTR0INTPTR;
1424#elif R0_ARCH_BITS == 64
1425typedef int64_t RTR0INTPTR;
1426#elif R0_ARCH_BITS == 16
1427typedef int16_t RTR0INTPTR;
1428#else
1429# error Unsupported R0_ARCH_BITS value.
1430#endif
1431/** Pointer to signed integer which can contain a HC ring-0 pointer. */
1432typedef RTR0INTPTR *PRTR0INTPTR;
1433/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
1434typedef const RTR0INTPTR *PCRTR0INTPTR;
1435/** Max RTR0INTPTR value. */
1436#if R0_ARCH_BITS == 32
1437# define RTR0INTPTR_MAX INT32_MAX
1438#elif R0_ARCH_BITS == 64
1439# define RTR0INTPTR_MAX INT64_MAX
1440#else
1441# define RTR0INTPTR_MAX INT16_MAX
1442#endif
1443/** Min RTHCINTPTR value. */
1444#if R0_ARCH_BITS == 32
1445# define RTR0INTPTR_MIN INT32_MIN
1446#elif R0_ARCH_BITS == 64
1447# define RTR0INTPTR_MIN INT64_MIN
1448#else
1449# define RTR0INTPTR_MIN INT16_MIN
1450#endif
1451
1452
1453/** Unsigned integer which can contain a HC pointer. */
1454#if HC_ARCH_BITS == 32
1455typedef uint32_t RTHCUINTPTR;
1456#elif HC_ARCH_BITS == 64
1457typedef uint64_t RTHCUINTPTR;
1458#elif HC_ARCH_BITS == 16
1459typedef uint16_t RTHCUINTPTR;
1460#else
1461# error Unsupported HC_ARCH_BITS value.
1462#endif
1463/** Pointer to unsigned integer which can contain a HC pointer. */
1464typedef RTHCUINTPTR *PRTHCUINTPTR;
1465/** Pointer to unsigned integer which can contain a HC pointer. */
1466typedef const RTHCUINTPTR *PCRTHCUINTPTR;
1467/** Max RTHCUINTTPR value. */
1468#if HC_ARCH_BITS == 32
1469# define RTHCUINTPTR_MAX UINT32_MAX
1470#elif HC_ARCH_BITS == 64
1471# define RTHCUINTPTR_MAX UINT64_MAX
1472#else
1473# define RTHCUINTPTR_MAX UINT16_MAX
1474#endif
1475
1476/** Unsigned integer which can contain a HC ring-3 pointer. */
1477#if R3_ARCH_BITS == 32
1478typedef uint32_t RTR3UINTPTR;
1479#elif R3_ARCH_BITS == 64
1480typedef uint64_t RTR3UINTPTR;
1481#elif R3_ARCH_BITS == 16
1482typedef uint16_t RTR3UINTPTR;
1483#else
1484# error Unsupported R3_ARCH_BITS value.
1485#endif
1486/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1487typedef RTR3UINTPTR *PRTR3UINTPTR;
1488/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1489typedef const RTR3UINTPTR *PCRTR3UINTPTR;
1490/** Max RTHCUINTTPR value. */
1491#if R3_ARCH_BITS == 32
1492# define RTR3UINTPTR_MAX UINT32_MAX
1493#elif R3_ARCH_BITS == 64
1494# define RTR3UINTPTR_MAX UINT64_MAX
1495#else
1496# define RTR3UINTPTR_MAX UINT16_MAX
1497#endif
1498
1499/** Unsigned integer which can contain a HC ring-0 pointer. */
1500#if R0_ARCH_BITS == 32
1501typedef uint32_t RTR0UINTPTR;
1502#elif R0_ARCH_BITS == 64
1503typedef uint64_t RTR0UINTPTR;
1504#elif R0_ARCH_BITS == 16
1505typedef uint16_t RTR0UINTPTR;
1506#else
1507# error Unsupported R0_ARCH_BITS value.
1508#endif
1509/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
1510typedef RTR0UINTPTR *PRTR0UINTPTR;
1511/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
1512typedef const RTR0UINTPTR *PCRTR0UINTPTR;
1513/** Max RTR0UINTTPR value. */
1514#if R0_ARCH_BITS == 32
1515# define RTR0UINTPTR_MAX UINT32_MAX
1516#elif R0_ARCH_BITS == 64
1517# define RTR0UINTPTR_MAX UINT64_MAX
1518#else
1519# define RTR0UINTPTR_MAX UINT16_MAX
1520#endif
1521
1522
1523/** Host Physical Memory Address. */
1524typedef uint64_t RTHCPHYS;
1525/** Pointer to Host Physical Memory Address. */
1526typedef RTHCPHYS *PRTHCPHYS;
1527/** Pointer to const Host Physical Memory Address. */
1528typedef const RTHCPHYS *PCRTHCPHYS;
1529/** @def NIL_RTHCPHYS
1530 * NIL HC Physical Address.
1531 * NIL_RTHCPHYS is used to signal an invalid physical address, similar
1532 * to the NULL pointer.
1533 */
1534#define NIL_RTHCPHYS (~(RTHCPHYS)0)
1535/** Max RTHCPHYS value. */
1536#define RTHCPHYS_MAX UINT64_MAX
1537
1538
1539/** HC pointer. */
1540#ifndef IN_RC
1541typedef void * RTHCPTR;
1542#else
1543typedef RTHCUINTPTR RTHCPTR;
1544#endif
1545/** Pointer to HC pointer. */
1546typedef RTHCPTR *PRTHCPTR;
1547/** Pointer to const HC pointer. */
1548typedef const RTHCPTR *PCRTHCPTR;
1549/** @def NIL_RTHCPTR
1550 * NIL HC pointer.
1551 */
1552#define NIL_RTHCPTR ((RTHCPTR)0)
1553/** Max RTHCPTR value. */
1554#define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
1555
1556
1557/** HC ring-3 pointer. */
1558#ifdef IN_RING3
1559typedef void * RTR3PTR;
1560#else
1561typedef RTR3UINTPTR RTR3PTR;
1562#endif
1563/** Pointer to HC ring-3 pointer. */
1564typedef RTR3PTR *PRTR3PTR;
1565/** Pointer to const HC ring-3 pointer. */
1566typedef const RTR3PTR *PCRTR3PTR;
1567/** @def NIL_RTR3PTR
1568 * NIL HC ring-3 pointer.
1569 */
1570#ifndef IN_RING3
1571# define NIL_RTR3PTR ((RTR3PTR)0)
1572#else
1573# define NIL_RTR3PTR (NULL)
1574#endif
1575/** Max RTR3PTR value. */
1576#define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
1577
1578/** HC ring-0 pointer. */
1579#ifdef IN_RING0
1580typedef void * RTR0PTR;
1581#else
1582typedef RTR0UINTPTR RTR0PTR;
1583#endif
1584/** Pointer to HC ring-0 pointer. */
1585typedef RTR0PTR *PRTR0PTR;
1586/** Pointer to const HC ring-0 pointer. */
1587typedef const RTR0PTR *PCRTR0PTR;
1588/** @def NIL_RTR0PTR
1589 * NIL HC ring-0 pointer.
1590 */
1591#ifndef IN_RING0
1592# define NIL_RTR0PTR ((RTR0PTR)0)
1593#else
1594# define NIL_RTR0PTR (NULL)
1595#endif
1596/** Max RTR3PTR value. */
1597#define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
1598
1599
1600/** Unsigned integer register in the host context. */
1601#if HC_ARCH_BITS == 32
1602typedef uint32_t RTHCUINTREG;
1603#elif HC_ARCH_BITS == 64
1604typedef uint64_t RTHCUINTREG;
1605#elif HC_ARCH_BITS == 16
1606typedef uint16_t RTHCUINTREG;
1607#else
1608# error "Unsupported HC_ARCH_BITS!"
1609#endif
1610/** Pointer to an unsigned integer register in the host context. */
1611typedef RTHCUINTREG *PRTHCUINTREG;
1612/** Pointer to a const unsigned integer register in the host context. */
1613typedef const RTHCUINTREG *PCRTHCUINTREG;
1614
1615/** Unsigned integer register in the host ring-3 context. */
1616#if R3_ARCH_BITS == 32
1617typedef uint32_t RTR3UINTREG;
1618#elif R3_ARCH_BITS == 64
1619typedef uint64_t RTR3UINTREG;
1620#elif R3_ARCH_BITS == 16
1621typedef uint16_t RTR3UINTREG;
1622#else
1623# error "Unsupported R3_ARCH_BITS!"
1624#endif
1625/** Pointer to an unsigned integer register in the host ring-3 context. */
1626typedef RTR3UINTREG *PRTR3UINTREG;
1627/** Pointer to a const unsigned integer register in the host ring-3 context. */
1628typedef const RTR3UINTREG *PCRTR3UINTREG;
1629
1630/** Unsigned integer register in the host ring-3 context. */
1631#if R0_ARCH_BITS == 32
1632typedef uint32_t RTR0UINTREG;
1633#elif R0_ARCH_BITS == 64
1634typedef uint64_t RTR0UINTREG;
1635#elif R0_ARCH_BITS == 16
1636typedef uint16_t RTR0UINTREG;
1637#else
1638# error "Unsupported R3_ARCH_BITS!"
1639#endif
1640/** Pointer to an unsigned integer register in the host ring-3 context. */
1641typedef RTR0UINTREG *PRTR0UINTREG;
1642/** Pointer to a const unsigned integer register in the host ring-3 context. */
1643typedef const RTR0UINTREG *PCRTR0UINTREG;
1644
1645/** @} */
1646
1647
1648/** @defgroup grp_rt_types_gc Guest Context Basic Types
1649 * @{
1650 */
1651
1652/** Natural signed integer in the GC.
1653 * @deprecated silly type. */
1654#if GC_ARCH_BITS == 32
1655typedef int32_t RTGCINT;
1656#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
1657typedef int64_t RTGCINT;
1658#endif
1659/** Pointer to natural signed integer in GC.
1660 * @deprecated silly type. */
1661typedef RTGCINT *PRTGCINT;
1662/** Pointer to const natural signed integer in GC.
1663 * @deprecated silly type. */
1664typedef const RTGCINT *PCRTGCINT;
1665
1666/** Natural unsigned integer in the GC.
1667 * @deprecated silly type. */
1668#if GC_ARCH_BITS == 32
1669typedef uint32_t RTGCUINT;
1670#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
1671typedef uint64_t RTGCUINT;
1672#endif
1673/** Pointer to natural unsigned integer in GC.
1674 * @deprecated silly type. */
1675typedef RTGCUINT *PRTGCUINT;
1676/** Pointer to const natural unsigned integer in GC.
1677 * @deprecated silly type. */
1678typedef const RTGCUINT *PCRTGCUINT;
1679
1680/** Signed integer which can contain a GC pointer. */
1681#if GC_ARCH_BITS == 32
1682typedef int32_t RTGCINTPTR;
1683#elif GC_ARCH_BITS == 64
1684typedef int64_t RTGCINTPTR;
1685#endif
1686/** Pointer to signed integer which can contain a GC pointer. */
1687typedef RTGCINTPTR *PRTGCINTPTR;
1688/** Pointer to const signed integer which can contain a GC pointer. */
1689typedef const RTGCINTPTR *PCRTGCINTPTR;
1690
1691/** Unsigned integer which can contain a GC pointer. */
1692#if GC_ARCH_BITS == 32
1693typedef uint32_t RTGCUINTPTR;
1694#elif GC_ARCH_BITS == 64
1695typedef uint64_t RTGCUINTPTR;
1696#else
1697# error Unsupported GC_ARCH_BITS value.
1698#endif
1699/** Pointer to unsigned integer which can contain a GC pointer. */
1700typedef RTGCUINTPTR *PRTGCUINTPTR;
1701/** Pointer to unsigned integer which can contain a GC pointer. */
1702typedef const RTGCUINTPTR *PCRTGCUINTPTR;
1703
1704/** Unsigned integer which can contain a 32 bits GC pointer. */
1705typedef uint32_t RTGCUINTPTR32;
1706/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1707typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
1708/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1709typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;
1710
1711/** Unsigned integer which can contain a 64 bits GC pointer. */
1712typedef uint64_t RTGCUINTPTR64;
1713/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1714typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
1715/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
1716typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
1717
1718/** Guest Physical Memory Address.*/
1719typedef uint64_t RTGCPHYS;
1720/** Pointer to Guest Physical Memory Address. */
1721typedef RTGCPHYS *PRTGCPHYS;
1722/** Pointer to const Guest Physical Memory Address. */
1723typedef const RTGCPHYS *PCRTGCPHYS;
1724/** @def NIL_RTGCPHYS
1725 * NIL GC Physical Address.
1726 * NIL_RTGCPHYS is used to signal an invalid physical address, similar
1727 * to the NULL pointer. Note that this value may actually be valid in
1728 * some contexts.
1729 */
1730#define NIL_RTGCPHYS (~(RTGCPHYS)0U)
1731/** Max guest physical memory address value. */
1732#define RTGCPHYS_MAX UINT64_MAX
1733
1734
1735/** Guest Physical Memory Address; limited to 32 bits.*/
1736typedef uint32_t RTGCPHYS32;
1737/** Pointer to Guest Physical Memory Address. */
1738typedef RTGCPHYS32 *PRTGCPHYS32;
1739/** Pointer to const Guest Physical Memory Address. */
1740typedef const RTGCPHYS32 *PCRTGCPHYS32;
1741/** @def NIL_RTGCPHYS32
1742 * NIL GC Physical Address.
1743 * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
1744 * to the NULL pointer. Note that this value may actually be valid in
1745 * some contexts.
1746 */
1747#define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
1748
1749
1750/** Guest Physical Memory Address; limited to 64 bits.*/
1751typedef uint64_t RTGCPHYS64;
1752/** Pointer to Guest Physical Memory Address. */
1753typedef RTGCPHYS64 *PRTGCPHYS64;
1754/** Pointer to const Guest Physical Memory Address. */
1755typedef const RTGCPHYS64 *PCRTGCPHYS64;
1756/** @def NIL_RTGCPHYS64
1757 * NIL GC Physical Address.
1758 * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
1759 * to the NULL pointer. Note that this value may actually be valid in
1760 * some contexts.
1761 */
1762#define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
1763
1764/** Guest context pointer, 32 bits.
1765 * Keep in mind that this type is an unsigned integer in
1766 * HC and void pointer in GC.
1767 */
1768typedef RTGCUINTPTR32 RTGCPTR32;
1769/** Pointer to a guest context pointer. */
1770typedef RTGCPTR32 *PRTGCPTR32;
1771/** Pointer to a const guest context pointer. */
1772typedef const RTGCPTR32 *PCRTGCPTR32;
1773/** @def NIL_RTGCPTR32
1774 * NIL GC pointer.
1775 */
1776#define NIL_RTGCPTR32 ((RTGCPTR32)0)
1777
1778/** Guest context pointer, 64 bits.
1779 */
1780typedef RTGCUINTPTR64 RTGCPTR64;
1781/** Pointer to a guest context pointer. */
1782typedef RTGCPTR64 *PRTGCPTR64;
1783/** Pointer to a const guest context pointer. */
1784typedef const RTGCPTR64 *PCRTGCPTR64;
1785/** @def NIL_RTGCPTR64
1786 * NIL GC pointer.
1787 */
1788#define NIL_RTGCPTR64 ((RTGCPTR64)0)
1789
1790/** Guest context pointer.
1791 * Keep in mind that this type is an unsigned integer in
1792 * HC and void pointer in GC.
1793 */
1794#if GC_ARCH_BITS == 64
1795typedef RTGCPTR64 RTGCPTR;
1796/** Pointer to a guest context pointer. */
1797typedef PRTGCPTR64 PRTGCPTR;
1798/** Pointer to a const guest context pointer. */
1799typedef PCRTGCPTR64 PCRTGCPTR;
1800/** @def NIL_RTGCPTR
1801 * NIL GC pointer.
1802 */
1803# define NIL_RTGCPTR NIL_RTGCPTR64
1804/** Max RTGCPTR value. */
1805# define RTGCPTR_MAX UINT64_MAX
1806#elif GC_ARCH_BITS == 32
1807typedef RTGCPTR32 RTGCPTR;
1808/** Pointer to a guest context pointer. */
1809typedef PRTGCPTR32 PRTGCPTR;
1810/** Pointer to a const guest context pointer. */
1811typedef PCRTGCPTR32 PCRTGCPTR;
1812/** @def NIL_RTGCPTR
1813 * NIL GC pointer.
1814 */
1815# define NIL_RTGCPTR NIL_RTGCPTR32
1816/** Max RTGCPTR value. */
1817# define RTGCPTR_MAX UINT32_MAX
1818#else
1819# error "Unsupported GC_ARCH_BITS!"
1820#endif
1821
1822/** Unsigned integer register in the guest context. */
1823typedef uint32_t RTGCUINTREG32;
1824/** Pointer to an unsigned integer register in the guest context. */
1825typedef RTGCUINTREG32 *PRTGCUINTREG32;
1826/** Pointer to a const unsigned integer register in the guest context. */
1827typedef const RTGCUINTREG32 *PCRTGCUINTREG32;
1828
1829typedef uint64_t RTGCUINTREG64;
1830/** Pointer to an unsigned integer register in the guest context. */
1831typedef RTGCUINTREG64 *PRTGCUINTREG64;
1832/** Pointer to a const unsigned integer register in the guest context. */
1833typedef const RTGCUINTREG64 *PCRTGCUINTREG64;
1834
1835#if GC_ARCH_BITS == 64
1836typedef RTGCUINTREG64 RTGCUINTREG;
1837#elif GC_ARCH_BITS == 32
1838typedef RTGCUINTREG32 RTGCUINTREG;
1839#else
1840# error "Unsupported GC_ARCH_BITS!"
1841#endif
1842/** Pointer to an unsigned integer register in the guest context. */
1843typedef RTGCUINTREG *PRTGCUINTREG;
1844/** Pointer to a const unsigned integer register in the guest context. */
1845typedef const RTGCUINTREG *PCRTGCUINTREG;
1846
1847/** @} */
1848
1849/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
1850 * @{
1851 */
1852
1853/** Raw mode context pointer; a 32 bits guest context pointer.
1854 * Keep in mind that this type is an unsigned integer in
1855 * HC and void pointer in RC.
1856 */
1857#ifdef IN_RC
1858typedef void * RTRCPTR;
1859#else
1860typedef uint32_t RTRCPTR;
1861#endif
1862/** Pointer to a raw mode context pointer. */
1863typedef RTRCPTR *PRTRCPTR;
1864/** Pointer to a const raw mode context pointer. */
1865typedef const RTRCPTR *PCRTRCPTR;
1866/** @def NIL_RTGCPTR
1867 * NIL RC pointer.
1868 */
1869#ifndef IN_RC
1870# define NIL_RTRCPTR ((RTRCPTR)0)
1871#else
1872# define NIL_RTRCPTR (NULL)
1873#endif
1874/** @def RTRCPTR_MAX
1875 * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
1876 */
1877#define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
1878
1879/** Raw mode context pointer, unsigned integer variant. */
1880typedef int32_t RTRCINTPTR;
1881/** @def RTRCUINTPTR_MAX
1882 * The maximum value a RTRCUINPTR can have.
1883 */
1884#define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
1885
1886/** Raw mode context pointer, signed integer variant. */
1887typedef uint32_t RTRCUINTPTR;
1888/** @def RTRCINTPTR_MIN
1889 * The minimum value a RTRCINPTR can have.
1890 */
1891#define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
1892/** @def RTRCINTPTR_MAX
1893 * The maximum value a RTRCINPTR can have.
1894 */
1895#define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
1896
1897/** @} */
1898
1899
1900/** @defgroup grp_rt_types_cc Current Context Basic Types
1901 * @{
1902 */
1903
1904/** Current Context Physical Memory Address.*/
1905#ifdef IN_RC
1906typedef RTGCPHYS RTCCPHYS;
1907#else
1908typedef RTHCPHYS RTCCPHYS;
1909#endif
1910/** Pointer to Current Context Physical Memory Address. */
1911typedef RTCCPHYS *PRTCCPHYS;
1912/** Pointer to const Current Context Physical Memory Address. */
1913typedef const RTCCPHYS *PCRTCCPHYS;
1914/** @def NIL_RTCCPHYS
1915 * NIL CC Physical Address.
1916 * NIL_RTCCPHYS is used to signal an invalid physical address, similar
1917 * to the NULL pointer.
1918 */
1919#ifdef IN_RC
1920# define NIL_RTCCPHYS NIL_RTGCPHYS
1921#else
1922# define NIL_RTCCPHYS NIL_RTHCPHYS
1923#endif
1924
1925/** Unsigned integer register in the current context. */
1926#if ARCH_BITS == 32
1927typedef uint32_t RTCCUINTREG;
1928#elif ARCH_BITS == 64
1929typedef uint64_t RTCCUINTREG;
1930#elif ARCH_BITS == 16
1931typedef uint16_t RTCCUINTREG;
1932#else
1933# error "Unsupported ARCH_BITS!"
1934#endif
1935/** Pointer to an unsigned integer register in the current context. */
1936typedef RTCCUINTREG *PRTCCUINTREG;
1937/** Pointer to a const unsigned integer register in the current context. */
1938typedef RTCCUINTREG const *PCRTCCUINTREG;
1939
1940/** Signed integer register in the current context. */
1941#if ARCH_BITS == 32
1942typedef int32_t RTCCINTREG;
1943#elif ARCH_BITS == 64
1944typedef int64_t RTCCINTREG;
1945#elif ARCH_BITS == 16
1946typedef int16_t RTCCINTREG;
1947#endif
1948/** Pointer to a signed integer register in the current context. */
1949typedef RTCCINTREG *PRTCCINTREG;
1950/** Pointer to a const signed integer register in the current context. */
1951typedef RTCCINTREG const *PCRTCCINTREG;
1952
1953/** Unsigned integer register in the current context.
1954 * @remarks This is for dealing with EAX in 16-bit mode. */
1955#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
1956typedef uint32_t RTCCUINTXREG;
1957#else
1958typedef RTCCUINTREG RTCCUINTXREG;
1959#endif
1960/** Pointer to an unsigned integer register in the current context. */
1961typedef RTCCUINTREG *PRTCCUINTXREG;
1962/** Pointer to a const unsigned integer register in the current context. */
1963typedef RTCCUINTREG const *PCRTCCUINTXREG;
1964
1965/** Signed integer extended register in the current context.
1966 * @remarks This is for dealing with EAX in 16-bit mode. */
1967#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
1968typedef int32_t RTCCINTXREG;
1969#else
1970typedef RTCCINTREG RTCCINTXREG;
1971#endif
1972/** Pointer to a signed integer extended register in the current context. */
1973typedef RTCCINTXREG *PRTCCINTXREG;
1974/** Pointer to a const signed integer extended register in the current
1975 * context. */
1976typedef RTCCINTXREG const *PCRTCCINTXREG;
1977
1978/** @def RTCCUINTREG_C
1979 * Defines a constant of RTCCUINTREG type.
1980 * @param a_Value Constant value */
1981/** @def RTCCUINTREG_MAX
1982 * Max value that RTCCUINTREG can hold. */
1983/** @def RTCCUINTREG_FMT
1984 * Generic IPRT format specifier for RTCCUINTREG. */
1985/** @def RTCCUINTREG_XFMT
1986 * Generic IPRT format specifier for RTCCUINTREG, hexadecimal. */
1987/** @def RTCCINTREG_C
1988 * Defines a constant of RTCCINTREG type.
1989 * @param a_Value Constant value */
1990/** @def RTCCINTREG_MAX
1991 * Max value that RTCCINTREG can hold. */
1992/** @def RTCCINTREG_MIN
1993 * Min value that RTCCINTREG can hold. */
1994/** @def RTCCINTREG_XFMT
1995 * Generic IPRT format specifier for RTCCINTREG, hexadecimal. */
1996#if ARCH_BITS == 32
1997# define RTCCUINTREG_C(a_Value) UINT32_C(a_Value)
1998# define RTCCUINTREG_MAX UINT32_MAX
1999# define RTCCUINTREG_FMT "RU32"
2000# define RTCCUINTREG_XFMT "RX32"
2001# define RTCCINTREG_C(a_Value) INT32_C(a_Value)
2002# define RTCCINTREG_MAX INT32_MAX
2003# define RTCCINTREG_MIN INT32_MIN
2004# define RTCCINTREG_FMT "RI32"
2005# define RTCCINTREG_XFMT "RX32"
2006#elif ARCH_BITS == 64
2007# define RTCCUINTREG_C(a_Value) UINT64_C(a_Value)
2008# define RTCCUINTREG_MAX UINT64_MAX
2009# define RTCCUINTREG_FMT "RU64"
2010# define RTCCUINTREG_XFMT "RX64"
2011# define RTCCINTREG_C(a_Value) INT64_C(a_Value)
2012# define RTCCINTREG_MAX INT64_MAX
2013# define RTCCINTREG_MIN INT64_MIN
2014# define RTCCINTREG_FMT "RI64"
2015# define RTCCINTREG_XFMT "RX64"
2016#elif ARCH_BITS == 16
2017# define RTCCUINTREG_C(a_Value) UINT16_C(a_Value)
2018# define RTCCUINTREG_MAX UINT16_MAX
2019# define RTCCUINTREG_FMT "RU16"
2020# define RTCCUINTREG_XFMT "RX16"
2021# define RTCCINTREG_C(a_Value) INT16_C(a_Value)
2022# define RTCCINTREG_MAX INT16_MAX
2023# define RTCCINTREG_MIN INT16_MIN
2024# define RTCCINTREG_FMT "RI16"
2025# define RTCCINTREG_XFMT "RX16"
2026#else
2027# error "Unsupported ARCH_BITS!"
2028#endif
2029/** @def RTCCUINTXREG_C
2030 * Defines a constant of RTCCUINTXREG type.
2031 * @param a_Value Constant value */
2032/** @def RTCCUINTXREG_MAX
2033 * Max value that RTCCUINTXREG can hold. */
2034/** @def RTCCUINTXREG_FMT
2035 * Generic IPRT format specifier for RTCCUINTXREG. */
2036/** @def RTCCUINTXREG_XFMT
2037 * Generic IPRT format specifier for RTCCUINTXREG, hexadecimal. */
2038/** @def RTCCINTXREG_C
2039 * Defines a constant of RTCCINTXREG type.
2040 * @param a_Value Constant value */
2041/** @def RTCCINTXREG_MAX
2042 * Max value that RTCCINTXREG can hold. */
2043/** @def RTCCINTXREG_MIN
2044 * Min value that RTCCINTXREG can hold. */
2045/** @def RTCCINTXREG_FMT
2046 * Generic IPRT format specifier for RTCCINTXREG. */
2047/** @def RTCCINTXREG_XFMT
2048 * Generic IPRT format specifier for RTCCINTXREG, hexadecimal. */
2049#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
2050# define RTCCUINTXREG_C(a_Value) UINT32_C(a_Value)
2051# define RTCCUINTXREG_MAX UINT32_MAX
2052# define RTCCUINTXREG_FMT "RU32"
2053# define RTCCUINTXREG_XFMT "RX32"
2054# define RTCCINTXREG_C(a_Value) INT32_C(a_Value)
2055# define RTCCINTXREG_MAX INT32_MAX
2056# define RTCCINTXREG_MIN INT32_MIN
2057# define RTCCINTXREG_FMT "RI32"
2058# define RTCCINTXREG_XFMT "RX32"
2059#else
2060# define RTCCUINTXREG_C(a_Value) RTCCUINTREG_C(a_Value)
2061# define RTCCUINTXREG_MAX RTCCUINTREG_MAX
2062# define RTCCUINTXREG_FMT RTCCUINTREG_FMT
2063# define RTCCUINTXREG_XFMT RTCCUINTREG_XFMT
2064# define RTCCINTXREG_C(a_Value) RTCCINTREG_C(a_Value)
2065# define RTCCINTXREG_MAX RTCCINTREG_MAX
2066# define RTCCINTXREG_MIN RTCCINTREG_MIN
2067# define RTCCINTXREG_FMT RTCCINTREG_FMT
2068# define RTCCINTXREG_XFMT RTCCINTREG_XFMT
2069#endif
2070/** @} */
2071
2072
2073
2074/** Pointer to a big integer number. */
2075typedef struct RTBIGNUM *PRTBIGNUM;
2076/** Pointer to a const big integer number. */
2077typedef struct RTBIGNUM const *PCRTBIGNUM;
2078
2079
2080/** Pointer to a critical section. */
2081typedef struct RTCRITSECT *PRTCRITSECT;
2082/** Pointer to a const critical section. */
2083typedef const struct RTCRITSECT *PCRTCRITSECT;
2084
2085/** Pointer to a read/write critical section. */
2086typedef struct RTCRITSECTRW *PRTCRITSECTRW;
2087/** Pointer to a const read/write critical section. */
2088typedef const struct RTCRITSECTRW *PCRTCRITSECTRW;
2089
2090
2091/** Condition variable handle. */
2092typedef R3PTRTYPE(struct RTCONDVARINTERNAL *) RTCONDVAR;
2093/** Pointer to a condition variable handle. */
2094typedef RTCONDVAR *PRTCONDVAR;
2095/** Nil condition variable handle. */
2096#define NIL_RTCONDVAR 0
2097
2098/** Cryptographic (certificate) store handle. */
2099typedef R3R0PTRTYPE(struct RTCRSTOREINT *) RTCRSTORE;
2100/** Pointer to a Cryptographic (certificate) store handle. */
2101typedef RTCRSTORE *PRTCRSTORE;
2102/** Nil Cryptographic (certificate) store handle. */
2103#define NIL_RTCRSTORE 0
2104
2105/** Pointer to a const (store) certificate context. */
2106typedef struct RTCRCERTCTX const *PCRTCRCERTCTX;
2107
2108/** Cryptographic message digest handle. */
2109typedef R3R0PTRTYPE(struct RTCRDIGESTINT *) RTCRDIGEST;
2110/** Pointer to a cryptographic message digest handle. */
2111typedef RTCRDIGEST *PRTCRDIGEST;
2112/** NIL cryptographic message digest handle. */
2113#define NIL_RTCRDIGEST (0)
2114
2115/** Public key encryption schema handle. */
2116typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT *) RTCRPKIXENCRYPTION;
2117/** Pointer to a public key encryption schema handle. */
2118typedef RTCRPKIXENCRYPTION *PRTCRPKIXENCRYPTION;
2119/** NIL public key encryption schema handle */
2120#define NIL_RTCRPKIXENCRYPTION (0)
2121
2122/** Public key signature schema handle. */
2123typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT *) RTCRPKIXSIGNATURE;
2124/** Pointer to a public key signature schema handle. */
2125typedef RTCRPKIXSIGNATURE *PRTCRPKIXSIGNATURE;
2126/** NIL public key signature schema handle */
2127#define NIL_RTCRPKIXSIGNATURE (0)
2128
2129/** X.509 certificate paths builder & validator handle. */
2130typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT *) RTCRX509CERTPATHS;
2131/** Pointer to a certificate paths builder & validator handle. */
2132typedef RTCRX509CERTPATHS *PRTCRX509CERTPATHS;
2133/** Nil certificate paths builder & validator handle. */
2134#define NIL_RTCRX509CERTPATHS 0
2135
2136/** File handle. */
2137typedef R3R0PTRTYPE(struct RTFILEINT *) RTFILE;
2138/** Pointer to file handle. */
2139typedef RTFILE *PRTFILE;
2140/** Nil file handle. */
2141#define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
2142
2143/** Async I/O request handle. */
2144typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL *) RTFILEAIOREQ;
2145/** Pointer to an async I/O request handle. */
2146typedef RTFILEAIOREQ *PRTFILEAIOREQ;
2147/** Nil request handle. */
2148#define NIL_RTFILEAIOREQ 0
2149
2150/** Async I/O completion context handle. */
2151typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL *) RTFILEAIOCTX;
2152/** Pointer to an async I/O completion context handle. */
2153typedef RTFILEAIOCTX *PRTFILEAIOCTX;
2154/** Nil context handle. */
2155#define NIL_RTFILEAIOCTX 0
2156
2157/** Loader module handle. */
2158typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
2159/** Pointer to a loader module handle. */
2160typedef RTLDRMOD *PRTLDRMOD;
2161/** Nil loader module handle. */
2162#define NIL_RTLDRMOD 0
2163
2164/** Lock validator class handle. */
2165typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT *) RTLOCKVALCLASS;
2166/** Pointer to a lock validator class handle. */
2167typedef RTLOCKVALCLASS *PRTLOCKVALCLASS;
2168/** Nil lock validator class handle. */
2169#define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
2170
2171/** Ring-0 memory object handle. */
2172typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *) RTR0MEMOBJ;
2173/** Pointer to a Ring-0 memory object handle. */
2174typedef RTR0MEMOBJ *PRTR0MEMOBJ;
2175/** Nil ring-0 memory object handle. */
2176#define NIL_RTR0MEMOBJ 0
2177
2178/** Native thread handle. */
2179typedef RTHCUINTPTR RTNATIVETHREAD;
2180/** Pointer to an native thread handle. */
2181typedef RTNATIVETHREAD *PRTNATIVETHREAD;
2182/** Nil native thread handle. */
2183#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
2184
2185/** Pipe handle. */
2186typedef R3R0PTRTYPE(struct RTPIPEINTERNAL *) RTPIPE;
2187/** Pointer to a pipe handle. */
2188typedef RTPIPE *PRTPIPE;
2189/** Nil pipe handle.
2190 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
2191#define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
2192
2193/** @typedef RTPOLLSET
2194 * Poll set handle. */
2195typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL *) RTPOLLSET;
2196/** Pointer to a poll set handle. */
2197typedef RTPOLLSET *PRTPOLLSET;
2198/** Nil poll set handle handle. */
2199#define NIL_RTPOLLSET ((RTPOLLSET)0)
2200
2201/** Process identifier. */
2202typedef uint32_t RTPROCESS;
2203/** Pointer to a process identifier. */
2204typedef RTPROCESS *PRTPROCESS;
2205/** Nil process identifier. */
2206#define NIL_RTPROCESS (~(RTPROCESS)0)
2207
2208/** Process ring-0 handle. */
2209typedef RTR0UINTPTR RTR0PROCESS;
2210/** Pointer to a ring-0 process handle. */
2211typedef RTR0PROCESS *PRTR0PROCESS;
2212/** Nil ring-0 process handle. */
2213#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
2214
2215/** @typedef RTSEMEVENT
2216 * Event Semaphore handle. */
2217typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *) RTSEMEVENT;
2218/** Pointer to an event semaphore handle. */
2219typedef RTSEMEVENT *PRTSEMEVENT;
2220/** Nil event semaphore handle. */
2221#define NIL_RTSEMEVENT 0
2222
2223/** @typedef RTSEMEVENTMULTI
2224 * Event Multiple Release Semaphore handle. */
2225typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
2226/** Pointer to an event multiple release semaphore handle. */
2227typedef RTSEMEVENTMULTI *PRTSEMEVENTMULTI;
2228/** Nil multiple release event semaphore handle. */
2229#define NIL_RTSEMEVENTMULTI 0
2230
2231/** @typedef RTSEMFASTMUTEX
2232 * Fast mutex Semaphore handle. */
2233typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
2234/** Pointer to a fast mutex semaphore handle. */
2235typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
2236/** Nil fast mutex semaphore handle. */
2237#define NIL_RTSEMFASTMUTEX 0
2238
2239/** @typedef RTSEMMUTEX
2240 * Mutex Semaphore handle. */
2241typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *) RTSEMMUTEX;
2242/** Pointer to a mutex semaphore handle. */
2243typedef RTSEMMUTEX *PRTSEMMUTEX;
2244/** Nil mutex semaphore handle. */
2245#define NIL_RTSEMMUTEX 0
2246
2247/** @typedef RTSEMSPINMUTEX
2248 * Spinning mutex Semaphore handle. */
2249typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL *) RTSEMSPINMUTEX;
2250/** Pointer to a spinning mutex semaphore handle. */
2251typedef RTSEMSPINMUTEX *PRTSEMSPINMUTEX;
2252/** Nil spinning mutex semaphore handle. */
2253#define NIL_RTSEMSPINMUTEX 0
2254
2255/** @typedef RTSEMRW
2256 * Read/Write Semaphore handle. */
2257typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *) RTSEMRW;
2258/** Pointer to a read/write semaphore handle. */
2259typedef RTSEMRW *PRTSEMRW;
2260/** Nil read/write semaphore handle. */
2261#define NIL_RTSEMRW 0
2262
2263/** @typedef RTSEMXROADS
2264 * Crossroads semaphore handle. */
2265typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL *) RTSEMXROADS;
2266/** Pointer to a crossroads semaphore handle. */
2267typedef RTSEMXROADS *PRTSEMXROADS;
2268/** Nil crossroads semaphore handle. */
2269#define NIL_RTSEMXROADS ((RTSEMXROADS)0)
2270
2271/** Spinlock handle. */
2272typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *) RTSPINLOCK;
2273/** Pointer to a spinlock handle. */
2274typedef RTSPINLOCK *PRTSPINLOCK;
2275/** Nil spinlock handle. */
2276#define NIL_RTSPINLOCK 0
2277
2278/** Socket handle. */
2279typedef R3R0PTRTYPE(struct RTSOCKETINT *) RTSOCKET;
2280/** Pointer to socket handle. */
2281typedef RTSOCKET *PRTSOCKET;
2282/** Nil socket handle. */
2283#define NIL_RTSOCKET ((RTSOCKET)0)
2284
2285/** Pointer to a RTTCPSERVER handle. */
2286typedef struct RTTCPSERVER *PRTTCPSERVER;
2287/** Pointer to a RTTCPSERVER handle. */
2288typedef PRTTCPSERVER *PPRTTCPSERVER;
2289/** Nil RTTCPSERVER handle. */
2290#define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
2291
2292/** Pointer to a RTUDPSERVER handle. */
2293typedef struct RTUDPSERVER *PRTUDPSERVER;
2294/** Pointer to a RTUDPSERVER handle. */
2295typedef PRTUDPSERVER *PPRTUDPSERVER;
2296/** Nil RTUDPSERVER handle. */
2297#define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
2298
2299/** Thread handle.*/
2300typedef R3R0PTRTYPE(struct RTTHREADINT *) RTTHREAD;
2301/** Pointer to thread handle. */
2302typedef RTTHREAD *PRTTHREAD;
2303/** Nil thread handle. */
2304#define NIL_RTTHREAD 0
2305
2306/** Thread context switching hook handle. */
2307typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT *) RTTHREADCTXHOOK;
2308/** Pointer to Thread context switching hook handle. */
2309typedef RTTHREADCTXHOOK *PRTTHREADCTXHOOK;
2310/** Nil Thread context switching hook handle. */
2311#define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
2312
2313/** A TLS index. */
2314typedef RTHCINTPTR RTTLS;
2315/** Pointer to a TLS index. */
2316typedef RTTLS *PRTTLS;
2317/** Pointer to a const TLS index. */
2318typedef RTTLS const *PCRTTLS;
2319/** NIL TLS index value. */
2320#define NIL_RTTLS ((RTTLS)-1)
2321
2322/** Trace buffer handle.
2323 * @remarks This is not a R3/R0 type like most other handles!
2324 */
2325typedef struct RTTRACEBUFINT *RTTRACEBUF;
2326/** Pointer to a trace buffer handle. */
2327typedef RTTRACEBUF *PRTTRACEBUF;
2328/** Nil trace buffer handle. */
2329#define NIL_RTTRACEBUF ((RTTRACEBUF)0)
2330/** The handle of the default trace buffer.
2331 * This can be used with any of the RTTraceBufAdd APIs. */
2332#define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
2333
2334/** Handle to a simple heap. */
2335typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *) RTHEAPSIMPLE;
2336/** Pointer to a handle to a simple heap. */
2337typedef RTHEAPSIMPLE *PRTHEAPSIMPLE;
2338/** NIL simple heap handle. */
2339#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
2340
2341/** Handle to an offset based heap. */
2342typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL *) RTHEAPOFFSET;
2343/** Pointer to a handle to an offset based heap. */
2344typedef RTHEAPOFFSET *PRTHEAPOFFSET;
2345/** NIL offset based heap handle. */
2346#define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
2347
2348/** Handle to an environment block. */
2349typedef R3PTRTYPE(struct RTENVINTERNAL *) RTENV;
2350/** Pointer to a handle to an environment block. */
2351typedef RTENV *PRTENV;
2352/** NIL simple heap handle. */
2353#define NIL_RTENV ((RTENV)0)
2354
2355/** A CPU identifier.
2356 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
2357 * does it have to correspond to the bits in the affinity mask, at
2358 * least not until we've sorted out Windows NT. */
2359typedef uint32_t RTCPUID;
2360/** Pointer to a CPU identifier. */
2361typedef RTCPUID *PRTCPUID;
2362/** Pointer to a const CPU identifier. */
2363typedef RTCPUID const *PCRTCPUID;
2364/** Nil CPU Id. */
2365#define NIL_RTCPUID ((RTCPUID)~0)
2366
2367/** The maximum number of CPUs a set can contain and IPRT is able
2368 * to reference. (Should be max of support arch/platforms.)
2369 * @remarks Must be a multiple of 64 (see RTCPUSET). */
2370#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
2371# define RTCPUSET_MAX_CPUS 256
2372#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
2373# define RTCPUSET_MAX_CPUS 1024
2374#else
2375# define RTCPUSET_MAX_CPUS 64
2376#endif
2377/** A CPU set.
2378 * @note Treat this as an opaque type and always use RTCpuSet* for
2379 * manipulating it. */
2380typedef struct RTCPUSET
2381{
2382 /** The bitmap. */
2383 uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
2384} RTCPUSET;
2385/** Pointer to a CPU set. */
2386typedef RTCPUSET *PRTCPUSET;
2387/** Pointer to a const CPU set. */
2388typedef RTCPUSET const *PCRTCPUSET;
2389
2390/** A handle table handle. */
2391typedef R3R0PTRTYPE(struct RTHANDLETABLEINT *) RTHANDLETABLE;
2392/** A pointer to a handle table handle. */
2393typedef RTHANDLETABLE *PRTHANDLETABLE;
2394/** @def NIL_RTHANDLETABLE
2395 * NIL handle table handle. */
2396#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
2397
2398/** A handle to a low resolution timer. */
2399typedef R3R0PTRTYPE(struct RTTIMERLRINT *) RTTIMERLR;
2400/** A pointer to a low resolution timer handle. */
2401typedef RTTIMERLR *PRTTIMERLR;
2402/** @def NIL_RTTIMERLR
2403 * NIL low resolution timer handle value. */
2404#define NIL_RTTIMERLR ((RTTIMERLR)0)
2405
2406/** Handle to a random number generator. */
2407typedef R3R0PTRTYPE(struct RTRANDINT *) RTRAND;
2408/** Pointer to a random number generator handle. */
2409typedef RTRAND *PRTRAND;
2410/** NIL random number generator handle value. */
2411#define NIL_RTRAND ((RTRAND)0)
2412
2413/** Debug address space handle. */
2414typedef R3R0PTRTYPE(struct RTDBGASINT *) RTDBGAS;
2415/** Pointer to a debug address space handle. */
2416typedef RTDBGAS *PRTDBGAS;
2417/** NIL debug address space handle. */
2418#define NIL_RTDBGAS ((RTDBGAS)0)
2419
2420/** Debug module handle. */
2421typedef R3R0PTRTYPE(struct RTDBGMODINT *) RTDBGMOD;
2422/** Pointer to a debug module handle. */
2423typedef RTDBGMOD *PRTDBGMOD;
2424/** NIL debug module handle. */
2425#define NIL_RTDBGMOD ((RTDBGMOD)0)
2426
2427/** Manifest handle. */
2428typedef struct RTMANIFESTINT *RTMANIFEST;
2429/** Pointer to a manifest handle. */
2430typedef RTMANIFEST *PRTMANIFEST;
2431/** NIL manifest handle. */
2432#define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
2433
2434/** Memory pool handle. */
2435typedef R3R0PTRTYPE(struct RTMEMPOOLINT *) RTMEMPOOL;
2436/** Pointer to a memory pool handle. */
2437typedef RTMEMPOOL *PRTMEMPOOL;
2438/** NIL memory pool handle. */
2439#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
2440/** The default memory pool handle. */
2441#define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
2442
2443/** String cache handle. */
2444typedef R3R0PTRTYPE(struct RTSTRCACHEINT *) RTSTRCACHE;
2445/** Pointer to a string cache handle. */
2446typedef RTSTRCACHE *PRTSTRCACHE;
2447/** NIL string cache handle. */
2448#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
2449/** The default string cache handle. */
2450#define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
2451
2452
2453/** Virtual Filesystem handle. */
2454typedef struct RTVFSINTERNAL *RTVFS;
2455/** Pointer to a VFS handle. */
2456typedef RTVFS *PRTVFS;
2457/** A NIL VFS handle. */
2458#define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
2459
2460/** Virtual Filesystem base object handle. */
2461typedef struct RTVFSOBJINTERNAL *RTVFSOBJ;
2462/** Pointer to a VFS base object handle. */
2463typedef RTVFSOBJ *PRTVFSOBJ;
2464/** A NIL VFS base object handle. */
2465#define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
2466
2467/** Virtual Filesystem directory handle. */
2468typedef struct RTVFSDIRINTERNAL *RTVFSDIR;
2469/** Pointer to a VFS directory handle. */
2470typedef RTVFSDIR *PRTVFSDIR;
2471/** A NIL VFS directory handle. */
2472#define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
2473
2474/** Virtual Filesystem filesystem stream handle. */
2475typedef struct RTVFSFSSTREAMINTERNAL *RTVFSFSSTREAM;
2476/** Pointer to a VFS filesystem stream handle. */
2477typedef RTVFSFSSTREAM *PRTVFSFSSTREAM;
2478/** A NIL VFS filesystem stream handle. */
2479#define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
2480
2481/** Virtual Filesystem I/O stream handle. */
2482typedef struct RTVFSIOSTREAMINTERNAL *RTVFSIOSTREAM;
2483/** Pointer to a VFS I/O stream handle. */
2484typedef RTVFSIOSTREAM *PRTVFSIOSTREAM;
2485/** A NIL VFS I/O stream handle. */
2486#define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
2487
2488/** Virtual Filesystem file handle. */
2489typedef struct RTVFSFILEINTERNAL *RTVFSFILE;
2490/** Pointer to a VFS file handle. */
2491typedef RTVFSFILE *PRTVFSFILE;
2492/** A NIL VFS file handle. */
2493#define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
2494
2495/** Virtual Filesystem symbolic link handle. */
2496typedef struct RTVFSSYMLINKINTERNAL *RTVFSSYMLINK;
2497/** Pointer to a VFS symbolic link handle. */
2498typedef RTVFSSYMLINK *PRTVFSSYMLINK;
2499/** A NIL VFS symbolic link handle. */
2500#define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
2501
2502/** Async I/O manager handle. */
2503typedef struct RTAIOMGRINT *RTAIOMGR;
2504/** Pointer to a async I/O manager handle. */
2505typedef RTAIOMGR *PRTAIOMGR;
2506/** A NIL async I/O manager handle. */
2507#define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
2508
2509/** Async I/O manager file handle. */
2510typedef struct RTAIOMGRFILEINT *RTAIOMGRFILE;
2511/** Pointer to a async I/O manager file handle. */
2512typedef RTAIOMGRFILE *PRTAIOMGRFILE;
2513/** A NIL async I/O manager file handle. */
2514#define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
2515
2516/**
2517 * Handle type.
2518 *
2519 * This is usually used together with RTHANDLEUNION.
2520 */
2521typedef enum RTHANDLETYPE
2522{
2523 /** The invalid zero value. */
2524 RTHANDLETYPE_INVALID = 0,
2525 /** File handle. */
2526 RTHANDLETYPE_FILE,
2527 /** Pipe handle */
2528 RTHANDLETYPE_PIPE,
2529 /** Socket handle. */
2530 RTHANDLETYPE_SOCKET,
2531 /** Thread handle. */
2532 RTHANDLETYPE_THREAD,
2533 /** The end of the valid values. */
2534 RTHANDLETYPE_END,
2535 /** The 32-bit type blow up. */
2536 RTHANDLETYPE_32BIT_HACK = 0x7fffffff
2537} RTHANDLETYPE;
2538/** Pointer to a handle type. */
2539typedef RTHANDLETYPE *PRTHANDLETYPE;
2540
2541/**
2542 * Handle union.
2543 *
2544 * This is usually used together with RTHANDLETYPE or as RTHANDLE.
2545 */
2546typedef union RTHANDLEUNION
2547{
2548 RTFILE hFile; /**< File handle. */
2549 RTPIPE hPipe; /**< Pipe handle. */
2550 RTSOCKET hSocket; /**< Socket handle. */
2551 RTTHREAD hThread; /**< Thread handle. */
2552 /** Generic integer handle value.
2553 * Note that RTFILE is not yet pointer sized, so accessing it via this member
2554 * isn't necessarily safe or fully portable. */
2555 RTHCUINTPTR uInt;
2556} RTHANDLEUNION;
2557/** Pointer to a handle union. */
2558typedef RTHANDLEUNION *PRTHANDLEUNION;
2559/** Pointer to a const handle union. */
2560typedef RTHANDLEUNION const *PCRTHANDLEUNION;
2561
2562/**
2563 * Generic handle.
2564 */
2565typedef struct RTHANDLE
2566{
2567 /** The handle type. */
2568 RTHANDLETYPE enmType;
2569 /** The handle value. */
2570 RTHANDLEUNION u;
2571} RTHANDLE;
2572/** Pointer to a generic handle. */
2573typedef RTHANDLE *PRTHANDLE;
2574/** Pointer to a const generic handle. */
2575typedef RTHANDLE const *PCRTHANDLE;
2576
2577
2578/**
2579 * Standard handles.
2580 *
2581 * @remarks These have the correct file descriptor values for unixy systems and
2582 * can be used directly in code specific to those platforms.
2583 */
2584typedef enum RTHANDLESTD
2585{
2586 /** Invalid standard handle. */
2587 RTHANDLESTD_INVALID = -1,
2588 /** The standard input handle. */
2589 RTHANDLESTD_INPUT = 0,
2590 /** The standard output handle. */
2591 RTHANDLESTD_OUTPUT,
2592 /** The standard error handle. */
2593 RTHANDLESTD_ERROR,
2594 /** The typical 32-bit type hack. */
2595 RTHANDLESTD_32BIT_HACK = 0x7fffffff
2596} RTHANDLESTD;
2597
2598
2599/**
2600 * Error info.
2601 *
2602 * See RTErrInfo*.
2603 */
2604typedef struct RTERRINFO
2605{
2606 /** Flags, see RTERRINFO_FLAGS_XXX. */
2607 uint32_t fFlags;
2608 /** The status code. */
2609 int32_t rc;
2610 /** The size of the message */
2611 size_t cbMsg;
2612 /** The error buffer. */
2613 char *pszMsg;
2614 /** Reserved for future use. */
2615 void *apvReserved[2];
2616} RTERRINFO;
2617/** Pointer to an error info structure. */
2618typedef RTERRINFO *PRTERRINFO;
2619/** Pointer to a const error info structure. */
2620typedef RTERRINFO const *PCRTERRINFO;
2621
2622/**
2623 * Static error info structure, see RTErrInfoInitStatic.
2624 */
2625typedef struct RTERRINFOSTATIC
2626{
2627 /** The core error info. */
2628 RTERRINFO Core;
2629 /** The static message buffer. */
2630 char szMsg[3072];
2631} RTERRINFOSTATIC;
2632/** Pointer to a error info buffer. */
2633typedef RTERRINFOSTATIC *PRTERRINFOSTATIC;
2634/** Pointer to a const static error info buffer. */
2635typedef RTERRINFOSTATIC const *PCRTERRINFOSTATIC;
2636
2637
2638/**
2639 * UUID data type.
2640 *
2641 * See RTUuid*.
2642 *
2643 * @remarks IPRT defines that the first three integers in the @c Gen struct
2644 * interpretation are in little endian representation. This is
2645 * different to many other UUID implementation, and requires
2646 * conversion if you need to achieve consistent results.
2647 */
2648typedef union RTUUID
2649{
2650 /** 8-bit view. */
2651 uint8_t au8[16];
2652 /** 16-bit view. */
2653 uint16_t au16[8];
2654 /** 32-bit view. */
2655 uint32_t au32[4];
2656 /** 64-bit view. */
2657 uint64_t au64[2];
2658 /** The way the UUID is declared by the DCE specification. */
2659 struct
2660 {
2661 uint32_t u32TimeLow;
2662 uint16_t u16TimeMid;
2663 uint16_t u16TimeHiAndVersion;
2664 uint8_t u8ClockSeqHiAndReserved;
2665 uint8_t u8ClockSeqLow;
2666 uint8_t au8Node[6];
2667 } Gen;
2668} RTUUID;
2669/** Pointer to UUID data. */
2670typedef RTUUID *PRTUUID;
2671/** Pointer to readonly UUID data. */
2672typedef const RTUUID *PCRTUUID;
2673
2674/** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
2675#define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
2676
2677/** UUID string maximum length. */
2678#define RTUUID_STR_LENGTH 37
2679
2680
2681/** Compression handle. */
2682typedef struct RTZIPCOMP *PRTZIPCOMP;
2683/** Decompressor handle. */
2684typedef struct RTZIPDECOMP *PRTZIPDECOMP;
2685
2686
2687/**
2688 * Unicode Code Point.
2689 */
2690typedef uint32_t RTUNICP;
2691/** Pointer to an Unicode Code Point. */
2692typedef RTUNICP *PRTUNICP;
2693/** Pointer to an Unicode Code Point. */
2694typedef const RTUNICP *PCRTUNICP;
2695/** Max value a RTUNICP type can hold. */
2696#define RTUNICP_MAX ( ~(RTUNICP)0 )
2697/** Invalid code point.
2698 * This is returned when encountered invalid encodings or invalid
2699 * unicode code points. */
2700#define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
2701
2702
2703/**
2704 * UTF-16 character.
2705 * @remark wchar_t is not usable since it's compiler defined.
2706 * @remark When we use the term character we're not talking about unicode code point, but
2707 * the basic unit of the string encoding. Thus cwc - count of wide chars - means
2708 * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
2709 * and cch means count of the typedef 'char', which is assumed to be an octet.
2710 */
2711typedef uint16_t RTUTF16;
2712/** Pointer to a UTF-16 character. */
2713typedef RTUTF16 *PRTUTF16;
2714/** Pointer to a const UTF-16 character. */
2715typedef const RTUTF16 *PCRTUTF16;
2716
2717
2718/**
2719 * String tuple to go with the RT_STR_TUPLE macro.
2720 */
2721typedef struct RTSTRTUPLE
2722{
2723 /** The string. */
2724 const char *psz;
2725 /** The string length. */
2726 size_t cch;
2727} RTSTRTUPLE;
2728/** Pointer to a string tuple. */
2729typedef RTSTRTUPLE *PRTSTRTUPLE;
2730/** Pointer to a const string tuple. */
2731typedef RTSTRTUPLE const *PCRTSTRTUPLE;
2732
2733/**
2734 * Wait for ever if we have to.
2735 */
2736#define RT_INDEFINITE_WAIT (~0U)
2737
2738
2739/**
2740 * Generic process callback.
2741 *
2742 * @returns VBox status code. Failure will cancel the operation.
2743 * @param uPercentage The percentage of the operation which has been completed.
2744 * @param pvUser The user specified argument.
2745 */
2746typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
2747/** Pointer to a generic progress callback function, FNRTPROCESS(). */
2748typedef FNRTPROGRESS *PFNRTPROGRESS;
2749
2750/**
2751 * Generic vprintf-like callback function for dumpers.
2752 *
2753 * @param pvUser User argument.
2754 * @param pszFormat The format string.
2755 * @param va Arguments for the format string.
2756 */
2757typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
2758/** Pointer to a generic printf-like function for dumping. */
2759typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
2760
2761
2762/**
2763 * A point in a two dimentional coordinate system.
2764 */
2765typedef struct RTPOINT
2766{
2767 /** X coordinate. */
2768 int32_t x;
2769 /** Y coordinate. */
2770 int32_t y;
2771} RTPOINT;
2772/** Pointer to a point. */
2773typedef RTPOINT *PRTPOINT;
2774/** Pointer to a const point. */
2775typedef const RTPOINT *PCRTPOINT;
2776
2777
2778/**
2779 * Rectangle data type, double point.
2780 */
2781typedef struct RTRECT
2782{
2783 /** left X coordinate. */
2784 int32_t xLeft;
2785 /** top Y coordinate. */
2786 int32_t yTop;
2787 /** right X coordinate. (exclusive) */
2788 int32_t xRight;
2789 /** bottom Y coordinate. (exclusive) */
2790 int32_t yBottom;
2791} RTRECT;
2792/** Pointer to a double point rectangle. */
2793typedef RTRECT *PRTRECT;
2794/** Pointer to a const double point rectangle. */
2795typedef const RTRECT *PCRTRECT;
2796
2797
2798/**
2799 * Rectangle data type, point + size.
2800 */
2801typedef struct RTRECT2
2802{
2803 /** X coordinate.
2804 * Unless stated otherwise, this is the top left corner. */
2805 int32_t x;
2806 /** Y coordinate.
2807 * Unless stated otherwise, this is the top left corner. */
2808 int32_t y;
2809 /** The width.
2810 * Unless stated otherwise, this is to the right of (x,y) and will not
2811 * be a negative number. */
2812 int32_t cx;
2813 /** The height.
2814 * Unless stated otherwise, this is down from (x,y) and will not be a
2815 * negative number. */
2816 int32_t cy;
2817} RTRECT2;
2818/** Pointer to a point + size rectangle. */
2819typedef RTRECT2 *PRTRECT2;
2820/** Pointer to a const point + size rectangle. */
2821typedef const RTRECT2 *PCRTRECT2;
2822
2823
2824/**
2825 * The size of a rectangle.
2826 */
2827typedef struct RTRECTSIZE
2828{
2829 /** The width (along the x-axis). */
2830 uint32_t cx;
2831 /** The height (along the y-axis). */
2832 uint32_t cy;
2833} RTRECTSIZE;
2834/** Pointer to a rectangle size. */
2835typedef RTRECTSIZE *PRTRECTSIZE;
2836/** Pointer to a const rectangle size. */
2837typedef const RTRECTSIZE *PCRTRECTSIZE;
2838
2839
2840/**
2841 * Ethernet MAC address.
2842 *
2843 * The first 24 bits make up the Organisationally Unique Identifier (OUI),
2844 * where the first bit (little endian) indicates multicast (set) / unicast,
2845 * and the second bit indicates locally (set) / global administered. If all
2846 * bits are set, it's a broadcast.
2847 */
2848typedef union RTMAC
2849{
2850 /** @todo add a bitfield view of this stuff. */
2851 /** 8-bit view. */
2852 uint8_t au8[6];
2853 /** 16-bit view. */
2854 uint16_t au16[3];
2855} RTMAC;
2856/** Pointer to a MAC address. */
2857typedef RTMAC *PRTMAC;
2858/** Pointer to a readonly MAC address. */
2859typedef const RTMAC *PCRTMAC;
2860
2861
2862/** Pointer to a lock validator record.
2863 * The structure definition is found in iprt/lockvalidator.h. */
2864typedef struct RTLOCKVALRECEXCL *PRTLOCKVALRECEXCL;
2865/** Pointer to a record of one ownership share.
2866 * The structure definition is found in iprt/lockvalidator.h. */
2867typedef struct RTLOCKVALRECSHRD *PRTLOCKVALRECSHRD;
2868/** Pointer to a lock validator source position.
2869 * The structure definition is found in iprt/lockvalidator.h. */
2870typedef struct RTLOCKVALSRCPOS *PRTLOCKVALSRCPOS;
2871/** Pointer to a const lock validator source position.
2872 * The structure definition is found in iprt/lockvalidator.h. */
2873typedef struct RTLOCKVALSRCPOS const *PCRTLOCKVALSRCPOS;
2874
2875/** @name Special sub-class values.
2876 * The range 16..UINT32_MAX is available to the user, the range 0..15 is
2877 * reserved for the lock validator. In the user range the locks can only be
2878 * taking in ascending order.
2879 * @{ */
2880/** Invalid value. */
2881#define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
2882/** Not allowed to be taken with any other locks in the same class.
2883 * This is the recommended value. */
2884#define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
2885/** Any order is allowed within the class. */
2886#define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
2887/** The first user value. */
2888#define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
2889/** @} */
2890
2891
2892/**
2893 * Digest types.
2894 */
2895typedef enum RTDIGESTTYPE
2896{
2897 /** Invalid digest value. */
2898 RTDIGESTTYPE_INVALID = 0,
2899 /** Unknown digest type. */
2900 RTDIGESTTYPE_UNKNOWN,
2901 /** CRC32 checksum. */
2902 RTDIGESTTYPE_CRC32,
2903 /** CRC64 checksum. */
2904 RTDIGESTTYPE_CRC64,
2905 /** MD2 checksum (unsafe!). */
2906 RTDIGESTTYPE_MD2,
2907 /** MD4 checksum (unsafe!!). */
2908 RTDIGESTTYPE_MD4,
2909 /** MD5 checksum (unsafe!). */
2910 RTDIGESTTYPE_MD5,
2911 /** SHA-1 checksum (unsafe!). */
2912 RTDIGESTTYPE_SHA1,
2913 /** SHA-224 checksum. */
2914 RTDIGESTTYPE_SHA224,
2915 /** SHA-256 checksum. */
2916 RTDIGESTTYPE_SHA256,
2917 /** SHA-384 checksum. */
2918 RTDIGESTTYPE_SHA384,
2919 /** SHA-512 checksum. */
2920 RTDIGESTTYPE_SHA512,
2921 /** SHA-512/224 checksum. */
2922 RTDIGESTTYPE_SHA512T224,
2923 /** SHA-512/256 checksum. */
2924 RTDIGESTTYPE_SHA512T256,
2925 /** End of valid types. */
2926 RTDIGESTTYPE_END,
2927 /** Usual 32-bit type blowup. */
2928 RTDIGESTTYPE_32BIT_HACK = 0x7fffffff
2929} RTDIGESTTYPE;
2930
2931/**
2932 * Process exit codes.
2933 */
2934typedef enum RTEXITCODE
2935{
2936 /** Success. */
2937 RTEXITCODE_SUCCESS = 0,
2938 /** General failure. */
2939 RTEXITCODE_FAILURE = 1,
2940 /** Invalid arguments. */
2941 RTEXITCODE_SYNTAX = 2,
2942 /** Initialization failure (usually IPRT, but could be used for other
2943 * components as well). */
2944 RTEXITCODE_INIT = 3,
2945 /** Test skipped. */
2946 RTEXITCODE_SKIPPED = 4,
2947 /** The end of valid exit codes. */
2948 RTEXITCODE_END,
2949 /** The usual 32-bit type hack. */
2950 RTEXITCODE_32BIT_HACK = 0x7fffffff
2951} RTEXITCODE;
2952
2953/**
2954 * Range descriptor.
2955 */
2956typedef struct RTRANGE
2957{
2958 /** Start offset. */
2959 uint64_t offStart;
2960 /** Range size. */
2961 size_t cbRange;
2962} RTRANGE;
2963/** Pointer to a range descriptor. */
2964typedef RTRANGE *PRTRANGE;
2965/** Pointer to a readonly range descriptor. */
2966typedef const RTRANGE *PCRTRANGE;
2967
2968
2969/**
2970 * Generic pointer union.
2971 */
2972typedef union RTPTRUNION
2973{
2974 /** Pointer into the void. */
2975 void *pv;
2976 /** As a signed integer. */
2977 intptr_t i;
2978 /** As an unsigned integer. */
2979 intptr_t u;
2980 /** Pointer to char value. */
2981 char *pch;
2982 /** Pointer to char value. */
2983 unsigned char *puch;
2984 /** Pointer to a int value. */
2985 int *pi;
2986 /** Pointer to a unsigned int value. */
2987 unsigned int *pu;
2988 /** Pointer to a long value. */
2989 long *pl;
2990 /** Pointer to a long value. */
2991 unsigned long *pul;
2992 /** Pointer to a 8-bit unsigned value. */
2993 uint8_t *pu8;
2994 /** Pointer to a 16-bit unsigned value. */
2995 uint16_t *pu16;
2996 /** Pointer to a 32-bit unsigned value. */
2997 uint32_t *pu32;
2998 /** Pointer to a 64-bit unsigned value. */
2999 uint64_t *pu64;
3000 /** Pointer to a UTF-16 character. */
3001 PRTUTF16 pwc;
3002 /** Pointer to a UUID character. */
3003 PRTUUID pUuid;
3004} RTPTRUNION;
3005/** Pointer to a pointer union. */
3006typedef RTPTRUNION *PRTPTRUNION;
3007
3008/**
3009 * Generic const pointer union.
3010 */
3011typedef union RTCPTRUNION
3012{
3013 /** Pointer into the void. */
3014 void const *pv;
3015 /** As a signed integer. */
3016 intptr_t i;
3017 /** As an unsigned integer. */
3018 intptr_t u;
3019 /** Pointer to char value. */
3020 char const *pch;
3021 /** Pointer to char value. */
3022 unsigned char const *puch;
3023 /** Pointer to a int value. */
3024 int const *pi;
3025 /** Pointer to a unsigned int value. */
3026 unsigned int const *pu;
3027 /** Pointer to a long value. */
3028 long const *pl;
3029 /** Pointer to a long value. */
3030 unsigned long const *pul;
3031 /** Pointer to a 8-bit unsigned value. */
3032 uint8_t const *pu8;
3033 /** Pointer to a 16-bit unsigned value. */
3034 uint16_t const *pu16;
3035 /** Pointer to a 32-bit unsigned value. */
3036 uint32_t const *pu32;
3037 /** Pointer to a 64-bit unsigned value. */
3038 uint64_t const *pu64;
3039 /** Pointer to a UTF-16 character. */
3040 PCRTUTF16 pwc;
3041 /** Pointer to a UUID character. */
3042 PCRTUUID pUuid;
3043} RTCPTRUNION;
3044/** Pointer to a const pointer union. */
3045typedef RTCPTRUNION *PRTCPTRUNION;
3046
3047/**
3048 * Generic volatile pointer union.
3049 */
3050typedef union RTVPTRUNION
3051{
3052 /** Pointer into the void. */
3053 void volatile *pv;
3054 /** As a signed integer. */
3055 intptr_t i;
3056 /** As an unsigned integer. */
3057 intptr_t u;
3058 /** Pointer to char value. */
3059 char volatile *pch;
3060 /** Pointer to char value. */
3061 unsigned char volatile *puch;
3062 /** Pointer to a int value. */
3063 int volatile *pi;
3064 /** Pointer to a unsigned int value. */
3065 unsigned int volatile *pu;
3066 /** Pointer to a long value. */
3067 long volatile *pl;
3068 /** Pointer to a long value. */
3069 unsigned long volatile *pul;
3070 /** Pointer to a 8-bit unsigned value. */
3071 uint8_t volatile *pu8;
3072 /** Pointer to a 16-bit unsigned value. */
3073 uint16_t volatile *pu16;
3074 /** Pointer to a 32-bit unsigned value. */
3075 uint32_t volatile *pu32;
3076 /** Pointer to a 64-bit unsigned value. */
3077 uint64_t volatile *pu64;
3078 /** Pointer to a UTF-16 character. */
3079 RTUTF16 volatile *pwc;
3080 /** Pointer to a UUID character. */
3081 RTUUID volatile *pUuid;
3082} RTVPTRUNION;
3083/** Pointer to a const pointer union. */
3084typedef RTVPTRUNION *PRTVPTRUNION;
3085
3086/**
3087 * Generic const volatile pointer union.
3088 */
3089typedef union RTCVPTRUNION
3090{
3091 /** Pointer into the void. */
3092 void const volatile *pv;
3093 /** As a signed integer. */
3094 intptr_t i;
3095 /** As an unsigned integer. */
3096 intptr_t u;
3097 /** Pointer to char value. */
3098 char const volatile *pch;
3099 /** Pointer to char value. */
3100 unsigned char const volatile *puch;
3101 /** Pointer to a int value. */
3102 int const volatile *pi;
3103 /** Pointer to a unsigned int value. */
3104 unsigned int const volatile *pu;
3105 /** Pointer to a long value. */
3106 long const volatile *pl;
3107 /** Pointer to a long value. */
3108 unsigned long const volatile *pul;
3109 /** Pointer to a 8-bit unsigned value. */
3110 uint8_t const volatile *pu8;
3111 /** Pointer to a 16-bit unsigned value. */
3112 uint16_t const volatile *pu16;
3113 /** Pointer to a 32-bit unsigned value. */
3114 uint32_t const volatile *pu32;
3115 /** Pointer to a 64-bit unsigned value. */
3116 uint64_t const volatile *pu64;
3117 /** Pointer to a UTF-16 character. */
3118 RTUTF16 const volatile *pwc;
3119 /** Pointer to a UUID character. */
3120 RTUUID const volatile *pUuid;
3121} RTCVPTRUNION;
3122/** Pointer to a const pointer union. */
3123typedef RTCVPTRUNION *PRTCVPTRUNION;
3124
3125
3126
3127#ifdef __cplusplus
3128/**
3129 * Strict type validation helper class.
3130 *
3131 * See RTErrStrictType and RT_SUCCESS_NP.
3132 */
3133class RTErrStrictType2
3134{
3135protected:
3136 /** The status code. */
3137 int32_t m_rc;
3138
3139public:
3140 /**
3141 * Constructor.
3142 * @param rc IPRT style status code.
3143 */
3144 RTErrStrictType2(int32_t rc) : m_rc(rc)
3145 {
3146 }
3147
3148 /**
3149 * Get the status code.
3150 * @returns IPRT style status code.
3151 */
3152 int32_t getValue() const
3153 {
3154 return m_rc;
3155 }
3156};
3157#endif /* __cplusplus */
3158/** @} */
3159
3160#endif
3161
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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