VirtualBox

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

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

include/iprt/*.h: doxygen adjustments & fixes.

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