VirtualBox

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

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

iprt/types.h: Added RTCCINTXREG_BITS. bugref:9898

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 126.9 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/** The exponent bias overflow/underflow adjust for the RTFLOAT32U format.
959 * @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
960#define RTFLOAT32U_EXP_BIAS_ADJUST (192)
961/** Fraction width (in bits) for the RTFLOAT32U format. */
962#define RTFLOAT32U_FRACTION_BITS (23)
963/** Check if two 32-bit floating values are identical (memcmp, not
964 * numerically). */
965#define RTFLOAT32U_ARE_IDENTICAL(a_pLeft, a_pRight) ((a_pLeft)->u == (a_pRight)->u)
966/** @name RTFLOAT32U classification macros
967 * @{ */
968#define RTFLOAT32U_IS_ZERO(a_pr32) (((a_pr32)->u & (RT_BIT_32(31) - 1)) == 0)
969#define RTFLOAT32U_IS_SUBNORMAL(a_pr32) ((a_pr32)->s.uExponent == 0 && (a_pr32)->s.uFraction != 0)
970#define RTFLOAT32U_IS_INF(a_pr32) ((a_pr32)->s.uExponent == 0xff && (a_pr32)->s.uFraction == 0)
971#define RTFLOAT32U_IS_SIGNALLING_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && !((a_pr32)->s.uFraction & RT_BIT_32(22)) \
972 && (a_pr32)->s.uFraction != 0)
973#define RTFLOAT32U_IS_QUIET_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && ((a_pr32)->s.uFraction & RT_BIT_32(22)))
974#define RTFLOAT32U_IS_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && (a_pr32)->s.uFraction != 0)
975#define RTFLOAT32U_IS_NORMAL(a_pr32) ((a_pr32)->s.uExponent > 0 && (a_pr32)->s.uExponent < 0xff)
976/** @} */
977
978
979/**
980 * Double precision floating point format (64-bit).
981 */
982typedef union RTFLOAT64U
983{
984 /** Format using regular bitfields. */
985 struct
986 {
987# ifdef RT_BIG_ENDIAN
988 /** The sign indicator. */
989 uint32_t fSign : 1;
990 /** The exponent (offseted by 1023). */
991 uint32_t uExponent : 11;
992 /** The fraction, bits 32 thru 51. */
993 uint32_t uFractionHigh : 20;
994 /** The fraction, bits 0 thru 31. */
995 uint32_t uFractionLow;
996# else
997 /** The fraction, bits 0 thru 31. */
998 uint32_t uFractionLow;
999 /** The fraction, bits 32 thru 51. */
1000 uint32_t uFractionHigh : 20;
1001 /** The exponent (offseted by 1023). */
1002 uint32_t uExponent : 11;
1003 /** The sign indicator. */
1004 uint32_t fSign : 1;
1005# endif
1006 } s;
1007
1008#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
1009 /** Format using 64-bit bitfields. */
1010 RT_GCC_EXTENSION struct
1011 {
1012# ifdef RT_BIG_ENDIAN
1013 /** The sign indicator. */
1014 RT_GCC_EXTENSION uint64_t fSign : 1;
1015 /** The exponent (offseted by 1023). */
1016 RT_GCC_EXTENSION uint64_t uExponent : 11;
1017 /** The fraction. */
1018 RT_GCC_EXTENSION uint64_t uFraction : 52;
1019# else
1020 /** The fraction. */
1021 RT_GCC_EXTENSION uint64_t uFraction : 52;
1022 /** The exponent (offseted by 1023). */
1023 RT_GCC_EXTENSION uint64_t uExponent : 11;
1024 /** The sign indicator. */
1025 RT_GCC_EXTENSION uint64_t fSign : 1;
1026# endif
1027 } s64;
1028#endif
1029
1030#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
1031 /** Double view. */
1032 double rd;
1033#endif
1034 /** Unsigned integer view. */
1035 uint64_t u;
1036 /** 64-bit view. */
1037 uint64_t au64[1];
1038 /** 32-bit view. */
1039 uint32_t au32[2];
1040 /** 16-bit view. */
1041 uint16_t au16[4];
1042 /** 8-bit view. */
1043 uint8_t au8[8];
1044} RTFLOAT64U;
1045/** Pointer to a double precision floating point format union. */
1046typedef RTFLOAT64U RT_FAR *PRTFLOAT64U;
1047/** Pointer to a const double precision floating point format union. */
1048typedef const RTFLOAT64U RT_FAR *PCRTFLOAT64U;
1049/** RTFLOAT64U initializer. */
1050#ifdef RT_BIG_ENDIAN
1051# define RTFLOAT64U_INIT(a_fSign, a_uFraction, a_uExponent) \
1052 { { (a_fSign), (a_uExponent), (uint32_t)((a_uFraction) >> 32), (uint32_t)((a_uFraction) & UINT32_MAX) } }
1053#else
1054# define RTFLOAT64U_INIT(a_fSign, a_uFraction, a_uExponent) \
1055 { { (uint32_t)((a_uFraction) & UINT32_MAX), (uint32_t)((a_uFraction) >> 32), (a_uExponent), (a_fSign) } }
1056#endif
1057#define RTFLOAT64U_INIT_C(a_fSign, a_uFraction, a_uExponent) RTFLOAT64U_INIT((a_fSign), UINT64_C(a_uFraction), (a_uExponent))
1058/** The exponent bias for the RTFLOAT64U format. */
1059#define RTFLOAT64U_EXP_BIAS (1023)
1060/** The max exponent value for the RTFLOAT64U format. */
1061#define RTFLOAT64U_EXP_MAX (2047)
1062/** The exponent bias overflow/underflow adjust for the RTFLOAT64U format.
1063 * @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
1064#define RTFLOAT64U_EXP_BIAS_ADJUST (1536)
1065/** Fraction width (in bits) for the RTFLOAT64U format. */
1066#define RTFLOAT64U_FRACTION_BITS (52)
1067/** Check if two 64-bit floating values are identical (memcmp, not
1068 * numerically). */
1069#define RTFLOAT64U_ARE_IDENTICAL(a_pLeft, a_pRight) ((a_pLeft)->u == (a_pRight)->u)
1070/** @name RTFLOAT64U classification macros
1071 * @{ */
1072#define RTFLOAT64U_IS_ZERO(a_pr64) (((a_pr64)->u & (RT_BIT_64(63) - 1)) == 0)
1073#define RTFLOAT64U_IS_SUBNORMAL(a_pr64) ( (a_pr64)->s.uExponent == 0 \
1074 && ((a_pr64)->s.uFractionLow != 0 || (a_pr64)->s.uFractionHigh != 0) )
1075#define RTFLOAT64U_IS_INF(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
1076 && (a_pr64)->s.uFractionLow == 0 && (a_pr64)->s.uFractionHigh == 0)
1077#define RTFLOAT64U_IS_SIGNALLING_NAN(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
1078 && !((a_pr64)->s.uFractionHigh & RT_BIT_32(19)) \
1079 && ((a_pr64)->s.uFractionHigh != 0 || (a_pr64)->s.uFractionLow != 0) )
1080#define RTFLOAT64U_IS_QUIET_NAN(a_pr64) ((a_pr64)->s.uExponent == 0x7ff && ((a_pr64)->s.uFractionHigh & RT_BIT_32(19)))
1081#define RTFLOAT64U_IS_NAN(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
1082 && ((a_pr64)->s.uFractionHigh != 0 || (a_pr64)->s.uFractionLow != 0) )
1083#define RTFLOAT64U_IS_NORMAL(a_pr64) ((a_pr64)->s.uExponent > 0 && (a_pr64)->s.uExponent < 0x7ff)
1084/** @} */
1085
1086
1087
1088#if !defined(__IBMCPP__) && !defined(__IBMC__)
1089
1090/**
1091 * Extended Double precision floating point format (80-bit).
1092 */
1093# pragma pack(1)
1094typedef union RTFLOAT80U
1095{
1096 /** Format using bitfields. */
1097 RT_GCC_EXTENSION struct
1098 {
1099# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1100 /** The sign indicator. */
1101 RT_GCC_EXTENSION uint16_t fSign : 1;
1102 /** The exponent (offseted by 16383). */
1103 RT_GCC_EXTENSION uint16_t uExponent : 15;
1104 /** The mantissa. */
1105 uint64_t uMantissa;
1106# else
1107 /** The mantissa. */
1108 uint64_t uMantissa;
1109 /** The exponent (offseted by 16383). */
1110 RT_GCC_EXTENSION uint16_t uExponent : 15;
1111 /** The sign indicator. */
1112 RT_GCC_EXTENSION uint16_t fSign : 1;
1113# endif
1114 } s;
1115
1116 /** Format for accessing it as two separate components. */
1117 RT_GCC_EXTENSION struct
1118 {
1119# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1120 /** The sign bit and exponent. */
1121 uint16_t uSignAndExponent;
1122 /** The mantissa. */
1123 uint64_t uMantissa;
1124# else
1125 /** The mantissa. */
1126 uint64_t uMantissa;
1127 /** The sign bit and exponent. */
1128 uint16_t uSignAndExponent;
1129# endif
1130 } s2;
1131
1132# ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
1133 /** 64-bit bitfields exposing the J bit and the fraction. */
1134 RT_GCC_EXTENSION struct
1135 {
1136# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1137 /** The sign indicator. */
1138 RT_GCC_EXTENSION uint16_t fSign : 1;
1139 /** The exponent (offseted by 16383). */
1140 RT_GCC_EXTENSION uint16_t uExponent : 15;
1141 /** The J bit, aka the integer bit. */
1142 RT_GCC_EXTENSION uint64_t fInteger : 1;
1143 /** The fraction. */
1144 RT_GCC_EXTENSION uint64_t uFraction : 63;
1145# else
1146 /** The fraction. */
1147 RT_GCC_EXTENSION uint64_t uFraction : 63;
1148 /** The J bit, aka the integer bit. */
1149 RT_GCC_EXTENSION uint64_t fInteger : 1;
1150 /** The exponent (offseted by 16383). */
1151 RT_GCC_EXTENSION uint16_t uExponent : 15;
1152 /** The sign indicator. */
1153 RT_GCC_EXTENSION uint16_t fSign : 1;
1154# endif
1155 } sj64;
1156# endif
1157
1158 /** 64-bit view. */
1159 uint64_t au64[1];
1160 /** 32-bit view. */
1161 uint32_t au32[2];
1162 /** 16-bit view. */
1163 uint16_t au16[5];
1164 /** 8-bit view. */
1165 uint8_t au8[10];
1166} RTFLOAT80U;
1167# pragma pack()
1168/** Pointer to a extended precision floating point format union. */
1169typedef RTFLOAT80U RT_FAR *PRTFLOAT80U;
1170/** Pointer to a const extended precision floating point format union. */
1171typedef const RTFLOAT80U RT_FAR *PCRTFLOAT80U;
1172/** RTFLOAT80U initializer. */
1173# ifdef RT_BIG_ENDIAN
1174# define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_fSign), (a_uExponent), (a_uMantissa) } }
1175# else
1176# define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_uMantissa), (a_uExponent), (a_fSign) } }
1177# endif
1178# define RTFLOAT80U_INIT_C(a_fSign, a_uMantissa, a_uExponent) RTFLOAT80U_INIT((a_fSign), UINT64_C(a_uMantissa), (a_uExponent))
1179# define RTFLOAT80U_INIT_ZERO(a_fSign) RTFLOAT80U_INIT((a_fSign), 0, 0)
1180# define RTFLOAT80U_INIT_INF(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63), 0x7fff)
1181# define RTFLOAT80U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | 1, 0x7fff)
1182# define RTFLOAT80U_INIT_SNAN(a_fSign) RTFLOAT80U_INIT_SIGNALLING_NAN(a_fSign)
1183# define RTFLOAT80U_INIT_QUIET_NAN(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62) | 1, 0x7fff)
1184# define RTFLOAT80U_INIT_QNAN(a_fSign) RTFLOAT80U_INIT_QUIET_NAN(a_fSign)
1185# define RTFLOAT80U_INIT_INDEFINITE(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62), 0x7fff)
1186# define RTFLOAT80U_INIT_IND(a_fSign) RTFLOAT80U_INIT_INDEFINITE(a_fSign)
1187/** The exponent bias for the RTFLOAT80U format. */
1188# define RTFLOAT80U_EXP_BIAS (16383)
1189/** The max exponent value for the RTFLOAT80U format. */
1190# define RTFLOAT80U_EXP_MAX (32767)
1191/** The exponent bias overflow/underflow adjust for the RTFLOAT80U format.
1192 * @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
1193# define RTFLOAT80U_EXP_BIAS_ADJUST (24576)
1194/** Fraction width (in bits) for the RTFLOAT80U format. */
1195# define RTFLOAT80U_FRACTION_BITS (63)
1196/** Check if two 80-bit floating values are identical (memcmp, not
1197 * numberically). */
1198# define RTFLOAT80U_ARE_IDENTICAL(a_pLeft, a_pRight) \
1199 ( (a_pLeft)->au64[0] == (a_pRight)->au64[0] \
1200 && (a_pLeft)->au16[4] == (a_pRight)->au16[4] )
1201/** @name RTFLOAT80U classification macros
1202 * @{ */
1203/** Is @a a_pr80 +0 or -0. */
1204# define RTFLOAT80U_IS_ZERO(a_pr80) RTFLOAT80U_IS_ZERO_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1205# define RTFLOAT80U_IS_ZERO_EX(a_uMantissa, a_uExponent) \
1206 ((a_uExponent) == 0 && (a_uMantissa) == 0)
1207/** Is @a a_pr80 a denormal (does not match psuedo-denormal). */
1208# define RTFLOAT80U_IS_DENORMAL(a_pr80) RTFLOAT80U_IS_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1209# define RTFLOAT80U_IS_DENORMAL_EX(a_uMantissa, a_uExponent) \
1210 ((a_uExponent) == 0 && (a_uMantissa) < RT_BIT_64(63) && (a_uMantissa) != 0)
1211/** Is @a a_pr80 a pseudo-denormal. */
1212# define RTFLOAT80U_IS_PSEUDO_DENORMAL(a_pr80) RTFLOAT80U_IS_PSEUDO_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1213# define RTFLOAT80U_IS_PSEUDO_DENORMAL_EX(a_uMantissa, a_uExponent) \
1214 ((a_uExponent) == 0 && (a_uMantissa) >= RT_BIT_64(63))
1215/** Is @a a_pr80 denormal or pseudo-denormal. */
1216# define RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(a_pr80) \
1217 RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1218# define RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0 && (a_uMantissa) != 0)
1219/** Is @a a_pr80 +/-pseudo-infinity. */
1220# define RTFLOAT80U_IS_PSEUDO_INF(a_pr80) RTFLOAT80U_IS_PSEUDO_INF_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1221# define RTFLOAT80U_IS_PSEUDO_INF_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && (a_uMantissa) == 0)
1222/** Is @a a_pr80 pseudo-not-a-number. */
1223# define RTFLOAT80U_IS_PSEUDO_NAN(a_pr80) RTFLOAT80U_IS_PSEUDO_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1224# define RTFLOAT80U_IS_PSEUDO_NAN_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && !((a_uMantissa) & RT_BIT_64(63)))
1225/** Is @a a_pr80 infinity (does not match pseudo-infinity). */
1226# define RTFLOAT80U_IS_INF(a_pr80) RTFLOAT80U_IS_INF_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1227# define RTFLOAT80U_IS_INF_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && (a_uMantissa) == RT_BIT_64(63))
1228/** Is @a a_pr80 a signalling not-a-number value. */
1229# define RTFLOAT80U_IS_SIGNALLING_NAN(a_pr80) RTFLOAT80U_IS_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1230# define RTFLOAT80U_IS_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
1231 ( (a_uExponent) == 0x7fff \
1232 && ((a_uMantissa) & (RT_BIT_64(63) | RT_BIT_64(62))) == RT_BIT_64(63) \
1233 && ((a_uMantissa) & (RT_BIT_64(62) - 1)) != 0)
1234/** Is @a a_pr80 a quiet not-a-number value. */
1235# define RTFLOAT80U_IS_QUIET_NAN(a_pr80) RTFLOAT80U_IS_QUIET_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1236# define RTFLOAT80U_IS_QUIET_NAN_EX(a_uMantissa, a_uExponent) \
1237 ( (a_uExponent) == 0x7fff \
1238 && ((a_uMantissa) & (RT_BIT_64(63) | RT_BIT_64(62))) == (RT_BIT_64(63) | RT_BIT_64(62)) \
1239 && ((a_uMantissa) & (RT_BIT_64(62) - 1)) != 0)
1240/** Is @a a_pr80 Signalling-, Quiet- or Pseudo-NaN. */
1241# define RTFLOAT80U_IS_NAN(a_pr80) RTFLOAT80U_IS_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1242# define RTFLOAT80U_IS_NAN_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && ((a_uMantissa) & (RT_BIT_64(63) - 1)) != 0)
1243/** Is @a a_pr80 Signalling- or Quiet-Nan, but not Pseudo-NaN. */
1244# define RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN(a_pr80) \
1245 RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1246# define RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
1247 ((a_uExponent) == 0x7fff && ((a_uMantissa) > RT_BIT_64(63)))
1248/** Is @a a_pr80 indefinite (ignoring sign). */
1249# define RTFLOAT80U_IS_INDEFINITE(a_pr80) RTFLOAT80U_IS_INDEFINITE_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1250# define RTFLOAT80U_IS_INDEFINITE_EX(a_uMantissa, a_uExponent) \
1251 ((a_uExponent) == 0x7fff && (a_uMantissa) == (RT_BIT_64(63) | RT_BIT_64(62)))
1252/** Is @a a_pr80 Indefinite, Signalling- or Quiet-Nan, but not Pseudo-NaN (nor Infinity). */
1253# define RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN(a_pr80) \
1254 RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1255# define RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
1256 ((a_uExponent) == 0x7fff && (a_uMantissa) > RT_BIT_64(63))
1257/** Is @a a_pr80 an unnormal value (invalid operand on 387+). */
1258# define RTFLOAT80U_IS_UNNORMAL(a_pr80) RTFLOAT80U_IS_UNNORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1259# define RTFLOAT80U_IS_UNNORMAL_EX(a_uMantissa, a_uExponent) \
1260 (!((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0 && (a_uExponent) < 0x7fff) /* a_uExponent can be signed and up to 64-bit wide */
1261/** Is @a a_pr80 a normal value (excludes zero). */
1262# define RTFLOAT80U_IS_NORMAL(a_pr80) RTFLOAT80U_IS_NORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1263# define RTFLOAT80U_IS_NORMAL_EX(a_uMantissa, a_uExponent) \
1264 (((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0 && (a_uExponent) < 0x7fff) /* a_uExponent can be signed and up to 64-bit wide */
1265/** Invalid 387 (and later) operands: Pseudo-Infinity, Psuedo-NaN, Unnormals. */
1266#define RTFLOAT80U_IS_387_INVALID(a_pr80) RTFLOAT80U_IS_387_INVALID_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
1267#define RTFLOAT80U_IS_387_INVALID_EX(a_uMantissa, a_uExponent) \
1268 (!((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0)
1269/** @} */
1270
1271
1272/**
1273 * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
1274 * compiler implements long double.
1275 *
1276 * @note On AMD64 systems implementing the System V ABI, this will be 16 bytes!
1277 * The last 6 bytes are unused padding taken up by the long double view.
1278 */
1279# pragma pack(1)
1280typedef union RTFLOAT80U2
1281{
1282 /** Format using bitfields. */
1283 RT_GCC_EXTENSION struct
1284 {
1285# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1286 /** The sign indicator. */
1287 RT_GCC_EXTENSION uint16_t fSign : 1;
1288 /** The exponent (offseted by 16383). */
1289 RT_GCC_EXTENSION uint16_t uExponent : 15;
1290 /** The mantissa. */
1291 uint64_t uMantissa;
1292# else
1293 /** The mantissa. */
1294 uint64_t uMantissa;
1295 /** The exponent (offseted by 16383). */
1296 RT_GCC_EXTENSION uint16_t uExponent : 15;
1297 /** The sign indicator. */
1298 RT_GCC_EXTENSION uint16_t fSign : 1;
1299# endif
1300 } s;
1301
1302 /** Format for accessing it as two separate components. */
1303 RT_GCC_EXTENSION struct
1304 {
1305# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1306 /** The sign bit and exponent. */
1307 uint16_t uSignAndExponent;
1308 /** The mantissa. */
1309 uint64_t uMantissa;
1310# else
1311 /** The mantissa. */
1312 uint64_t uMantissa;
1313 /** The sign bit and exponent. */
1314 uint16_t uSignAndExponent;
1315# endif
1316 } s2;
1317
1318 /** Bitfield exposing the J bit and the fraction. */
1319 RT_GCC_EXTENSION struct
1320 {
1321# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1322 /** The sign indicator. */
1323 RT_GCC_EXTENSION uint16_t fSign : 1;
1324 /** The exponent (offseted by 16383). */
1325 RT_GCC_EXTENSION uint16_t uExponent : 15;
1326 /** The J bit, aka the integer bit. */
1327 uint32_t fInteger : 1;
1328 /** The fraction, bits 32 thru 62. */
1329 uint32_t uFractionHigh : 31;
1330 /** The fraction, bits 0 thru 31. */
1331 uint32_t uFractionLow : 32;
1332# else
1333 /** The fraction, bits 0 thru 31. */
1334 uint32_t uFractionLow : 32;
1335 /** The fraction, bits 32 thru 62. */
1336 uint32_t uFractionHigh : 31;
1337 /** The J bit, aka the integer bit. */
1338 uint32_t fInteger : 1;
1339 /** The exponent (offseted by 16383). */
1340 RT_GCC_EXTENSION uint16_t uExponent : 15;
1341 /** The sign indicator. */
1342 RT_GCC_EXTENSION uint16_t fSign : 1;
1343# endif
1344 } sj;
1345
1346# ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
1347 /** 64-bit bitfields exposing the J bit and the fraction. */
1348 RT_GCC_EXTENSION struct
1349 {
1350# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
1351 /** The sign indicator. */
1352 RT_GCC_EXTENSION uint16_t fSign : 1;
1353 /** The exponent (offseted by 16383). */
1354 RT_GCC_EXTENSION uint16_t uExponent : 15;
1355 /** The J bit, aka the integer bit. */
1356 RT_GCC_EXTENSION uint64_t fInteger : 1;
1357 /** The fraction. */
1358 RT_GCC_EXTENSION uint64_t uFraction : 63;
1359# else
1360 /** The fraction. */
1361 RT_GCC_EXTENSION uint64_t uFraction : 63;
1362 /** The J bit, aka the integer bit. */
1363 RT_GCC_EXTENSION uint64_t fInteger : 1;
1364 /** The exponent (offseted by 16383). */
1365 RT_GCC_EXTENSION uint16_t uExponent : 15;
1366 /** The sign indicator. */
1367 RT_GCC_EXTENSION uint16_t fSign : 1;
1368# endif
1369 } sj64;
1370# endif
1371
1372# ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
1373 /** Long double view. */
1374 long double lrd;
1375# endif
1376 /** 64-bit view. */
1377 uint64_t au64[1];
1378 /** 32-bit view. */
1379 uint32_t au32[2];
1380 /** 16-bit view. */
1381 uint16_t au16[5];
1382 /** 8-bit view. */
1383 uint8_t au8[10];
1384} RTFLOAT80U2;
1385# pragma pack()
1386/** Pointer to a extended precision floating point format union, 2nd
1387 * variant. */
1388typedef RTFLOAT80U2 RT_FAR *PRTFLOAT80U2;
1389/** Pointer to a const extended precision floating point format union, 2nd
1390 * variant. */
1391typedef const RTFLOAT80U2 RT_FAR *PCRTFLOAT80U2;
1392
1393#endif /* uint16_t bitfields doesn't work */
1394
1395
1396/**
1397 * Quadruple precision floating point format (128-bit).
1398 */
1399typedef union RTFLOAT128U
1400{
1401 /** Format using regular bitfields. */
1402 struct
1403 {
1404# ifdef RT_BIG_ENDIAN
1405 /** The sign indicator. */
1406 uint32_t fSign : 1;
1407 /** The exponent (offseted by 16383). */
1408 uint32_t uExponent : 15;
1409 /** The fraction, bits 96 thru 111. */
1410 uint32_t uFractionHigh : 16;
1411 /** The fraction, bits 64 thru 95. */
1412 uint32_t uFractionMid;
1413 /** The fraction, bits 0 thru 63. */
1414 uint64_t uFractionLow;
1415# else
1416 /** The fraction, bits 0 thru 63. */
1417 uint64_t uFractionLow;
1418 /** The fraction, bits 64 thru 95. */
1419 uint32_t uFractionMid;
1420 /** The fraction, bits 96 thru 111. */
1421 uint32_t uFractionHigh : 16;
1422 /** The exponent (offseted by 16383). */
1423 uint32_t uExponent : 15;
1424 /** The sign indicator. */
1425 uint32_t fSign : 1;
1426# endif
1427 } s;
1428
1429 /** Format for accessing it as two separate components. */
1430 struct
1431 {
1432# ifdef RT_BIG_ENDIAN
1433 /** The sign bit and exponent. */
1434 uint16_t uSignAndExponent;
1435 /** The fraction, bits 96 thru 111. */
1436 uint16_t uFractionHigh;
1437 /** The fraction, bits 64 thru 95. */
1438 uint32_t uFractionMid;
1439 /** The fraction, bits 0 thru 63. */
1440 uint64_t uFractionLow;
1441# else
1442 /** The fraction, bits 0 thru 63. */
1443 uint64_t uFractionLow;
1444 /** The fraction, bits 64 thru 95. */
1445 uint32_t uFractionMid;
1446 /** The fraction, bits 96 thru 111. */
1447 uint16_t uFractionHigh;
1448 /** The sign bit and exponent. */
1449 uint16_t uSignAndExponent;
1450# endif
1451 } s2;
1452
1453#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
1454 /** Format using 64-bit bitfields. */
1455 RT_GCC_EXTENSION struct
1456 {
1457# ifdef RT_BIG_ENDIAN
1458 /** The sign indicator. */
1459 RT_GCC_EXTENSION uint64_t fSign : 1;
1460 /** The exponent (offseted by 16383). */
1461 RT_GCC_EXTENSION uint64_t uExponent : 15;
1462 /** The fraction, bits 64 thru 111. */
1463 RT_GCC_EXTENSION uint64_t uFractionHi : 48;
1464 /** The fraction, bits 0 thru 63. */
1465 uint64_t uFractionLo;
1466# else
1467 /** The fraction, bits 0 thru 63. */
1468 uint64_t uFractionLo;
1469 /** The fraction, bits 64 thru 111. */
1470 RT_GCC_EXTENSION uint64_t uFractionHi : 48;
1471 /** The exponent (offseted by 16383). */
1472 RT_GCC_EXTENSION uint64_t uExponent : 15;
1473 /** The sign indicator. */
1474 RT_GCC_EXTENSION uint64_t fSign : 1;
1475# endif
1476 } s64;
1477#endif
1478
1479#ifdef RT_COMPILER_WITH_128BIT_LONG_DOUBLE
1480 /** Long double view. */
1481 long double lrd;
1482#endif
1483 /** 128-bit view. */
1484 RTUINT128U u128;
1485 /** 64-bit view. */
1486 uint64_t au64[2];
1487 /** 32-bit view. */
1488 uint32_t au32[4];
1489 /** 16-bit view. */
1490 uint16_t au16[8];
1491 /** 8-bit view. */
1492 uint8_t au8[16];
1493} RTFLOAT128U;
1494/** Pointer to a quadruple precision floating point format union. */
1495typedef RTFLOAT128U RT_FAR *PRTFLOAT128U;
1496/** Pointer to a const quadruple precision floating point format union. */
1497typedef const RTFLOAT128U RT_FAR *PCRTFLOAT128U;
1498/** RTFLOAT128U initializer. */
1499#ifdef RT_BIG_ENDIAN
1500# define RTFLOAT128U_INIT(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
1501 { { (a_fSign), (a_uExponent), (uint32_t)((a_uFractionHi) >> 32), (uint32_t)((a_uFractionHi) & UINT32_MAX), (a_uFractionLo) } }
1502#else
1503# define RTFLOAT128U_INIT(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
1504 { { (a_uFractionLo), (uint32_t)((a_uFractionHi) & UINT32_MAX), (uint32_t)((a_uFractionHi) >> 32), (a_uExponent), (a_fSign) } }
1505#endif
1506#define RTFLOAT128U_INIT_C(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
1507 RTFLOAT128U_INIT((a_fSign), UINT64_C(a_uFractionHi), UINT64_C(a_uFractionLo), (a_uExponent))
1508/** The exponent bias for the RTFLOAT128U format. */
1509#define RTFLOAT128U_EXP_BIAS (16383)
1510/** The max exponent value for the RTFLOAT128U format. */
1511#define RTFLOAT128U_EXP_MAX (32767)
1512/** The exponent bias overflow/underflow adjust for the RTFLOAT128U format.
1513 * @note This is stipulated based on RTFLOAT80U, it doesn't appear in any
1514 * standard text as far as we know. */
1515#define RTFLOAT128U_EXP_BIAS_ADJUST (24576)
1516/** Fraction width (in bits) for the RTFLOAT128U format. */
1517#define RTFLOAT128U_FRACTION_BITS (112)
1518/** Check if two 128-bit floating values are identical (memcmp, not
1519 * numerically). */
1520#define RTFLOAT128U_ARE_IDENTICAL(a_pLeft, a_pRight) \
1521 ( (a_pLeft)->au64[0] == (a_pRight)->au64[0] && (a_pLeft)->au64[1] == (a_pRight)->au64[1] )
1522/** @name RTFLOAT128U classification macros
1523 * @{ */
1524#define RTFLOAT128U_IS_ZERO(a_pr128) ( (a_pr128)->u128.s.Lo == 0 \
1525 && ((a_pr128)->u128.s.Hi & (RT_BIT_64(63) - 1)) == 0)
1526#define RTFLOAT128U_IS_SUBNORMAL(a_pr128) ( (a_pr128)->s.uExponent == 0 \
1527 && ( (a_pr128)->s.uFractionLow != 0 \
1528 || (a_pr128)->s.uFractionMid != 0 \
1529 || (a_pr128)->s.uFractionHigh != 0 ) )
1530#define RTFLOAT128U_IS_INF(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
1531 && (a_pr128)->s.uFractionHigh == 0 \
1532 && (a_pr128)->s.uFractionMid == 0 \
1533 && (a_pr128)->s.uFractionLow == 0 )
1534#define RTFLOAT128U_IS_SIGNALLING_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
1535 && !((a_pr128)->s.uFractionHigh & RT_BIT_32(15)) \
1536 && ( (a_pr128)->s.uFractionHigh != 0 \
1537 || (a_pr128)->s.uFractionMid != 0 \
1538 || (a_pr128)->s.uFractionLow != 0) )
1539#define RTFLOAT128U_IS_QUIET_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
1540 && ((a_pr128)->s.uFractionHigh & RT_BIT_32(15)))
1541#define RTFLOAT128U_IS_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
1542 && ( (a_pr128)->s.uFractionLow != 0 \
1543 || (a_pr128)->s.uFractionMid != 0 \
1544 || (a_pr128)->s.uFractionHigh != 0) )
1545#define RTFLOAT128U_IS_NORMAL(a_pr128) ((a_pr128)->s.uExponent > 0 && (a_pr128)->s.uExponent < RTFLOAT128U_EXP_MAX)
1546/** @} */
1547
1548
1549/**
1550 * Packed BCD 18-digit signed integer format (80-bit).
1551 */
1552#pragma pack(1)
1553typedef union RTPBCD80U
1554{
1555 /** Format using bitfields. */
1556 RT_GCC_EXTENSION struct
1557 {
1558 /** 18 packed BCD digits, two to a byte. */
1559 uint8_t abPairs[9];
1560 /** Padding, non-zero if indefinite. */
1561 RT_GCC_EXTENSION uint8_t uPad : 7;
1562 /** The sign indicator. */
1563 RT_GCC_EXTENSION uint8_t fSign : 1;
1564 } s;
1565
1566 /** 64-bit view. */
1567 uint64_t au64[1];
1568 /** 32-bit view. */
1569 uint32_t au32[2];
1570 /** 16-bit view. */
1571 uint16_t au16[5];
1572 /** 8-bit view. */
1573 uint8_t au8[10];
1574} RTPBCD80U;
1575#pragma pack()
1576/** Pointer to a packed BCD integer format union. */
1577typedef RTPBCD80U RT_FAR *PRTPBCD80U;
1578/** Pointer to a const packed BCD integer format union. */
1579typedef const RTPBCD80U RT_FAR *PCRTPBCD80U;
1580/** RTPBCD80U initializer. */
1581#define RTPBCD80U_INIT_C(a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
1582 a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0) \
1583 RTPBCD80U_INIT_EX_C(0, a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
1584 a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0)
1585/** Extended RTPBCD80U initializer. */
1586#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, \
1587 a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0) \
1588 { { { RTPBCD80U_MAKE_PAIR(a_D1, a_D0), \
1589 RTPBCD80U_MAKE_PAIR(a_D3, a_D2), \
1590 RTPBCD80U_MAKE_PAIR(a_D5, a_D4), \
1591 RTPBCD80U_MAKE_PAIR(a_D7, a_D6), \
1592 RTPBCD80U_MAKE_PAIR(a_D9, a_D8), \
1593 RTPBCD80U_MAKE_PAIR(a_D11, a_D10), \
1594 RTPBCD80U_MAKE_PAIR(a_D13, a_D12), \
1595 RTPBCD80U_MAKE_PAIR(a_D15, a_D14), \
1596 RTPBCD80U_MAKE_PAIR(a_D17, a_D16), }, (a_uPad), (a_fSign) } }
1597/** RTPBCD80U initializer for the zero value. */
1598#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)
1599/** RTPBCD80U initializer for the indefinite value. */
1600#define RTPBCD80U_INIT_INDEFINITE() RTPBCD80U_INIT_EX_C(0x7f,1, 0xf,0xf, 0xc,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0)
1601/** RTPBCD80U initializer for the minimum value. */
1602#define RTPBCD80U_INIT_MIN() RTPBCD80U_INIT_C(1, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9)
1603/** RTPBCD80U initializer for the maximum value. */
1604#define RTPBCD80U_INIT_MAX() RTPBCD80U_INIT_C(0, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9)
1605/** RTPBCD80U minimum value. */
1606#define RTPBCD80U_MIN INT64_C(-999999999999999999)
1607/** RTPBCD80U maximum value. */
1608#define RTPBCD80U_MAX INT64_C(999999999999999999)
1609/** Makes a packs a pair of BCD digits. */
1610#define RTPBCD80U_MAKE_PAIR(a_D1, a_D0) ((a_D0) | ((a_D1) << 4))
1611/** Retrieves the lower digit of a BCD digit pair. */
1612#define RTPBCD80U_LO_DIGIT(a_bPair) ((a_bPair) & 0xf)
1613/** Retrieves the higher digit of a BCD digit pair. */
1614#define RTPBCD80U_HI_DIGIT(a_bPair) ((a_bPair) >> 4)
1615/** Checks if the packaged BCD number is representing indefinite. */
1616#define RTPBCD80U_IS_INDEFINITE(a_pd80) \
1617 ( (a_pd80)->s.uPad == 0x7f \
1618 && (a_pd80)->s.fSign == 1 \
1619 && (a_pd80)->s.abPairs[8] == 0xff \
1620 && (a_pd80)->s.abPairs[7] == RTPBCD80U_MAKE_PAIR(0xc, 0) \
1621 && (a_pd80)->s.abPairs[6] == 0 \
1622 && (a_pd80)->s.abPairs[5] == 0 \
1623 && (a_pd80)->s.abPairs[4] == 0 \
1624 && (a_pd80)->s.abPairs[3] == 0 \
1625 && (a_pd80)->s.abPairs[2] == 0 \
1626 && (a_pd80)->s.abPairs[1] == 0 \
1627 && (a_pd80)->s.abPairs[0] == 0)
1628/** Check if @a a_pd80Left and @a a_pd80Right are exactly the same. */
1629#define RTPBCD80U_ARE_IDENTICAL(a_pd80Left, a_pd80Right) \
1630 ( (a_pd80Left)->au64[0] == (a_pd80Right)->au64[0] && (a_pd80Left)->au16[4] == (a_pd80Right)->au16[4] )
1631
1632
1633/** Generic function type.
1634 * @see PFNRT
1635 */
1636typedef DECLCALLBACKTYPE(void, FNRT,(void));
1637
1638/** Generic function pointer.
1639 * With -pedantic, gcc-4 complains when casting a function to a data object, for
1640 * example:
1641 *
1642 * @code
1643 * void foo(void)
1644 * {
1645 * }
1646 *
1647 * void *bar = (void *)foo;
1648 * @endcode
1649 *
1650 * The compiler would warn with "ISO C++ forbids casting between
1651 * pointer-to-function and pointer-to-object". The purpose of this warning is
1652 * not to bother the programmer but to point out that he is probably doing
1653 * something dangerous, assigning a pointer to executable code to a data object.
1654 */
1655typedef FNRT *PFNRT;
1656
1657/** Variant on PFNRT that takes one pointer argument. */
1658typedef DECLCALLBACKTYPE(void, FNRT1,(void *pvArg));
1659/** Pointer to FNRT1. */
1660typedef FNRT1 *PFNRT1;
1661
1662/** Millisecond interval. */
1663typedef uint32_t RTMSINTERVAL;
1664/** Pointer to a millisecond interval. */
1665typedef RTMSINTERVAL RT_FAR *PRTMSINTERVAL;
1666/** Pointer to a const millisecond interval. */
1667typedef const RTMSINTERVAL RT_FAR *PCRTMSINTERVAL;
1668
1669/** Pointer to a time spec structure. */
1670typedef struct RTTIMESPEC RT_FAR *PRTTIMESPEC;
1671/** Pointer to a const time spec structure. */
1672typedef const struct RTTIMESPEC RT_FAR *PCRTTIMESPEC;
1673
1674
1675
1676/** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
1677 * @{
1678 */
1679
1680/** Signed integer which can contain both GC and HC pointers. */
1681#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1682typedef int32_t RTINTPTR;
1683#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1684typedef int64_t RTINTPTR;
1685#else
1686# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1687#endif
1688/** Pointer to signed integer which can contain both GC and HC pointers. */
1689typedef RTINTPTR RT_FAR *PRTINTPTR;
1690/** Pointer const to signed integer which can contain both GC and HC pointers. */
1691typedef const RTINTPTR RT_FAR *PCRTINTPTR;
1692/** The maximum value the RTINTPTR type can hold. */
1693#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1694# define RTINTPTR_MAX INT32_MAX
1695#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1696# define RTINTPTR_MAX INT64_MAX
1697#else
1698# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1699#endif
1700/** The minimum value the RTINTPTR type can hold. */
1701#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1702# define RTINTPTR_MIN INT32_MIN
1703#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1704# define RTINTPTR_MIN INT64_MIN
1705#else
1706# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1707#endif
1708
1709/** Unsigned integer which can contain both GC and HC pointers. */
1710#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1711typedef uint32_t RTUINTPTR;
1712#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1713typedef uint64_t RTUINTPTR;
1714#else
1715# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1716#endif
1717/** Pointer to unsigned integer which can contain both GC and HC pointers. */
1718typedef RTUINTPTR RT_FAR *PRTUINTPTR;
1719/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
1720typedef const RTUINTPTR RT_FAR *PCRTUINTPTR;
1721/** The maximum value the RTUINTPTR type can hold. */
1722#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
1723# define RTUINTPTR_MAX UINT32_MAX
1724#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
1725# define RTUINTPTR_MAX UINT64_MAX
1726#else
1727# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
1728#endif
1729
1730/** Signed integer. */
1731typedef int32_t RTINT;
1732/** Pointer to signed integer. */
1733typedef RTINT RT_FAR *PRTINT;
1734/** Pointer to const signed integer. */
1735typedef const RTINT RT_FAR *PCRTINT;
1736
1737/** Unsigned integer. */
1738typedef uint32_t RTUINT;
1739/** Pointer to unsigned integer. */
1740typedef RTUINT RT_FAR *PRTUINT;
1741/** Pointer to const unsigned integer. */
1742typedef const RTUINT RT_FAR *PCRTUINT;
1743
1744/** A file offset / size (off_t). */
1745typedef int64_t RTFOFF;
1746/** Pointer to a file offset / size. */
1747typedef RTFOFF RT_FAR *PRTFOFF;
1748/** The max value for RTFOFF. */
1749#define RTFOFF_MAX INT64_MAX
1750/** The min value for RTFOFF. */
1751#define RTFOFF_MIN INT64_MIN
1752
1753/** File mode (see iprt/fs.h). */
1754typedef uint32_t RTFMODE;
1755/** Pointer to file mode. */
1756typedef RTFMODE RT_FAR *PRTFMODE;
1757
1758/** Device unix number. */
1759typedef uint32_t RTDEV;
1760/** Pointer to a device unix number. */
1761typedef RTDEV RT_FAR *PRTDEV;
1762
1763/** @name RTDEV Macros
1764 * @{ */
1765/**
1766 * Our makedev macro.
1767 * @returns RTDEV
1768 * @param uMajor The major device number.
1769 * @param uMinor The minor device number.
1770 */
1771#define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
1772/**
1773 * Get the major device node number from an RTDEV type.
1774 * @returns The major device number of @a uDev
1775 * @param uDev The device number.
1776 */
1777#define RTDEV_MAJOR(uDev) ((uDev) >> 24)
1778/**
1779 * Get the minor device node number from an RTDEV type.
1780 * @returns The minor device number of @a uDev
1781 * @param uDev The device number.
1782 */
1783#define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
1784/** @} */
1785
1786/** i-node number. */
1787typedef uint64_t RTINODE;
1788/** Pointer to a i-node number. */
1789typedef RTINODE RT_FAR *PRTINODE;
1790
1791/** User id. */
1792typedef uint32_t RTUID;
1793/** Pointer to a user id. */
1794typedef RTUID RT_FAR *PRTUID;
1795/** NIL user id.
1796 * @todo check this for portability! */
1797#define NIL_RTUID (~(RTUID)0)
1798
1799/** Group id. */
1800typedef uint32_t RTGID;
1801/** Pointer to a group id. */
1802typedef RTGID RT_FAR *PRTGID;
1803/** NIL group id.
1804 * @todo check this for portability! */
1805#define NIL_RTGID (~(RTGID)0)
1806
1807/** I/O Port. */
1808typedef uint16_t RTIOPORT;
1809/** Pointer to I/O Port. */
1810typedef RTIOPORT RT_FAR *PRTIOPORT;
1811/** Pointer to const I/O Port. */
1812typedef const RTIOPORT RT_FAR *PCRTIOPORT;
1813
1814/** Selector. */
1815typedef uint16_t RTSEL;
1816/** Pointer to selector. */
1817typedef RTSEL RT_FAR *PRTSEL;
1818/** Pointer to const selector. */
1819typedef const RTSEL RT_FAR *PCRTSEL;
1820/** Max selector value. */
1821#define RTSEL_MAX UINT16_MAX
1822
1823/** Far 16-bit pointer. */
1824#pragma pack(1)
1825typedef struct RTFAR16
1826{
1827 uint16_t off;
1828 RTSEL sel;
1829} RTFAR16;
1830#pragma pack()
1831/** Pointer to Far 16-bit pointer. */
1832typedef RTFAR16 RT_FAR *PRTFAR16;
1833/** Pointer to const Far 16-bit pointer. */
1834typedef const RTFAR16 RT_FAR *PCRTFAR16;
1835
1836/** Far 32-bit pointer. */
1837#pragma pack(1)
1838typedef struct RTFAR32
1839{
1840 uint32_t off;
1841 RTSEL sel;
1842} RTFAR32;
1843#pragma pack()
1844/** Pointer to Far 32-bit pointer. */
1845typedef RTFAR32 RT_FAR *PRTFAR32;
1846/** Pointer to const Far 32-bit pointer. */
1847typedef const RTFAR32 RT_FAR *PCRTFAR32;
1848
1849/** Far 64-bit pointer. */
1850#pragma pack(1)
1851typedef struct RTFAR64
1852{
1853 uint64_t off;
1854 RTSEL sel;
1855} RTFAR64;
1856#pragma pack()
1857/** Pointer to Far 64-bit pointer. */
1858typedef RTFAR64 RT_FAR *PRTFAR64;
1859/** Pointer to const Far 64-bit pointer. */
1860typedef const RTFAR64 RT_FAR *PCRTFAR64;
1861
1862/** @} */
1863
1864
1865/** @defgroup grp_rt_types_hc Host Context Basic Types
1866 * @{
1867 */
1868
1869/** HC Natural signed integer.
1870 * @deprecated silly type. */
1871typedef int32_t RTHCINT;
1872/** Pointer to HC Natural signed integer.
1873 * @deprecated silly type. */
1874typedef RTHCINT RT_FAR *PRTHCINT;
1875/** Pointer to const HC Natural signed integer.
1876 * @deprecated silly type. */
1877typedef const RTHCINT RT_FAR *PCRTHCINT;
1878
1879/** HC Natural unsigned integer.
1880 * @deprecated silly type. */
1881typedef uint32_t RTHCUINT;
1882/** Pointer to HC Natural unsigned integer.
1883 * @deprecated silly type. */
1884typedef RTHCUINT RT_FAR *PRTHCUINT;
1885/** Pointer to const HC Natural unsigned integer.
1886 * @deprecated silly type. */
1887typedef const RTHCUINT RT_FAR *PCRTHCUINT;
1888
1889
1890/** Signed integer which can contain a HC pointer. */
1891#if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
1892typedef int32_t RTHCINTPTR;
1893#elif HC_ARCH_BITS == 64
1894typedef int64_t RTHCINTPTR;
1895#else
1896# error Unsupported HC_ARCH_BITS value.
1897#endif
1898/** Pointer to signed integer which can contain a HC pointer. */
1899typedef RTHCINTPTR RT_FAR *PRTHCINTPTR;
1900/** Pointer to const signed integer which can contain a HC pointer. */
1901typedef const RTHCINTPTR RT_FAR *PCRTHCINTPTR;
1902/** Max RTHCINTPTR value. */
1903#if HC_ARCH_BITS == 32
1904# define RTHCINTPTR_MAX INT32_MAX
1905#elif HC_ARCH_BITS == 64
1906# define RTHCINTPTR_MAX INT64_MAX
1907#else
1908# define RTHCINTPTR_MAX INT16_MAX
1909#endif
1910/** Min RTHCINTPTR value. */
1911#if HC_ARCH_BITS == 32
1912# define RTHCINTPTR_MIN INT32_MIN
1913#elif HC_ARCH_BITS == 64
1914# define RTHCINTPTR_MIN INT64_MIN
1915#else
1916# define RTHCINTPTR_MIN INT16_MIN
1917#endif
1918
1919/** Signed integer which can contain a HC ring-3 pointer. */
1920#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1921typedef int32_t RTR3INTPTR;
1922#elif R3_ARCH_BITS == 64
1923typedef int64_t RTR3INTPTR;
1924#else
1925# error Unsupported R3_ARCH_BITS value.
1926#endif
1927/** Pointer to signed integer which can contain a HC ring-3 pointer. */
1928typedef RTR3INTPTR RT_FAR *PRTR3INTPTR;
1929/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
1930typedef const RTR3INTPTR RT_FAR *PCRTR3INTPTR;
1931/** Max RTR3INTPTR value. */
1932#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1933# define RTR3INTPTR_MAX INT32_MAX
1934#else
1935# define RTR3INTPTR_MAX INT64_MAX
1936#endif
1937/** Min RTR3INTPTR value. */
1938#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1939# define RTR3INTPTR_MIN INT32_MIN
1940#else
1941# define RTR3INTPTR_MIN INT64_MIN
1942#endif
1943
1944/** Signed integer which can contain a HC ring-0 pointer. */
1945#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1946typedef int32_t RTR0INTPTR;
1947#elif R0_ARCH_BITS == 64
1948typedef int64_t RTR0INTPTR;
1949#else
1950# error Unsupported R0_ARCH_BITS value.
1951#endif
1952/** Pointer to signed integer which can contain a HC ring-0 pointer. */
1953typedef RTR0INTPTR RT_FAR *PRTR0INTPTR;
1954/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
1955typedef const RTR0INTPTR RT_FAR *PCRTR0INTPTR;
1956/** Max RTR0INTPTR value. */
1957#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1958# define RTR0INTPTR_MAX INT32_MAX
1959#else
1960# define RTR0INTPTR_MAX INT64_MAX
1961#endif
1962/** Min RTHCINTPTR value. */
1963#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
1964# define RTR0INTPTR_MIN INT32_MIN
1965#else
1966# define RTR0INTPTR_MIN INT64_MIN
1967#endif
1968
1969
1970/** Unsigned integer which can contain a HC pointer. */
1971#if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
1972typedef uint32_t RTHCUINTPTR;
1973#elif HC_ARCH_BITS == 64
1974typedef uint64_t RTHCUINTPTR;
1975#else
1976# error Unsupported HC_ARCH_BITS value.
1977#endif
1978/** Pointer to unsigned integer which can contain a HC pointer. */
1979typedef RTHCUINTPTR RT_FAR *PRTHCUINTPTR;
1980/** Pointer to unsigned integer which can contain a HC pointer. */
1981typedef const RTHCUINTPTR RT_FAR *PCRTHCUINTPTR;
1982/** Max RTHCUINTTPR value. */
1983#if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
1984# define RTHCUINTPTR_MAX UINT32_MAX
1985#else
1986# define RTHCUINTPTR_MAX UINT64_MAX
1987#endif
1988
1989/** Unsigned integer which can contain a HC ring-3 pointer. */
1990#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
1991typedef uint32_t RTR3UINTPTR;
1992#elif R3_ARCH_BITS == 64
1993typedef uint64_t RTR3UINTPTR;
1994#else
1995# error Unsupported R3_ARCH_BITS value.
1996#endif
1997/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
1998typedef RTR3UINTPTR RT_FAR *PRTR3UINTPTR;
1999/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
2000typedef const RTR3UINTPTR RT_FAR *PCRTR3UINTPTR;
2001/** Max RTHCUINTTPR value. */
2002#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
2003# define RTR3UINTPTR_MAX UINT32_MAX
2004#else
2005# define RTR3UINTPTR_MAX UINT64_MAX
2006#endif
2007
2008/** Unsigned integer which can contain a HC ring-0 pointer. */
2009#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
2010typedef uint32_t RTR0UINTPTR;
2011#elif R0_ARCH_BITS == 64
2012typedef uint64_t RTR0UINTPTR;
2013#else
2014# error Unsupported R0_ARCH_BITS value.
2015#endif
2016/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
2017typedef RTR0UINTPTR RT_FAR *PRTR0UINTPTR;
2018/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
2019typedef const RTR0UINTPTR RT_FAR *PCRTR0UINTPTR;
2020/** Max RTR0UINTTPR value. */
2021#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
2022# define RTR0UINTPTR_MAX UINT32_MAX
2023#else
2024# define RTR0UINTPTR_MAX UINT64_MAX
2025#endif
2026
2027
2028/** Host Physical Memory Address. */
2029typedef uint64_t RTHCPHYS;
2030/** Pointer to Host Physical Memory Address. */
2031typedef RTHCPHYS RT_FAR *PRTHCPHYS;
2032/** Pointer to const Host Physical Memory Address. */
2033typedef const RTHCPHYS RT_FAR *PCRTHCPHYS;
2034/** @def NIL_RTHCPHYS
2035 * NIL HC Physical Address.
2036 * NIL_RTHCPHYS is used to signal an invalid physical address, similar
2037 * to the NULL pointer.
2038 */
2039#define NIL_RTHCPHYS (~(RTHCPHYS)0)
2040/** Max RTHCPHYS value. */
2041#define RTHCPHYS_MAX UINT64_MAX
2042
2043
2044/** HC pointer. */
2045#if !defined(IN_RC) || defined(DOXYGEN_RUNNING)
2046typedef void RT_FAR *RTHCPTR;
2047#else
2048typedef RTHCUINTPTR RTHCPTR;
2049#endif
2050/** Pointer to HC pointer. */
2051typedef RTHCPTR RT_FAR *PRTHCPTR;
2052/** Pointer to const HC pointer. */
2053typedef const RTHCPTR *PCRTHCPTR;
2054/** @def NIL_RTHCPTR
2055 * NIL HC pointer.
2056 */
2057#define NIL_RTHCPTR ((RTHCPTR)0)
2058/** Max RTHCPTR value. */
2059#define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
2060
2061
2062/** HC ring-3 pointer. */
2063#ifdef IN_RING3
2064typedef void RT_FAR *RTR3PTR;
2065#else
2066typedef RTR3UINTPTR RTR3PTR;
2067#endif
2068/** Pointer to HC ring-3 pointer. */
2069typedef RTR3PTR RT_FAR *PRTR3PTR;
2070/** Pointer to const HC ring-3 pointer. */
2071typedef const RTR3PTR *PCRTR3PTR;
2072/** @def NIL_RTR3PTR
2073 * NIL HC ring-3 pointer.
2074 */
2075#ifndef IN_RING3
2076# define NIL_RTR3PTR ((RTR3PTR)0)
2077#else
2078# define NIL_RTR3PTR (NULL)
2079#endif
2080/** Max RTR3PTR value. */
2081#define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
2082
2083/** HC ring-0 pointer. */
2084#ifdef IN_RING0
2085typedef void RT_FAR *RTR0PTR;
2086#else
2087typedef RTR0UINTPTR RTR0PTR;
2088#endif
2089/** Pointer to HC ring-0 pointer. */
2090typedef RTR0PTR RT_FAR *PRTR0PTR;
2091/** Pointer to const HC ring-0 pointer. */
2092typedef const RTR0PTR *PCRTR0PTR;
2093/** @def NIL_RTR0PTR
2094 * NIL HC ring-0 pointer.
2095 */
2096#ifndef IN_RING0
2097# define NIL_RTR0PTR ((RTR0PTR)0)
2098#else
2099# define NIL_RTR0PTR (NULL)
2100#endif
2101/** Max RTR3PTR value. */
2102#define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
2103
2104
2105/** Unsigned integer register in the host context. */
2106#if HC_ARCH_BITS == 32
2107typedef uint32_t RTHCUINTREG;
2108#elif HC_ARCH_BITS == 64
2109typedef uint64_t RTHCUINTREG;
2110#elif HC_ARCH_BITS == 16
2111typedef uint16_t RTHCUINTREG;
2112#else
2113# error "Unsupported HC_ARCH_BITS!"
2114#endif
2115/** Pointer to an unsigned integer register in the host context. */
2116typedef RTHCUINTREG RT_FAR *PRTHCUINTREG;
2117/** Pointer to a const unsigned integer register in the host context. */
2118typedef const RTHCUINTREG RT_FAR *PCRTHCUINTREG;
2119
2120/** Unsigned integer register in the host ring-3 context. */
2121#if R3_ARCH_BITS == 32
2122typedef uint32_t RTR3UINTREG;
2123#elif R3_ARCH_BITS == 64
2124typedef uint64_t RTR3UINTREG;
2125#elif R3_ARCH_BITS == 16
2126typedef uint16_t RTR3UINTREG;
2127#else
2128# error "Unsupported R3_ARCH_BITS!"
2129#endif
2130/** Pointer to an unsigned integer register in the host ring-3 context. */
2131typedef RTR3UINTREG RT_FAR *PRTR3UINTREG;
2132/** Pointer to a const unsigned integer register in the host ring-3 context. */
2133typedef const RTR3UINTREG RT_FAR *PCRTR3UINTREG;
2134
2135/** Unsigned integer register in the host ring-3 context. */
2136#if R0_ARCH_BITS == 32
2137typedef uint32_t RTR0UINTREG;
2138#elif R0_ARCH_BITS == 64
2139typedef uint64_t RTR0UINTREG;
2140#elif R0_ARCH_BITS == 16
2141typedef uint16_t RTR0UINTREG;
2142#else
2143# error "Unsupported R3_ARCH_BITS!"
2144#endif
2145/** Pointer to an unsigned integer register in the host ring-3 context. */
2146typedef RTR0UINTREG RT_FAR *PRTR0UINTREG;
2147/** Pointer to a const unsigned integer register in the host ring-3 context. */
2148typedef const RTR0UINTREG RT_FAR *PCRTR0UINTREG;
2149
2150/** @} */
2151
2152
2153/** @defgroup grp_rt_types_gc Guest Context Basic Types
2154 * @{
2155 */
2156
2157/** Natural signed integer in the GC.
2158 * @deprecated silly type. */
2159#if GC_ARCH_BITS == 32
2160typedef int32_t RTGCINT;
2161#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
2162typedef int64_t RTGCINT;
2163#endif
2164/** Pointer to natural signed integer in GC.
2165 * @deprecated silly type. */
2166typedef RTGCINT RT_FAR *PRTGCINT;
2167/** Pointer to const natural signed integer in GC.
2168 * @deprecated silly type. */
2169typedef const RTGCINT RT_FAR *PCRTGCINT;
2170
2171/** Natural unsigned integer in the GC.
2172 * @deprecated silly type. */
2173#if GC_ARCH_BITS == 32
2174typedef uint32_t RTGCUINT;
2175#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
2176typedef uint64_t RTGCUINT;
2177#endif
2178/** Pointer to natural unsigned integer in GC.
2179 * @deprecated silly type. */
2180typedef RTGCUINT RT_FAR *PRTGCUINT;
2181/** Pointer to const natural unsigned integer in GC.
2182 * @deprecated silly type. */
2183typedef const RTGCUINT RT_FAR *PCRTGCUINT;
2184
2185/** Signed integer which can contain a GC pointer. */
2186#if GC_ARCH_BITS == 32
2187typedef int32_t RTGCINTPTR;
2188#elif GC_ARCH_BITS == 64
2189typedef int64_t RTGCINTPTR;
2190#endif
2191/** Pointer to signed integer which can contain a GC pointer. */
2192typedef RTGCINTPTR RT_FAR *PRTGCINTPTR;
2193/** Pointer to const signed integer which can contain a GC pointer. */
2194typedef const RTGCINTPTR RT_FAR *PCRTGCINTPTR;
2195
2196/** Unsigned integer which can contain a GC pointer. */
2197#if GC_ARCH_BITS == 32
2198typedef uint32_t RTGCUINTPTR;
2199#elif GC_ARCH_BITS == 64
2200typedef uint64_t RTGCUINTPTR;
2201#else
2202# error Unsupported GC_ARCH_BITS value.
2203#endif
2204/** Pointer to unsigned integer which can contain a GC pointer. */
2205typedef RTGCUINTPTR RT_FAR *PRTGCUINTPTR;
2206/** Pointer to unsigned integer which can contain a GC pointer. */
2207typedef const RTGCUINTPTR RT_FAR *PCRTGCUINTPTR;
2208
2209/** Unsigned integer which can contain a 32 bits GC pointer. */
2210typedef uint32_t RTGCUINTPTR32;
2211/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
2212typedef RTGCUINTPTR32 RT_FAR *PRTGCUINTPTR32;
2213/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
2214typedef const RTGCUINTPTR32 RT_FAR *PCRTGCUINTPTR32;
2215
2216/** Unsigned integer which can contain a 64 bits GC pointer. */
2217typedef uint64_t RTGCUINTPTR64;
2218/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
2219typedef RTGCUINTPTR64 RT_FAR *PRTGCUINTPTR64;
2220/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
2221typedef const RTGCUINTPTR64 RT_FAR *PCRTGCUINTPTR64;
2222
2223/** Guest Physical Memory Address.*/
2224typedef uint64_t RTGCPHYS;
2225/** Pointer to Guest Physical Memory Address. */
2226typedef RTGCPHYS RT_FAR *PRTGCPHYS;
2227/** Pointer to const Guest Physical Memory Address. */
2228typedef const RTGCPHYS RT_FAR *PCRTGCPHYS;
2229/** @def NIL_RTGCPHYS
2230 * NIL GC Physical Address.
2231 * NIL_RTGCPHYS is used to signal an invalid physical address, similar
2232 * to the NULL pointer. Note that this value may actually be valid in
2233 * some contexts.
2234 */
2235#define NIL_RTGCPHYS (~(RTGCPHYS)0U)
2236/** Max guest physical memory address value. */
2237#define RTGCPHYS_MAX UINT64_MAX
2238
2239
2240/** Guest Physical Memory Address; limited to 32 bits.*/
2241typedef uint32_t RTGCPHYS32;
2242/** Pointer to Guest Physical Memory Address. */
2243typedef RTGCPHYS32 RT_FAR *PRTGCPHYS32;
2244/** Pointer to const Guest Physical Memory Address. */
2245typedef const RTGCPHYS32 RT_FAR *PCRTGCPHYS32;
2246/** @def NIL_RTGCPHYS32
2247 * NIL GC Physical Address.
2248 * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
2249 * to the NULL pointer. Note that this value may actually be valid in
2250 * some contexts.
2251 */
2252#define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
2253
2254
2255/** Guest Physical Memory Address; limited to 64 bits.*/
2256typedef uint64_t RTGCPHYS64;
2257/** Pointer to Guest Physical Memory Address. */
2258typedef RTGCPHYS64 RT_FAR *PRTGCPHYS64;
2259/** Pointer to const Guest Physical Memory Address. */
2260typedef const RTGCPHYS64 RT_FAR *PCRTGCPHYS64;
2261/** @def NIL_RTGCPHYS64
2262 * NIL GC Physical Address.
2263 * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
2264 * to the NULL pointer. Note that this value may actually be valid in
2265 * some contexts.
2266 */
2267#define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
2268
2269/** Guest context pointer, 32 bits.
2270 * Keep in mind that this type is an unsigned integer in
2271 * HC and void pointer in GC.
2272 */
2273typedef RTGCUINTPTR32 RTGCPTR32;
2274/** Pointer to a guest context pointer. */
2275typedef RTGCPTR32 RT_FAR *PRTGCPTR32;
2276/** Pointer to a const guest context pointer. */
2277typedef const RTGCPTR32 RT_FAR *PCRTGCPTR32;
2278/** @def NIL_RTGCPTR32
2279 * NIL GC pointer.
2280 */
2281#define NIL_RTGCPTR32 ((RTGCPTR32)0)
2282
2283/** Guest context pointer, 64 bits.
2284 */
2285typedef RTGCUINTPTR64 RTGCPTR64;
2286/** Pointer to a guest context pointer. */
2287typedef RTGCPTR64 RT_FAR *PRTGCPTR64;
2288/** Pointer to a const guest context pointer. */
2289typedef const RTGCPTR64 RT_FAR *PCRTGCPTR64;
2290/** @def NIL_RTGCPTR64
2291 * NIL GC pointer.
2292 */
2293#define NIL_RTGCPTR64 ((RTGCPTR64)0)
2294
2295/** @typedef RTGCPTR
2296 * Guest context pointer.
2297 * Keep in mind that this type is an unsigned integer in HC and void pointer in GC. */
2298/** @typedef PRTGCPTR
2299 * Pointer to a guest context pointer. */
2300/** @typedef PCRTGCPTR
2301 * Pointer to a const guest context pointer. */
2302/** @def NIL_RTGCPTR
2303 * NIL GC pointer. */
2304/** @def RTGCPTR_MAX
2305 * Max RTGCPTR value. */
2306#if GC_ARCH_BITS == 64 || defined(DOXYGEN_RUNNING)
2307typedef RTGCPTR64 RTGCPTR;
2308typedef PRTGCPTR64 PRTGCPTR;
2309typedef PCRTGCPTR64 PCRTGCPTR;
2310# define NIL_RTGCPTR NIL_RTGCPTR64
2311# define RTGCPTR_MAX UINT64_MAX
2312#elif GC_ARCH_BITS == 32
2313typedef RTGCPTR32 RTGCPTR;
2314typedef PRTGCPTR32 PRTGCPTR;
2315typedef PCRTGCPTR32 PCRTGCPTR;
2316# define NIL_RTGCPTR NIL_RTGCPTR32
2317# define RTGCPTR_MAX UINT32_MAX
2318#else
2319# error "Unsupported GC_ARCH_BITS!"
2320#endif
2321
2322/** Unsigned integer register in the guest context. */
2323typedef uint32_t RTGCUINTREG32;
2324/** Pointer to an unsigned integer register in the guest context. */
2325typedef RTGCUINTREG32 RT_FAR *PRTGCUINTREG32;
2326/** Pointer to a const unsigned integer register in the guest context. */
2327typedef const RTGCUINTREG32 RT_FAR *PCRTGCUINTREG32;
2328
2329typedef uint64_t RTGCUINTREG64;
2330/** Pointer to an unsigned integer register in the guest context. */
2331typedef RTGCUINTREG64 RT_FAR *PRTGCUINTREG64;
2332/** Pointer to a const unsigned integer register in the guest context. */
2333typedef const RTGCUINTREG64 RT_FAR *PCRTGCUINTREG64;
2334
2335#if GC_ARCH_BITS == 64
2336typedef RTGCUINTREG64 RTGCUINTREG;
2337#elif GC_ARCH_BITS == 32
2338typedef RTGCUINTREG32 RTGCUINTREG;
2339#else
2340# error "Unsupported GC_ARCH_BITS!"
2341#endif
2342/** Pointer to an unsigned integer register in the guest context. */
2343typedef RTGCUINTREG RT_FAR *PRTGCUINTREG;
2344/** Pointer to a const unsigned integer register in the guest context. */
2345typedef const RTGCUINTREG RT_FAR *PCRTGCUINTREG;
2346
2347/** @} */
2348
2349/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
2350 * @{
2351 */
2352
2353/** Raw mode context pointer; a 32 bits guest context pointer.
2354 * Keep in mind that this type is an unsigned integer in
2355 * HC and void pointer in RC.
2356 */
2357#ifdef IN_RC
2358typedef void RT_FAR *RTRCPTR;
2359#else
2360typedef uint32_t RTRCPTR;
2361#endif
2362/** Pointer to a raw mode context pointer. */
2363typedef RTRCPTR RT_FAR *PRTRCPTR;
2364/** Pointer to a const raw mode context pointer. */
2365typedef const RTRCPTR RT_FAR *PCRTRCPTR;
2366/** @def NIL_RTRCPTR
2367 * NIL RC pointer. */
2368#ifdef IN_RC
2369# define NIL_RTRCPTR (NULL)
2370#else
2371# define NIL_RTRCPTR ((RTRCPTR)0)
2372#endif
2373/** @def RTRCPTR_MAX
2374 * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
2375 */
2376#define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
2377
2378/** Raw mode context pointer, unsigned integer variant. */
2379typedef int32_t RTRCINTPTR;
2380/** @def RTRCUINTPTR_MAX
2381 * The maximum value a RTRCUINPTR can have.
2382 */
2383#define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
2384
2385/** Raw mode context pointer, signed integer variant. */
2386typedef uint32_t RTRCUINTPTR;
2387/** @def RTRCINTPTR_MIN
2388 * The minimum value a RTRCINPTR can have.
2389 */
2390#define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
2391/** @def RTRCINTPTR_MAX
2392 * The maximum value a RTRCINPTR can have.
2393 */
2394#define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
2395
2396/* The following are only temporarily while we clean up RTRCPTR usage: */
2397#ifdef IN_RC
2398typedef void RT_FAR *RTRGPTR;
2399#else
2400typedef uint64_t RTRGPTR;
2401#endif
2402typedef RTRGPTR RT_FAR *PRTRGPTR;
2403typedef const RTRGPTR RT_FAR *PCRTRGPTR;
2404#ifdef IN_RC
2405# define NIL_RTRGPTR (NULL)
2406#else
2407# define NIL_RTRGPTR ((RTRGPTR)0)
2408#endif
2409
2410/** @} */
2411
2412
2413/** @defgroup grp_rt_types_cc Current Context Basic Types
2414 * @{
2415 */
2416
2417/** Current Context Physical Memory Address.*/
2418#ifdef IN_RC
2419typedef RTGCPHYS RTCCPHYS;
2420#else
2421typedef RTHCPHYS RTCCPHYS;
2422#endif
2423/** Pointer to Current Context Physical Memory Address. */
2424typedef RTCCPHYS RT_FAR *PRTCCPHYS;
2425/** Pointer to const Current Context Physical Memory Address. */
2426typedef const RTCCPHYS RT_FAR *PCRTCCPHYS;
2427/** @def NIL_RTCCPHYS
2428 * NIL CC Physical Address.
2429 * NIL_RTCCPHYS is used to signal an invalid physical address, similar
2430 * to the NULL pointer.
2431 */
2432#ifdef IN_RC
2433# define NIL_RTCCPHYS NIL_RTGCPHYS
2434#else
2435# define NIL_RTCCPHYS NIL_RTHCPHYS
2436#endif
2437
2438/** Unsigned integer register in the current context. */
2439#if ARCH_BITS == 32
2440typedef uint32_t RTCCUINTREG;
2441#elif ARCH_BITS == 64
2442typedef uint64_t RTCCUINTREG;
2443#elif ARCH_BITS == 16
2444typedef uint16_t RTCCUINTREG;
2445#else
2446# error "Unsupported ARCH_BITS!"
2447#endif
2448/** Pointer to an unsigned integer register in the current context. */
2449typedef RTCCUINTREG RT_FAR *PRTCCUINTREG;
2450/** Pointer to a const unsigned integer register in the current context. */
2451typedef RTCCUINTREG const RT_FAR *PCRTCCUINTREG;
2452
2453/** Signed integer register in the current context. */
2454#if ARCH_BITS == 32
2455typedef int32_t RTCCINTREG;
2456#elif ARCH_BITS == 64
2457typedef int64_t RTCCINTREG;
2458#elif ARCH_BITS == 16
2459typedef int16_t RTCCINTREG;
2460#endif
2461/** Pointer to a signed integer register in the current context. */
2462typedef RTCCINTREG RT_FAR *PRTCCINTREG;
2463/** Pointer to a const signed integer register in the current context. */
2464typedef RTCCINTREG const RT_FAR *PCRTCCINTREG;
2465
2466/** Unsigned integer register in the current context.
2467 * @remarks This is for dealing with EAX in 16-bit mode. */
2468#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
2469typedef uint32_t RTCCUINTXREG;
2470#else
2471typedef RTCCUINTREG RTCCUINTXREG;
2472#endif
2473/** Pointer to an unsigned integer register in the current context. */
2474typedef RTCCUINTREG RT_FAR *PRTCCUINTXREG;
2475/** Pointer to a const unsigned integer register in the current context. */
2476typedef RTCCUINTREG const RT_FAR *PCRTCCUINTXREG;
2477
2478/** Signed integer extended register in the current context.
2479 * @remarks This is for dealing with EAX in 16-bit mode. */
2480#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
2481typedef int32_t RTCCINTXREG;
2482#else
2483typedef RTCCINTREG RTCCINTXREG;
2484#endif
2485/** Pointer to a signed integer extended register in the current context. */
2486typedef RTCCINTXREG RT_FAR *PRTCCINTXREG;
2487/** Pointer to a const signed integer extended register in the current
2488 * context. */
2489typedef RTCCINTXREG const RT_FAR *PCRTCCINTXREG;
2490
2491/** @def RTCCUINTREG_C
2492 * Defines a constant of RTCCUINTREG type.
2493 * @param a_Value Constant value */
2494/** @def RTCCUINTREG_MAX
2495 * Max value that RTCCUINTREG can hold. */
2496/** @def RTCCUINTREG_FMT
2497 * Generic IPRT format specifier for RTCCUINTREG. */
2498/** @def RTCCUINTREG_XFMT
2499 * Generic IPRT format specifier for RTCCUINTREG, hexadecimal. */
2500/** @def RTCCINTREG_C
2501 * Defines a constant of RTCCINTREG type.
2502 * @param a_Value Constant value */
2503/** @def RTCCINTREG_MAX
2504 * Max value that RTCCINTREG can hold. */
2505/** @def RTCCINTREG_MIN
2506 * Min value that RTCCINTREG can hold. */
2507/** @def RTCCINTREG_XFMT
2508 * Generic IPRT format specifier for RTCCINTREG, hexadecimal. */
2509#if ARCH_BITS == 32
2510# define RTCCUINTREG_C(a_Value) UINT32_C(a_Value)
2511# define RTCCUINTREG_MAX UINT32_MAX
2512# define RTCCUINTREG_FMT "RU32"
2513# define RTCCUINTREG_XFMT "RX32"
2514# define RTCCINTREG_C(a_Value) INT32_C(a_Value)
2515# define RTCCINTREG_MAX INT32_MAX
2516# define RTCCINTREG_MIN INT32_MIN
2517# define RTCCINTREG_FMT "RI32"
2518# define RTCCINTREG_XFMT "RX32"
2519#elif ARCH_BITS == 64
2520# define RTCCUINTREG_C(a_Value) UINT64_C(a_Value)
2521# define RTCCUINTREG_MAX UINT64_MAX
2522# define RTCCUINTREG_FMT "RU64"
2523# define RTCCUINTREG_XFMT "RX64"
2524# define RTCCINTREG_C(a_Value) INT64_C(a_Value)
2525# define RTCCINTREG_MAX INT64_MAX
2526# define RTCCINTREG_MIN INT64_MIN
2527# define RTCCINTREG_FMT "RI64"
2528# define RTCCINTREG_XFMT "RX64"
2529#elif ARCH_BITS == 16
2530# define RTCCUINTREG_C(a_Value) UINT16_C(a_Value)
2531# define RTCCUINTREG_MAX UINT16_MAX
2532# define RTCCUINTREG_FMT "RU16"
2533# define RTCCUINTREG_XFMT "RX16"
2534# define RTCCINTREG_C(a_Value) INT16_C(a_Value)
2535# define RTCCINTREG_MAX INT16_MAX
2536# define RTCCINTREG_MIN INT16_MIN
2537# define RTCCINTREG_FMT "RI16"
2538# define RTCCINTREG_XFMT "RX16"
2539#else
2540# error "Unsupported ARCH_BITS!"
2541#endif
2542/** @def RTCCUINTXREG_C
2543 * Defines a constant of RTCCUINTXREG type.
2544 * @param a_Value Constant value */
2545/** @def RTCCUINTXREG_MAX
2546 * Max value that RTCCUINTXREG can hold. */
2547/** @def RTCCUINTXREG_FMT
2548 * Generic IPRT format specifier for RTCCUINTXREG. */
2549/** @def RTCCUINTXREG_XFMT
2550 * Generic IPRT format specifier for RTCCUINTXREG, hexadecimal. */
2551/** @def RTCCINTXREG_C
2552 * Defines a constant of RTCCINTXREG type.
2553 * @param a_Value Constant value */
2554/** @def RTCCINTXREG_MAX
2555 * Max value that RTCCINTXREG can hold. */
2556/** @def RTCCINTXREG_MIN
2557 * Min value that RTCCINTXREG can hold. */
2558/** @def RTCCINTXREG_FMT
2559 * Generic IPRT format specifier for RTCCINTXREG. */
2560/** @def RTCCINTXREG_XFMT
2561 * Generic IPRT format specifier for RTCCINTXREG, hexadecimal. */
2562/** @def RTCCINTXREG_BITS
2563 * The width of RTCCINTXREG in bits (32 or 64). */
2564#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
2565# define RTCCUINTXREG_C(a_Value) UINT32_C(a_Value)
2566# define RTCCUINTXREG_MAX UINT32_MAX
2567# define RTCCUINTXREG_FMT "RU32"
2568# define RTCCUINTXREG_XFMT "RX32"
2569# define RTCCINTXREG_C(a_Value) INT32_C(a_Value)
2570# define RTCCINTXREG_MAX INT32_MAX
2571# define RTCCINTXREG_MIN INT32_MIN
2572# define RTCCINTXREG_FMT "RI32"
2573# define RTCCINTXREG_XFMT "RX32"
2574# define RTCCINTXREG_BITS 32
2575#else
2576# define RTCCUINTXREG_C(a_Value) RTCCUINTREG_C(a_Value)
2577# define RTCCUINTXREG_MAX RTCCUINTREG_MAX
2578# define RTCCUINTXREG_FMT RTCCUINTREG_FMT
2579# define RTCCUINTXREG_XFMT RTCCUINTREG_XFMT
2580# define RTCCINTXREG_C(a_Value) RTCCINTREG_C(a_Value)
2581# define RTCCINTXREG_MAX RTCCINTREG_MAX
2582# define RTCCINTXREG_MIN RTCCINTREG_MIN
2583# define RTCCINTXREG_FMT RTCCINTREG_FMT
2584# define RTCCINTXREG_XFMT RTCCINTREG_XFMT
2585# define RTCCINTXREG_BITS ARCH_BITS
2586#endif
2587/** @} */
2588
2589
2590
2591/** Pointer to a big integer number. */
2592typedef struct RTBIGNUM RT_FAR *PRTBIGNUM;
2593/** Pointer to a const big integer number. */
2594typedef struct RTBIGNUM const RT_FAR *PCRTBIGNUM;
2595
2596
2597/** Pointer to a critical section. */
2598typedef struct RTCRITSECT RT_FAR *PRTCRITSECT;
2599/** Pointer to a const critical section. */
2600typedef const struct RTCRITSECT RT_FAR *PCRTCRITSECT;
2601
2602/** Pointer to a read/write critical section. */
2603typedef struct RTCRITSECTRW RT_FAR *PRTCRITSECTRW;
2604/** Pointer to a const read/write critical section. */
2605typedef const struct RTCRITSECTRW RT_FAR *PCRTCRITSECTRW;
2606
2607
2608/** Condition variable handle. */
2609typedef R3PTRTYPE(struct RTCONDVARINTERNAL RT_FAR *) RTCONDVAR;
2610/** Pointer to a condition variable handle. */
2611typedef RTCONDVAR RT_FAR *PRTCONDVAR;
2612/** Nil condition variable handle. */
2613#define NIL_RTCONDVAR 0
2614
2615/** Cryptographic (certificate) store handle. */
2616typedef R3R0PTRTYPE(struct RTCRSTOREINT RT_FAR *) RTCRSTORE;
2617/** Pointer to a Cryptographic (certificate) store handle. */
2618typedef RTCRSTORE RT_FAR *PRTCRSTORE;
2619/** Nil Cryptographic (certificate) store handle. */
2620#define NIL_RTCRSTORE 0
2621
2622/** Pointer to a const (store) certificate context. */
2623typedef struct RTCRCERTCTX const RT_FAR *PCRTCRCERTCTX;
2624
2625/** Cryptographic message digest handle. */
2626typedef R3R0PTRTYPE(struct RTCRDIGESTINT RT_FAR *) RTCRDIGEST;
2627/** Pointer to a cryptographic message digest handle. */
2628typedef RTCRDIGEST RT_FAR *PRTCRDIGEST;
2629/** NIL cryptographic message digest handle. */
2630#define NIL_RTCRDIGEST (0)
2631
2632/** Cryptographic key handle. */
2633typedef R3R0PTRTYPE(struct RTCRKEYINT RT_FAR *) RTCRKEY;
2634/** Pointer to a cryptographic key handle. */
2635typedef RTCRKEY RT_FAR *PRTCRKEY;
2636/** Cryptographic key handle nil value. */
2637#define NIL_RTCRKEY (0)
2638
2639/** Public key encryption schema handle. */
2640typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT RT_FAR *) RTCRPKIXENCRYPTION;
2641/** Pointer to a public key encryption schema handle. */
2642typedef RTCRPKIXENCRYPTION RT_FAR *PRTCRPKIXENCRYPTION;
2643/** NIL public key encryption schema handle */
2644#define NIL_RTCRPKIXENCRYPTION (0)
2645
2646/** Public key signature schema handle. */
2647typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT RT_FAR *) RTCRPKIXSIGNATURE;
2648/** Pointer to a public key signature schema handle. */
2649typedef RTCRPKIXSIGNATURE RT_FAR *PRTCRPKIXSIGNATURE;
2650/** NIL public key signature schema handle */
2651#define NIL_RTCRPKIXSIGNATURE (0)
2652
2653/** X.509 certificate paths builder & validator handle. */
2654typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT RT_FAR *) RTCRX509CERTPATHS;
2655/** Pointer to a certificate paths builder & validator handle. */
2656typedef RTCRX509CERTPATHS RT_FAR *PRTCRX509CERTPATHS;
2657/** Nil certificate paths builder & validator handle. */
2658#define NIL_RTCRX509CERTPATHS 0
2659
2660/** Directory handle. */
2661typedef struct RTDIRINTERNAL *RTDIR;
2662/** Pointer to directory handle. */
2663typedef RTDIR *PRTDIR;
2664/** NIL directory handle. */
2665#define NIL_RTDIR ((RTDIR)0)
2666
2667/** File handle. */
2668typedef R3R0PTRTYPE(struct RTFILEINT RT_FAR *) RTFILE;
2669/** Pointer to file handle. */
2670typedef RTFILE RT_FAR *PRTFILE;
2671/** Nil file handle. */
2672#define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
2673
2674/** Async I/O request handle. */
2675typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL RT_FAR *) RTFILEAIOREQ;
2676/** Pointer to an async I/O request handle. */
2677typedef RTFILEAIOREQ RT_FAR *PRTFILEAIOREQ;
2678/** Nil request handle. */
2679#define NIL_RTFILEAIOREQ 0
2680
2681/** Async I/O completion context handle. */
2682typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL RT_FAR *) RTFILEAIOCTX;
2683/** Pointer to an async I/O completion context handle. */
2684typedef RTFILEAIOCTX RT_FAR *PRTFILEAIOCTX;
2685/** Nil context handle. */
2686#define NIL_RTFILEAIOCTX 0
2687
2688/** ISO image maker handle. */
2689typedef struct RTFSISOMAKERINT RT_FAR *RTFSISOMAKER;
2690/** Pointer to an ISO image maker handle. */
2691typedef RTFSISOMAKER RT_FAR *PRTFSISOMAKER;
2692/** NIL ISO maker handle. */
2693#define NIL_RTFSISOMAKER ((RTFSISOMAKER)0)
2694
2695/** INI-file handle. */
2696typedef struct RTINIFILEINT RT_FAR *RTINIFILE;
2697/** Pointer to an INI-file handle. */
2698typedef RTINIFILE RT_FAR *PRTINIFILE;
2699/** NIL INI-file handle. */
2700#define NIL_RTINIFILE ((RTINIFILE)0)
2701
2702/** Loader module handle. */
2703typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL RT_FAR *) RTLDRMOD;
2704/** Pointer to a loader module handle. */
2705typedef RTLDRMOD RT_FAR *PRTLDRMOD;
2706/** Nil loader module handle. */
2707#define NIL_RTLDRMOD 0
2708
2709/** Lock validator class handle. */
2710typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT RT_FAR *) RTLOCKVALCLASS;
2711/** Pointer to a lock validator class handle. */
2712typedef RTLOCKVALCLASS RT_FAR *PRTLOCKVALCLASS;
2713/** Nil lock validator class handle. */
2714#define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
2715
2716/** Ring-0 memory object handle. */
2717typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL RT_FAR *) RTR0MEMOBJ;
2718/** Pointer to a Ring-0 memory object handle. */
2719typedef RTR0MEMOBJ RT_FAR *PRTR0MEMOBJ;
2720/** Nil ring-0 memory object handle. */
2721#define NIL_RTR0MEMOBJ 0
2722
2723/** Native thread handle. */
2724typedef RTHCUINTPTR RTNATIVETHREAD;
2725/** Pointer to an native thread handle. */
2726typedef RTNATIVETHREAD RT_FAR *PRTNATIVETHREAD;
2727/** Nil native thread handle. */
2728#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
2729
2730/** Pipe handle. */
2731typedef R3R0PTRTYPE(struct RTPIPEINTERNAL RT_FAR *) RTPIPE;
2732/** Pointer to a pipe handle. */
2733typedef RTPIPE RT_FAR *PRTPIPE;
2734/** Nil pipe handle.
2735 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
2736#define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
2737
2738/** @typedef RTPOLLSET
2739 * Poll set handle. */
2740typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL RT_FAR *) RTPOLLSET;
2741/** Pointer to a poll set handle. */
2742typedef RTPOLLSET RT_FAR *PRTPOLLSET;
2743/** Nil poll set handle handle. */
2744#define NIL_RTPOLLSET ((RTPOLLSET)0)
2745
2746/** Process identifier. */
2747typedef uint32_t RTPROCESS;
2748/** Pointer to a process identifier. */
2749typedef RTPROCESS RT_FAR *PRTPROCESS;
2750/** Nil process identifier. */
2751#define NIL_RTPROCESS (~(RTPROCESS)0)
2752
2753/** Process ring-0 handle. */
2754typedef RTR0UINTPTR RTR0PROCESS;
2755/** Pointer to a ring-0 process handle. */
2756typedef RTR0PROCESS RT_FAR *PRTR0PROCESS;
2757/** Nil ring-0 process handle. */
2758#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
2759
2760/** @typedef RTSEMEVENT
2761 * Event Semaphore handle. */
2762typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL RT_FAR *) RTSEMEVENT;
2763/** Pointer to an event semaphore handle. */
2764typedef RTSEMEVENT RT_FAR *PRTSEMEVENT;
2765/** Nil event semaphore handle. */
2766#define NIL_RTSEMEVENT 0
2767
2768/** @typedef RTSEMEVENTMULTI
2769 * Event Multiple Release Semaphore handle. */
2770typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL RT_FAR *) RTSEMEVENTMULTI;
2771/** Pointer to an event multiple release semaphore handle. */
2772typedef RTSEMEVENTMULTI RT_FAR *PRTSEMEVENTMULTI;
2773/** Nil multiple release event semaphore handle. */
2774#define NIL_RTSEMEVENTMULTI 0
2775
2776/** @typedef RTSEMFASTMUTEX
2777 * Fast mutex Semaphore handle. */
2778typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL RT_FAR *) RTSEMFASTMUTEX;
2779/** Pointer to a fast mutex semaphore handle. */
2780typedef RTSEMFASTMUTEX RT_FAR *PRTSEMFASTMUTEX;
2781/** Nil fast mutex semaphore handle. */
2782#define NIL_RTSEMFASTMUTEX 0
2783
2784/** @typedef RTSEMMUTEX
2785 * Mutex Semaphore handle. */
2786typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL RT_FAR *) RTSEMMUTEX;
2787/** Pointer to a mutex semaphore handle. */
2788typedef RTSEMMUTEX RT_FAR *PRTSEMMUTEX;
2789/** Nil mutex semaphore handle. */
2790#define NIL_RTSEMMUTEX 0
2791
2792/** @typedef RTSEMSPINMUTEX
2793 * Spinning mutex Semaphore handle. */
2794typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL RT_FAR *) RTSEMSPINMUTEX;
2795/** Pointer to a spinning mutex semaphore handle. */
2796typedef RTSEMSPINMUTEX RT_FAR *PRTSEMSPINMUTEX;
2797/** Nil spinning mutex semaphore handle. */
2798#define NIL_RTSEMSPINMUTEX 0
2799
2800/** @typedef RTSEMRW
2801 * Read/Write Semaphore handle. */
2802typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL RT_FAR *) RTSEMRW;
2803/** Pointer to a read/write semaphore handle. */
2804typedef RTSEMRW RT_FAR *PRTSEMRW;
2805/** Nil read/write semaphore handle. */
2806#define NIL_RTSEMRW 0
2807
2808/** @typedef RTSEMXROADS
2809 * Crossroads semaphore handle. */
2810typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL RT_FAR *) RTSEMXROADS;
2811/** Pointer to a crossroads semaphore handle. */
2812typedef RTSEMXROADS RT_FAR *PRTSEMXROADS;
2813/** Nil crossroads semaphore handle. */
2814#define NIL_RTSEMXROADS ((RTSEMXROADS)0)
2815
2816/** Spinlock handle. */
2817typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL RT_FAR *) RTSPINLOCK;
2818/** Pointer to a spinlock handle. */
2819typedef RTSPINLOCK RT_FAR *PRTSPINLOCK;
2820/** Nil spinlock handle. */
2821#define NIL_RTSPINLOCK 0
2822
2823/** Socket handle. */
2824typedef R3R0PTRTYPE(struct RTSOCKETINT RT_FAR *) RTSOCKET;
2825/** Pointer to socket handle. */
2826typedef RTSOCKET RT_FAR *PRTSOCKET;
2827/** Nil socket handle. */
2828#define NIL_RTSOCKET ((RTSOCKET)0)
2829
2830/** Pointer to a RTTCPSERVER handle. */
2831typedef struct RTTCPSERVER RT_FAR *PRTTCPSERVER;
2832/** Pointer to a RTTCPSERVER handle. */
2833typedef PRTTCPSERVER RT_FAR *PPRTTCPSERVER;
2834/** Nil RTTCPSERVER handle. */
2835#define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
2836
2837/** Pointer to a RTUDPSERVER handle. */
2838typedef struct RTUDPSERVER RT_FAR *PRTUDPSERVER;
2839/** Pointer to a RTUDPSERVER handle. */
2840typedef PRTUDPSERVER RT_FAR *PPRTUDPSERVER;
2841/** Nil RTUDPSERVER handle. */
2842#define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
2843
2844/** Thread handle.*/
2845typedef R3R0PTRTYPE(struct RTTHREADINT RT_FAR *) RTTHREAD;
2846/** Pointer to thread handle. */
2847typedef RTTHREAD RT_FAR *PRTTHREAD;
2848/** Nil thread handle. */
2849#define NIL_RTTHREAD 0
2850
2851/** Thread context switching hook handle. */
2852typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT RT_FAR *) RTTHREADCTXHOOK;
2853/** Pointer to Thread context switching hook handle. */
2854typedef RTTHREADCTXHOOK RT_FAR *PRTTHREADCTXHOOK;
2855/** Nil Thread context switching hook handle. */
2856#define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
2857
2858/** A TLS index. */
2859typedef RTHCINTPTR RTTLS;
2860/** Pointer to a TLS index. */
2861typedef RTTLS RT_FAR *PRTTLS;
2862/** Pointer to a const TLS index. */
2863typedef RTTLS const RT_FAR *PCRTTLS;
2864/** NIL TLS index value. */
2865#define NIL_RTTLS ((RTTLS)-1)
2866
2867/** Trace buffer handle.
2868 * @remarks This is not a R3/R0 type like most other handles!
2869 */
2870typedef struct RTTRACEBUFINT RT_FAR *RTTRACEBUF;
2871/** Pointer to a trace buffer handle. */
2872typedef RTTRACEBUF RT_FAR *PRTTRACEBUF;
2873/** Nil trace buffer handle. */
2874#define NIL_RTTRACEBUF ((RTTRACEBUF)0)
2875/** The handle of the default trace buffer.
2876 * This can be used with any of the RTTraceBufAdd APIs. */
2877#define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
2878
2879/** Handle to a simple heap. */
2880typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL RT_FAR *) RTHEAPSIMPLE;
2881/** Pointer to a handle to a simple heap. */
2882typedef RTHEAPSIMPLE RT_FAR *PRTHEAPSIMPLE;
2883/** NIL simple heap handle. */
2884#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
2885
2886/** Handle to an offset based heap. */
2887typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL RT_FAR *) RTHEAPOFFSET;
2888/** Pointer to a handle to an offset based heap. */
2889typedef RTHEAPOFFSET RT_FAR *PRTHEAPOFFSET;
2890/** NIL offset based heap handle. */
2891#define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
2892
2893/** Handle to an environment block. */
2894typedef R3PTRTYPE(struct RTENVINTERNAL RT_FAR *) RTENV;
2895/** Pointer to a handle to an environment block. */
2896typedef RTENV RT_FAR *PRTENV;
2897/** NIL simple heap handle. */
2898#define NIL_RTENV ((RTENV)0)
2899
2900/** A CPU identifier.
2901 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
2902 * does it have to correspond to the bits in the affinity mask, at
2903 * least not until we've sorted out Windows NT. */
2904typedef uint32_t RTCPUID;
2905/** Pointer to a CPU identifier. */
2906typedef RTCPUID RT_FAR *PRTCPUID;
2907/** Pointer to a const CPU identifier. */
2908typedef RTCPUID const RT_FAR *PCRTCPUID;
2909/** Nil CPU Id. */
2910#define NIL_RTCPUID ((RTCPUID)~0)
2911
2912/** The maximum number of CPUs a set can contain and IPRT is able
2913 * to reference. (Should be max of support arch/platforms.)
2914 * @remarks Must be a power of two and multiple of 64 (see RTCPUSET). */
2915#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
2916# if defined(RT_OS_OS2)
2917# define RTCPUSET_MAX_CPUS 64
2918# elif defined(RT_OS_DARWIN) || defined(RT_ARCH_X86)
2919# define RTCPUSET_MAX_CPUS 256
2920# else
2921# define RTCPUSET_MAX_CPUS 1024
2922# endif
2923#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
2924# define RTCPUSET_MAX_CPUS 1024
2925#else
2926# define RTCPUSET_MAX_CPUS 64
2927#endif
2928/** A CPU set.
2929 * @note Treat this as an opaque type and always use RTCpuSet* for
2930 * manipulating it. */
2931typedef struct RTCPUSET
2932{
2933 /** The bitmap. */
2934 uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
2935} RTCPUSET;
2936/** Pointer to a CPU set. */
2937typedef RTCPUSET RT_FAR *PRTCPUSET;
2938/** Pointer to a const CPU set. */
2939typedef RTCPUSET const RT_FAR *PCRTCPUSET;
2940
2941/** A handle table handle. */
2942typedef R3R0PTRTYPE(struct RTHANDLETABLEINT RT_FAR *) RTHANDLETABLE;
2943/** A pointer to a handle table handle. */
2944typedef RTHANDLETABLE RT_FAR *PRTHANDLETABLE;
2945/** @def NIL_RTHANDLETABLE
2946 * NIL handle table handle. */
2947#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
2948
2949/** A handle to a low resolution timer. */
2950typedef R3R0PTRTYPE(struct RTTIMERLRINT RT_FAR *) RTTIMERLR;
2951/** A pointer to a low resolution timer handle. */
2952typedef RTTIMERLR RT_FAR *PRTTIMERLR;
2953/** @def NIL_RTTIMERLR
2954 * NIL low resolution timer handle value. */
2955#define NIL_RTTIMERLR ((RTTIMERLR)0)
2956
2957/** Handle to a random number generator. */
2958typedef R3R0PTRTYPE(struct RTRANDINT RT_FAR *) RTRAND;
2959/** Pointer to a random number generator handle. */
2960typedef RTRAND RT_FAR *PRTRAND;
2961/** NIL random number generator handle value. */
2962#define NIL_RTRAND ((RTRAND)0)
2963
2964/** Debug address space handle. */
2965typedef R3R0PTRTYPE(struct RTDBGASINT RT_FAR *) RTDBGAS;
2966/** Pointer to a debug address space handle. */
2967typedef RTDBGAS RT_FAR *PRTDBGAS;
2968/** NIL debug address space handle. */
2969#define NIL_RTDBGAS ((RTDBGAS)0)
2970
2971/** Debug module handle. */
2972typedef R3R0PTRTYPE(struct RTDBGMODINT RT_FAR *) RTDBGMOD;
2973/** Pointer to a debug module handle. */
2974typedef RTDBGMOD RT_FAR *PRTDBGMOD;
2975/** NIL debug module handle. */
2976#define NIL_RTDBGMOD ((RTDBGMOD)0)
2977
2978/** Pointer to an unwind machine state. */
2979typedef struct RTDBGUNWINDSTATE RT_FAR *PRTDBGUNWINDSTATE;
2980/** Pointer to a const unwind machine state. */
2981typedef struct RTDBGUNWINDSTATE const RT_FAR *PCRTDBGUNWINDSTATE;
2982
2983/** Manifest handle. */
2984typedef struct RTMANIFESTINT RT_FAR *RTMANIFEST;
2985/** Pointer to a manifest handle. */
2986typedef RTMANIFEST RT_FAR *PRTMANIFEST;
2987/** NIL manifest handle. */
2988#define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
2989
2990/** Memory pool handle. */
2991typedef R3R0PTRTYPE(struct RTMEMPOOLINT RT_FAR *) RTMEMPOOL;
2992/** Pointer to a memory pool handle. */
2993typedef RTMEMPOOL RT_FAR *PRTMEMPOOL;
2994/** NIL memory pool handle. */
2995#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
2996/** The default memory pool handle. */
2997#define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
2998
2999/** String cache handle. */
3000typedef R3R0PTRTYPE(struct RTSTRCACHEINT RT_FAR *) RTSTRCACHE;
3001/** Pointer to a string cache handle. */
3002typedef RTSTRCACHE RT_FAR *PRTSTRCACHE;
3003/** NIL string cache handle. */
3004#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
3005/** The default string cache handle. */
3006#define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
3007
3008
3009/** Virtual Filesystem handle. */
3010typedef struct RTVFSINTERNAL RT_FAR *RTVFS;
3011/** Pointer to a VFS handle. */
3012typedef RTVFS RT_FAR *PRTVFS;
3013/** A NIL VFS handle. */
3014#define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
3015
3016/** Virtual Filesystem base object handle. */
3017typedef struct RTVFSOBJINTERNAL RT_FAR *RTVFSOBJ;
3018/** Pointer to a VFS base object handle. */
3019typedef RTVFSOBJ RT_FAR *PRTVFSOBJ;
3020/** A NIL VFS base object handle. */
3021#define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
3022
3023/** Virtual Filesystem directory handle. */
3024typedef struct RTVFSDIRINTERNAL RT_FAR *RTVFSDIR;
3025/** Pointer to a VFS directory handle. */
3026typedef RTVFSDIR RT_FAR *PRTVFSDIR;
3027/** A NIL VFS directory handle. */
3028#define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
3029
3030/** Virtual Filesystem filesystem stream handle. */
3031typedef struct RTVFSFSSTREAMINTERNAL RT_FAR *RTVFSFSSTREAM;
3032/** Pointer to a VFS filesystem stream handle. */
3033typedef RTVFSFSSTREAM RT_FAR *PRTVFSFSSTREAM;
3034/** A NIL VFS filesystem stream handle. */
3035#define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
3036
3037/** Virtual Filesystem I/O stream handle. */
3038typedef struct RTVFSIOSTREAMINTERNAL RT_FAR *RTVFSIOSTREAM;
3039/** Pointer to a VFS I/O stream handle. */
3040typedef RTVFSIOSTREAM RT_FAR *PRTVFSIOSTREAM;
3041/** A NIL VFS I/O stream handle. */
3042#define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
3043
3044/** Virtual Filesystem file handle. */
3045typedef struct RTVFSFILEINTERNAL RT_FAR *RTVFSFILE;
3046/** Pointer to a VFS file handle. */
3047typedef RTVFSFILE RT_FAR *PRTVFSFILE;
3048/** A NIL VFS file handle. */
3049#define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
3050
3051/** Virtual Filesystem symbolic link handle. */
3052typedef struct RTVFSSYMLINKINTERNAL RT_FAR *RTVFSSYMLINK;
3053/** Pointer to a VFS symbolic link handle. */
3054typedef RTVFSSYMLINK RT_FAR *PRTVFSSYMLINK;
3055/** A NIL VFS symbolic link handle. */
3056#define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
3057
3058/** Async I/O manager handle. */
3059typedef struct RTAIOMGRINT RT_FAR *RTAIOMGR;
3060/** Pointer to a async I/O manager handle. */
3061typedef RTAIOMGR RT_FAR *PRTAIOMGR;
3062/** A NIL async I/O manager handle. */
3063#define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
3064
3065/** Async I/O manager file handle. */
3066typedef struct RTAIOMGRFILEINT RT_FAR *RTAIOMGRFILE;
3067/** Pointer to a async I/O manager file handle. */
3068typedef RTAIOMGRFILE RT_FAR *PRTAIOMGRFILE;
3069/** A NIL async I/O manager file handle. */
3070#define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
3071
3072/** Kernel module information record handle. */
3073typedef struct RTKRNLMODINFOINT RT_FAR *RTKRNLMODINFO;
3074/** Pointer to a kernel information record handle. */
3075typedef RTKRNLMODINFO RT_FAR *PRTKRNLMODINFO;
3076/** A NIL kernel module information record handle. */
3077#define NIL_RTKRNLMODINFO ((RTKRNLMODINFO)~(uintptr_t)0);
3078
3079/** Shared memory object handle. */
3080typedef struct RTSHMEMINT RT_FAR *RTSHMEM;
3081/** Pointer to a shared memory object handle. */
3082typedef RTSHMEM RT_FAR *PRTSHMEM;
3083/** A NIL shared memory object handle. */
3084#define NIL_RTSHMEM ((RTSHMEM)~(uintptr_t)0)
3085
3086/** EFI signature database handle. */
3087typedef struct RTEFISIGDBINT RT_FAR *RTEFISIGDB;
3088/** Pointer to a EFI signature database handle. */
3089typedef RTEFISIGDB RT_FAR *PRTEFISIGDB;
3090/** A NIL EFI signature database handle. */
3091#define NIL_RTEFISIGDB ((RTEFISIGDB)~(uintptr_t)0)
3092
3093
3094/**
3095 * Handle type.
3096 *
3097 * This is usually used together with RTHANDLEUNION.
3098 */
3099typedef enum RTHANDLETYPE
3100{
3101 /** The invalid zero value. */
3102 RTHANDLETYPE_INVALID = 0,
3103 /** File handle. */
3104 RTHANDLETYPE_FILE,
3105 /** Pipe handle */
3106 RTHANDLETYPE_PIPE,
3107 /** Socket handle. */
3108 RTHANDLETYPE_SOCKET,
3109 /** Thread handle. */
3110 RTHANDLETYPE_THREAD,
3111 /** The end of the valid values. */
3112 RTHANDLETYPE_END,
3113 /** The 32-bit type blow up. */
3114 RTHANDLETYPE_32BIT_HACK = 0x7fffffff
3115} RTHANDLETYPE;
3116/** Pointer to a handle type. */
3117typedef RTHANDLETYPE RT_FAR *PRTHANDLETYPE;
3118
3119/**
3120 * Handle union.
3121 *
3122 * This is usually used together with RTHANDLETYPE or as RTHANDLE.
3123 */
3124typedef union RTHANDLEUNION
3125{
3126 RTFILE hFile; /**< File handle. */
3127 RTPIPE hPipe; /**< Pipe handle. */
3128 RTSOCKET hSocket; /**< Socket handle. */
3129 RTTHREAD hThread; /**< Thread handle. */
3130 /** Generic integer handle value.
3131 * Note that RTFILE is not yet pointer sized, so accessing it via this member
3132 * isn't necessarily safe or fully portable. */
3133 RTHCUINTPTR uInt;
3134} RTHANDLEUNION;
3135/** Pointer to a handle union. */
3136typedef RTHANDLEUNION RT_FAR *PRTHANDLEUNION;
3137/** Pointer to a const handle union. */
3138typedef RTHANDLEUNION const RT_FAR *PCRTHANDLEUNION;
3139
3140/**
3141 * Generic handle.
3142 */
3143typedef struct RTHANDLE
3144{
3145 /** The handle type. */
3146 RTHANDLETYPE enmType;
3147 /** The handle value. */
3148 RTHANDLEUNION u;
3149} RTHANDLE;
3150/** Pointer to a generic handle. */
3151typedef RTHANDLE RT_FAR *PRTHANDLE;
3152/** Pointer to a const generic handle. */
3153typedef RTHANDLE const RT_FAR *PCRTHANDLE;
3154
3155
3156/**
3157 * Standard handles.
3158 *
3159 * @remarks These have the correct file descriptor values for unixy systems and
3160 * can be used directly in code specific to those platforms.
3161 */
3162typedef enum RTHANDLESTD
3163{
3164 /** Invalid standard handle. */
3165 RTHANDLESTD_INVALID = -1,
3166 /** The standard input handle. */
3167 RTHANDLESTD_INPUT = 0,
3168 /** The standard output handle. */
3169 RTHANDLESTD_OUTPUT,
3170 /** The standard error handle. */
3171 RTHANDLESTD_ERROR,
3172 /** The typical 32-bit type hack. */
3173 RTHANDLESTD_32BIT_HACK = 0x7fffffff
3174} RTHANDLESTD;
3175
3176
3177/**
3178 * Error info.
3179 *
3180 * See RTErrInfo*.
3181 */
3182typedef struct RTERRINFO
3183{
3184 /** Flags, see RTERRINFO_FLAGS_XXX. */
3185 uint32_t fFlags;
3186 /** The status code. */
3187 int32_t rc;
3188 /** The size of the message */
3189 size_t cbMsg;
3190 /** The error buffer. */
3191 char *pszMsg;
3192 /** Reserved for future use. */
3193 void *apvReserved[2];
3194} RTERRINFO;
3195/** Pointer to an error info structure. */
3196typedef RTERRINFO RT_FAR *PRTERRINFO;
3197/** Pointer to a const error info structure. */
3198typedef RTERRINFO const RT_FAR *PCRTERRINFO;
3199
3200/**
3201 * Static error info structure, see RTErrInfoInitStatic.
3202 */
3203typedef struct RTERRINFOSTATIC
3204{
3205 /** The core error info. */
3206 RTERRINFO Core;
3207 /** The static message buffer. */
3208 char szMsg[3072];
3209} RTERRINFOSTATIC;
3210/** Pointer to a error info buffer. */
3211typedef RTERRINFOSTATIC RT_FAR *PRTERRINFOSTATIC;
3212/** Pointer to a const static error info buffer. */
3213typedef RTERRINFOSTATIC const RT_FAR *PCRTERRINFOSTATIC;
3214
3215
3216/**
3217 * UUID data type.
3218 *
3219 * See RTUuid*.
3220 *
3221 * @remarks IPRT defines that the first three integers in the @c Gen struct
3222 * interpretation are in little endian representation. This is
3223 * different to many other UUID implementation, and requires
3224 * conversion if you need to achieve consistent results.
3225 */
3226typedef union RTUUID
3227{
3228 /** 8-bit view. */
3229 uint8_t au8[16];
3230 /** 16-bit view. */
3231 uint16_t au16[8];
3232 /** 32-bit view. */
3233 uint32_t au32[4];
3234 /** 64-bit view. */
3235 uint64_t au64[2];
3236 /** The way the UUID is declared by the DCE specification. */
3237 struct
3238 {
3239 uint32_t u32TimeLow;
3240 uint16_t u16TimeMid;
3241 uint16_t u16TimeHiAndVersion;
3242 uint8_t u8ClockSeqHiAndReserved;
3243 uint8_t u8ClockSeqLow;
3244 uint8_t au8Node[6];
3245 } Gen;
3246} RTUUID;
3247/** Pointer to UUID data. */
3248typedef RTUUID RT_FAR *PRTUUID;
3249/** Pointer to readonly UUID data. */
3250typedef const RTUUID RT_FAR *PCRTUUID;
3251
3252/** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
3253#define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
3254
3255/** UUID string maximum length. */
3256#define RTUUID_STR_LENGTH 37
3257
3258
3259/** Compression handle. */
3260typedef struct RTZIPCOMP RT_FAR *PRTZIPCOMP;
3261/** Decompressor handle. */
3262typedef struct RTZIPDECOMP RT_FAR *PRTZIPDECOMP;
3263
3264
3265/**
3266 * Unicode Code Point.
3267 */
3268typedef uint32_t RTUNICP;
3269/** Pointer to an Unicode Code Point. */
3270typedef RTUNICP RT_FAR *PRTUNICP;
3271/** Pointer to an Unicode Code Point. */
3272typedef const RTUNICP RT_FAR *PCRTUNICP;
3273/** Max value a RTUNICP type can hold. */
3274#define RTUNICP_MAX ( ~(RTUNICP)0 )
3275/** Invalid code point.
3276 * This is returned when encountered invalid encodings or invalid
3277 * unicode code points. */
3278#define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
3279
3280
3281/**
3282 * UTF-16 character.
3283 * @remark wchar_t is not usable since it's compiler defined.
3284 * @remark When we use the term character we're not talking about unicode code point, but
3285 * the basic unit of the string encoding. Thus cwc - count of wide chars - means
3286 * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
3287 * and cch means count of the typedef 'char', which is assumed to be an octet.
3288 */
3289typedef uint16_t RTUTF16;
3290/** Pointer to a UTF-16 character. */
3291typedef RTUTF16 RT_FAR *PRTUTF16;
3292/** Pointer to a const UTF-16 character. */
3293typedef const RTUTF16 RT_FAR *PCRTUTF16;
3294
3295
3296/**
3297 * String tuple to go with the RT_STR_TUPLE macro.
3298 */
3299typedef struct RTSTRTUPLE
3300{
3301 /** The string. */
3302 const char *psz;
3303 /** The string length. */
3304 size_t cch;
3305} RTSTRTUPLE;
3306/** Pointer to a string tuple. */
3307typedef RTSTRTUPLE RT_FAR *PRTSTRTUPLE;
3308/** Pointer to a const string tuple. */
3309typedef RTSTRTUPLE const RT_FAR *PCRTSTRTUPLE;
3310
3311/**
3312 * Wait for ever if we have to.
3313 */
3314#define RT_INDEFINITE_WAIT (~0U)
3315
3316
3317/**
3318 * Generic process callback.
3319 *
3320 * @returns VBox status code. Failure will cancel the operation.
3321 * @param uPercentage The percentage of the operation which has been completed.
3322 * @param pvUser The user specified argument.
3323 */
3324typedef DECLCALLBACKTYPE(int, FNRTPROGRESS,(unsigned uPercentage, void *pvUser));
3325/** Pointer to a generic progress callback function, FNRTPROCESS(). */
3326typedef FNRTPROGRESS *PFNRTPROGRESS;
3327
3328/**
3329 * Generic vprintf-like callback function for dumpers.
3330 *
3331 * @param pvUser User argument.
3332 * @param pszFormat The format string.
3333 * @param va Arguments for the format string.
3334 */
3335typedef DECLCALLBACKTYPE(void, FNRTDUMPPRINTFV,(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0));
3336/** Pointer to a generic printf-like function for dumping. */
3337typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
3338
3339
3340/**
3341 * A point in a two dimentional coordinate system.
3342 */
3343typedef struct RTPOINT
3344{
3345 /** X coordinate. */
3346 int32_t x;
3347 /** Y coordinate. */
3348 int32_t y;
3349} RTPOINT;
3350/** Pointer to a point. */
3351typedef RTPOINT RT_FAR *PRTPOINT;
3352/** Pointer to a const point. */
3353typedef const RTPOINT RT_FAR *PCRTPOINT;
3354
3355
3356/**
3357 * Rectangle data type, double point.
3358 */
3359typedef struct RTRECT
3360{
3361 /** left X coordinate. */
3362 int32_t xLeft;
3363 /** top Y coordinate. */
3364 int32_t yTop;
3365 /** right X coordinate. (exclusive) */
3366 int32_t xRight;
3367 /** bottom Y coordinate. (exclusive) */
3368 int32_t yBottom;
3369} RTRECT;
3370/** Pointer to a double point rectangle. */
3371typedef RTRECT RT_FAR *PRTRECT;
3372/** Pointer to a const double point rectangle. */
3373typedef const RTRECT RT_FAR *PCRTRECT;
3374
3375
3376/**
3377 * Rectangle data type, point + size.
3378 */
3379typedef struct RTRECT2
3380{
3381 /** X coordinate.
3382 * Unless stated otherwise, this is the top left corner. */
3383 int32_t x;
3384 /** Y coordinate.
3385 * Unless stated otherwise, this is the top left corner. */
3386 int32_t y;
3387 /** The width.
3388 * Unless stated otherwise, this is to the right of (x,y) and will not
3389 * be a negative number. */
3390 int32_t cx;
3391 /** The height.
3392 * Unless stated otherwise, this is down from (x,y) and will not be a
3393 * negative number. */
3394 int32_t cy;
3395} RTRECT2;
3396/** Pointer to a point + size rectangle. */
3397typedef RTRECT2 RT_FAR *PRTRECT2;
3398/** Pointer to a const point + size rectangle. */
3399typedef const RTRECT2 RT_FAR *PCRTRECT2;
3400
3401
3402/**
3403 * The size of a rectangle.
3404 */
3405typedef struct RTRECTSIZE
3406{
3407 /** The width (along the x-axis). */
3408 uint32_t cx;
3409 /** The height (along the y-axis). */
3410 uint32_t cy;
3411} RTRECTSIZE;
3412/** Pointer to a rectangle size. */
3413typedef RTRECTSIZE RT_FAR *PRTRECTSIZE;
3414/** Pointer to a const rectangle size. */
3415typedef const RTRECTSIZE RT_FAR *PCRTRECTSIZE;
3416
3417
3418/**
3419 * Ethernet MAC address.
3420 *
3421 * The first 24 bits make up the Organisationally Unique Identifier (OUI),
3422 * where the first bit (little endian) indicates multicast (set) / unicast,
3423 * and the second bit indicates locally (set) / global administered. If all
3424 * bits are set, it's a broadcast.
3425 */
3426typedef union RTMAC
3427{
3428 /** @todo add a bitfield view of this stuff. */
3429 /** 8-bit view. */
3430 uint8_t au8[6];
3431 /** 16-bit view. */
3432 uint16_t au16[3];
3433} RTMAC;
3434/** Pointer to a MAC address. */
3435typedef RTMAC RT_FAR *PRTMAC;
3436/** Pointer to a readonly MAC address. */
3437typedef const RTMAC RT_FAR *PCRTMAC;
3438
3439
3440/** Pointer to a lock validator record.
3441 * The structure definition is found in iprt/lockvalidator.h. */
3442typedef struct RTLOCKVALRECEXCL RT_FAR *PRTLOCKVALRECEXCL;
3443/** Pointer to a record of one ownership share.
3444 * The structure definition is found in iprt/lockvalidator.h. */
3445typedef struct RTLOCKVALRECSHRD RT_FAR *PRTLOCKVALRECSHRD;
3446/** Pointer to a lock validator source position.
3447 * The structure definition is found in iprt/lockvalidator.h. */
3448typedef struct RTLOCKVALSRCPOS RT_FAR *PRTLOCKVALSRCPOS;
3449/** Pointer to a const lock validator source position.
3450 * The structure definition is found in iprt/lockvalidator.h. */
3451typedef struct RTLOCKVALSRCPOS const RT_FAR *PCRTLOCKVALSRCPOS;
3452
3453/** @name Special sub-class values.
3454 * The range 16..UINT32_MAX is available to the user, the range 0..15 is
3455 * reserved for the lock validator. In the user range the locks can only be
3456 * taking in ascending order.
3457 * @{ */
3458/** Invalid value. */
3459#define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
3460/** Not allowed to be taken with any other locks in the same class.
3461 * This is the recommended value. */
3462#define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
3463/** Any order is allowed within the class. */
3464#define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
3465/** The first user value. */
3466#define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
3467/** @} */
3468
3469
3470/**
3471 * Digest types.
3472 */
3473typedef enum RTDIGESTTYPE
3474{
3475 /** Invalid digest value. */
3476 RTDIGESTTYPE_INVALID = 0,
3477 /** Unknown digest type. */
3478 RTDIGESTTYPE_UNKNOWN,
3479 /** CRC32 checksum. */
3480 RTDIGESTTYPE_CRC32,
3481 /** CRC64 checksum. */
3482 RTDIGESTTYPE_CRC64,
3483 /** MD2 checksum (unsafe!). */
3484 RTDIGESTTYPE_MD2,
3485 /** MD4 checksum (unsafe!!). */
3486 RTDIGESTTYPE_MD4,
3487 /** MD5 checksum (unsafe!). */
3488 RTDIGESTTYPE_MD5,
3489 /** SHA-1 checksum (unsafe!). */
3490 RTDIGESTTYPE_SHA1,
3491 /** SHA-224 checksum. */
3492 RTDIGESTTYPE_SHA224,
3493 /** SHA-256 checksum. */
3494 RTDIGESTTYPE_SHA256,
3495 /** SHA-384 checksum. */
3496 RTDIGESTTYPE_SHA384,
3497 /** SHA-512 checksum. */
3498 RTDIGESTTYPE_SHA512,
3499 /** SHA-512/224 checksum. */
3500 RTDIGESTTYPE_SHA512T224,
3501 /** SHA-512/256 checksum. */
3502 RTDIGESTTYPE_SHA512T256,
3503 /** SHA3-224 checksum. */
3504 RTDIGESTTYPE_SHA3_224,
3505 /** SHA3-256 checksum. */
3506 RTDIGESTTYPE_SHA3_256,
3507 /** SHA3-384 checksum. */
3508 RTDIGESTTYPE_SHA3_384,
3509 /** SHA3-512 checksum. */
3510 RTDIGESTTYPE_SHA3_512,
3511#if 0
3512 /** SHAKE128 checksum. */
3513 RTDIGESTTYPE_SHAKE128,
3514 /** SHAKE256 checksum. */
3515 RTDIGESTTYPE_SHAKE256,
3516#endif
3517 /** End of valid types. */
3518 RTDIGESTTYPE_END,
3519 /** Usual 32-bit type blowup. */
3520 RTDIGESTTYPE_32BIT_HACK = 0x7fffffff
3521} RTDIGESTTYPE;
3522
3523/**
3524 * Process exit codes.
3525 */
3526typedef enum RTEXITCODE
3527{
3528 /** Success. */
3529 RTEXITCODE_SUCCESS = 0,
3530 /** General failure. */
3531 RTEXITCODE_FAILURE = 1,
3532 /** Invalid arguments. */
3533 RTEXITCODE_SYNTAX = 2,
3534 /** Initialization failure (usually IPRT, but could be used for other
3535 * components as well). */
3536 RTEXITCODE_INIT = 3,
3537 /** Test skipped. */
3538 RTEXITCODE_SKIPPED = 4,
3539 /** The end of valid exit codes. */
3540 RTEXITCODE_END,
3541 /** The usual 32-bit type hack. */
3542 RTEXITCODE_32BIT_HACK = 0x7fffffff
3543} RTEXITCODE;
3544
3545/**
3546 * Range descriptor.
3547 */
3548typedef struct RTRANGE
3549{
3550 /** Start offset. */
3551 uint64_t offStart;
3552 /** Range size. */
3553 size_t cbRange;
3554} RTRANGE;
3555/** Pointer to a range descriptor. */
3556typedef RTRANGE RT_FAR *PRTRANGE;
3557/** Pointer to a readonly range descriptor. */
3558typedef const RTRANGE RT_FAR *PCRTRANGE;
3559
3560
3561/**
3562 * Generic pointer union.
3563 */
3564typedef union RTPTRUNION
3565{
3566 /** Pointer into the void. */
3567 void RT_FAR *pv;
3568 /** As a signed integer. */
3569 intptr_t i;
3570 /** As an unsigned integer. */
3571 uintptr_t u;
3572 /** Pointer to char value. */
3573 char RT_FAR *pch;
3574 /** Pointer to char value. */
3575 unsigned char RT_FAR *puch;
3576 /** Pointer to a int value. */
3577 int RT_FAR *pi;
3578 /** Pointer to a unsigned int value. */
3579 unsigned int RT_FAR *pu;
3580 /** Pointer to a long value. */
3581 long RT_FAR *pl;
3582 /** Pointer to a long value. */
3583 unsigned long RT_FAR *pul;
3584 /** Pointer to a 8-bit unsigned value. */
3585 uint8_t RT_FAR *pu8;
3586 /** Pointer to a 16-bit unsigned value. */
3587 uint16_t RT_FAR *pu16;
3588 /** Pointer to a 32-bit unsigned value. */
3589 uint32_t RT_FAR *pu32;
3590 /** Pointer to a 64-bit unsigned value. */
3591 uint64_t RT_FAR *pu64;
3592 /** Pointer to a 8-bit signed value. */
3593 int8_t RT_FAR *pi8;
3594 /** Pointer to a 16-bit signed value. */
3595 int16_t RT_FAR *pi16;
3596 /** Pointer to a 32-bit signed value. */
3597 int32_t RT_FAR *pi32;
3598 /** Pointer to a 64-bit signed value. */
3599 int64_t RT_FAR *pi64;
3600 /** Pointer to a UTF-16 character. */
3601 PRTUTF16 pwc;
3602 /** Pointer to a UUID character. */
3603 PRTUUID pUuid;
3604} RTPTRUNION;
3605/** Pointer to a pointer union. */
3606typedef RTPTRUNION RT_FAR *PRTPTRUNION;
3607
3608/**
3609 * Generic const pointer union.
3610 */
3611typedef union RTCPTRUNION
3612{
3613 /** Pointer into the void. */
3614 void const RT_FAR *pv;
3615 /** As a signed integer. */
3616 intptr_t i;
3617 /** As an unsigned integer. */
3618 uintptr_t u;
3619 /** Pointer to char value. */
3620 char const RT_FAR *pch;
3621 /** Pointer to char value. */
3622 unsigned char const RT_FAR *puch;
3623 /** Pointer to a int value. */
3624 int const RT_FAR *pi;
3625 /** Pointer to a unsigned int value. */
3626 unsigned int const RT_FAR *pu;
3627 /** Pointer to a long value. */
3628 long const RT_FAR *pl;
3629 /** Pointer to a long value. */
3630 unsigned long const RT_FAR *pul;
3631 /** Pointer to a 8-bit unsigned value. */
3632 uint8_t const RT_FAR *pu8;
3633 /** Pointer to a 16-bit unsigned value. */
3634 uint16_t const RT_FAR *pu16;
3635 /** Pointer to a 32-bit unsigned value. */
3636 uint32_t const RT_FAR *pu32;
3637 /** Pointer to a 64-bit unsigned value. */
3638 uint64_t const RT_FAR *pu64;
3639 /** Pointer to a 8-bit signed value. */
3640 int8_t const RT_FAR *pi8;
3641 /** Pointer to a 16-bit signed value. */
3642 int16_t const RT_FAR *pi16;
3643 /** Pointer to a 32-bit signed value. */
3644 int32_t const RT_FAR *pi32;
3645 /** Pointer to a 64-bit signed value. */
3646 int64_t const RT_FAR *pi64;
3647 /** Pointer to a UTF-16 character. */
3648 PCRTUTF16 pwc;
3649 /** Pointer to a UUID character. */
3650 PCRTUUID pUuid;
3651} RTCPTRUNION;
3652/** Pointer to a const pointer union. */
3653typedef RTCPTRUNION RT_FAR *PRTCPTRUNION;
3654
3655/**
3656 * Generic volatile pointer union.
3657 */
3658typedef union RTVPTRUNION
3659{
3660 /** Pointer into the void. */
3661 void volatile RT_FAR *pv;
3662 /** As a signed integer. */
3663 intptr_t i;
3664 /** As an unsigned integer. */
3665 uintptr_t u;
3666 /** Pointer to char value. */
3667 char volatile RT_FAR *pch;
3668 /** Pointer to char value. */
3669 unsigned char volatile RT_FAR *puch;
3670 /** Pointer to a int value. */
3671 int volatile RT_FAR *pi;
3672 /** Pointer to a unsigned int value. */
3673 unsigned int volatile RT_FAR *pu;
3674 /** Pointer to a long value. */
3675 long volatile RT_FAR *pl;
3676 /** Pointer to a long value. */
3677 unsigned long volatile RT_FAR *pul;
3678 /** Pointer to a 8-bit unsigned value. */
3679 uint8_t volatile RT_FAR *pu8;
3680 /** Pointer to a 16-bit unsigned value. */
3681 uint16_t volatile RT_FAR *pu16;
3682 /** Pointer to a 32-bit unsigned value. */
3683 uint32_t volatile RT_FAR *pu32;
3684 /** Pointer to a 64-bit unsigned value. */
3685 uint64_t volatile RT_FAR *pu64;
3686 /** Pointer to a 8-bit signed value. */
3687 int8_t volatile RT_FAR *pi8;
3688 /** Pointer to a 16-bit signed value. */
3689 int16_t volatile RT_FAR *pi16;
3690 /** Pointer to a 32-bit signed value. */
3691 int32_t volatile RT_FAR *pi32;
3692 /** Pointer to a 64-bit signed value. */
3693 int64_t volatile RT_FAR *pi64;
3694 /** Pointer to a UTF-16 character. */
3695 RTUTF16 volatile RT_FAR *pwc;
3696 /** Pointer to a UUID character. */
3697 RTUUID volatile RT_FAR *pUuid;
3698} RTVPTRUNION;
3699/** Pointer to a const pointer union. */
3700typedef RTVPTRUNION RT_FAR *PRTVPTRUNION;
3701
3702/**
3703 * Generic const volatile pointer union.
3704 */
3705typedef union RTCVPTRUNION
3706{
3707 /** Pointer into the void. */
3708 void const volatile RT_FAR *pv;
3709 /** As a signed integer. */
3710 intptr_t i;
3711 /** As an unsigned integer. */
3712 uintptr_t u;
3713 /** Pointer to char value. */
3714 char const volatile RT_FAR *pch;
3715 /** Pointer to char value. */
3716 unsigned char const volatile RT_FAR *puch;
3717 /** Pointer to a int value. */
3718 int const volatile RT_FAR *pi;
3719 /** Pointer to a unsigned int value. */
3720 unsigned int const volatile RT_FAR *pu;
3721 /** Pointer to a long value. */
3722 long const volatile RT_FAR *pl;
3723 /** Pointer to a long value. */
3724 unsigned long const volatile RT_FAR *pul;
3725 /** Pointer to a 8-bit unsigned value. */
3726 uint8_t const volatile RT_FAR *pu8;
3727 /** Pointer to a 16-bit unsigned value. */
3728 uint16_t const volatile RT_FAR *pu16;
3729 /** Pointer to a 32-bit unsigned value. */
3730 uint32_t const volatile RT_FAR *pu32;
3731 /** Pointer to a 64-bit unsigned value. */
3732 uint64_t const volatile RT_FAR *pu64;
3733 /** Pointer to a 8-bit signed value. */
3734 int8_t const volatile RT_FAR *pi8;
3735 /** Pointer to a 16-bit signed value. */
3736 int16_t const volatile RT_FAR *pi16;
3737 /** Pointer to a 32-bit signed value. */
3738 int32_t const volatile RT_FAR *pi32;
3739 /** Pointer to a 64-bit signed value. */
3740 int64_t const volatile RT_FAR *pi64;
3741 /** Pointer to a UTF-16 character. */
3742 RTUTF16 const volatile RT_FAR *pwc;
3743 /** Pointer to a UUID character. */
3744 RTUUID const volatile RT_FAR *pUuid;
3745} RTCVPTRUNION;
3746/** Pointer to a const pointer union. */
3747typedef RTCVPTRUNION RT_FAR *PRTCVPTRUNION;
3748
3749
3750
3751#ifdef __cplusplus
3752/**
3753 * Strict type validation helper class.
3754 *
3755 * See RTErrStrictType and RT_SUCCESS_NP.
3756 */
3757class RTErrStrictType2
3758{
3759protected:
3760 /** The status code. */
3761 int32_t m_rc;
3762
3763public:
3764 /**
3765 * Constructor.
3766 * @param rc IPRT style status code.
3767 */
3768 RTErrStrictType2(int32_t rc) : m_rc(rc)
3769 {
3770 }
3771
3772 /**
3773 * Get the status code.
3774 * @returns IPRT style status code.
3775 */
3776 int32_t getValue() const
3777 {
3778 return m_rc;
3779 }
3780};
3781#endif /* __cplusplus */
3782/** @} */
3783
3784#endif /* !IPRT_INCLUDED_types_h */
3785
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