VirtualBox

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

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

iprt/cdefs.h: More RTPBC80U macros and some union tweaks. bugref:9898

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