VirtualBox

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

Last change on this file since 93829 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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

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