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