VirtualBox

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

Last change on this file since 84546 was 84407, checked in by vboxsync, 5 years ago

include/iprt: VC++ 19.0 adjustments. bugref:8489

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

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