VirtualBox

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

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

iprt/types,nocrt/compiler/msc.h: VC++ 14.1 adjustments. bugref:8489

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