VirtualBox

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

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

iprt/types.h: Must undef bool after including stdbool.h on linux too.

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

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