VirtualBox

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

最後變更 在這個檔案從94253是 94253,由 vboxsync 提交於 3 年 前

iprt/types.h: Added a sj64 member to RTFLOAT80U as well as RTFLOAT80U_INIT and RTFLOAT80U_INIT_C for initializers and RTFLOAT80U_ARE_IDENTICAL for comparing. Moved the optional 'long double' member of RTFLOAT80U2 down so we can use initializers with the union. bugref:9898

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

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