VirtualBox

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

Last change on this file since 77807 was 77122, checked in by vboxsync, 6 years ago

iprt/types.h: Fix for recent FreeBSD versions

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 99.2 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#ifndef IN_RC
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/** Guest context pointer.
1775 * Keep in mind that this type is an unsigned integer in
1776 * HC and void pointer in GC.
1777 */
1778#if GC_ARCH_BITS == 64
1779typedef RTGCPTR64 RTGCPTR;
1780/** Pointer to a guest context pointer. */
1781typedef PRTGCPTR64 PRTGCPTR;
1782/** Pointer to a const guest context pointer. */
1783typedef PCRTGCPTR64 PCRTGCPTR;
1784/** @def NIL_RTGCPTR
1785 * NIL GC pointer.
1786 */
1787# define NIL_RTGCPTR NIL_RTGCPTR64
1788/** Max RTGCPTR value. */
1789# define RTGCPTR_MAX UINT64_MAX
1790#elif GC_ARCH_BITS == 32
1791typedef RTGCPTR32 RTGCPTR;
1792/** Pointer to a guest context pointer. */
1793typedef PRTGCPTR32 PRTGCPTR;
1794/** Pointer to a const guest context pointer. */
1795typedef PCRTGCPTR32 PCRTGCPTR;
1796/** @def NIL_RTGCPTR
1797 * NIL GC pointer.
1798 */
1799# define NIL_RTGCPTR NIL_RTGCPTR32
1800/** Max RTGCPTR value. */
1801# define RTGCPTR_MAX UINT32_MAX
1802#else
1803# error "Unsupported GC_ARCH_BITS!"
1804#endif
1805
1806/** Unsigned integer register in the guest context. */
1807typedef uint32_t RTGCUINTREG32;
1808/** Pointer to an unsigned integer register in the guest context. */
1809typedef RTGCUINTREG32 RT_FAR *PRTGCUINTREG32;
1810/** Pointer to a const unsigned integer register in the guest context. */
1811typedef const RTGCUINTREG32 RT_FAR *PCRTGCUINTREG32;
1812
1813typedef uint64_t RTGCUINTREG64;
1814/** Pointer to an unsigned integer register in the guest context. */
1815typedef RTGCUINTREG64 RT_FAR *PRTGCUINTREG64;
1816/** Pointer to a const unsigned integer register in the guest context. */
1817typedef const RTGCUINTREG64 RT_FAR *PCRTGCUINTREG64;
1818
1819#if GC_ARCH_BITS == 64
1820typedef RTGCUINTREG64 RTGCUINTREG;
1821#elif GC_ARCH_BITS == 32
1822typedef RTGCUINTREG32 RTGCUINTREG;
1823#else
1824# error "Unsupported GC_ARCH_BITS!"
1825#endif
1826/** Pointer to an unsigned integer register in the guest context. */
1827typedef RTGCUINTREG RT_FAR *PRTGCUINTREG;
1828/** Pointer to a const unsigned integer register in the guest context. */
1829typedef const RTGCUINTREG RT_FAR *PCRTGCUINTREG;
1830
1831/** @} */
1832
1833/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
1834 * @{
1835 */
1836
1837/** Raw mode context pointer; a 32 bits guest context pointer.
1838 * Keep in mind that this type is an unsigned integer in
1839 * HC and void pointer in RC.
1840 */
1841#ifdef IN_RC
1842typedef void RT_FAR *RTRCPTR;
1843#else
1844typedef uint32_t RTRCPTR;
1845#endif
1846/** Pointer to a raw mode context pointer. */
1847typedef RTRCPTR RT_FAR *PRTRCPTR;
1848/** Pointer to a const raw mode context pointer. */
1849typedef const RTRCPTR RT_FAR *PCRTRCPTR;
1850/** @def NIL_RTGCPTR
1851 * NIL RC pointer.
1852 */
1853#ifndef IN_RC
1854# define NIL_RTRCPTR ((RTRCPTR)0)
1855#else
1856# define NIL_RTRCPTR (NULL)
1857#endif
1858/** @def RTRCPTR_MAX
1859 * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
1860 */
1861#define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
1862
1863/** Raw mode context pointer, unsigned integer variant. */
1864typedef int32_t RTRCINTPTR;
1865/** @def RTRCUINTPTR_MAX
1866 * The maximum value a RTRCUINPTR can have.
1867 */
1868#define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
1869
1870/** Raw mode context pointer, signed integer variant. */
1871typedef uint32_t RTRCUINTPTR;
1872/** @def RTRCINTPTR_MIN
1873 * The minimum value a RTRCINPTR can have.
1874 */
1875#define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
1876/** @def RTRCINTPTR_MAX
1877 * The maximum value a RTRCINPTR can have.
1878 */
1879#define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
1880
1881/** @} */
1882
1883
1884/** @defgroup grp_rt_types_cc Current Context Basic Types
1885 * @{
1886 */
1887
1888/** Current Context Physical Memory Address.*/
1889#ifdef IN_RC
1890typedef RTGCPHYS RTCCPHYS;
1891#else
1892typedef RTHCPHYS RTCCPHYS;
1893#endif
1894/** Pointer to Current Context Physical Memory Address. */
1895typedef RTCCPHYS RT_FAR *PRTCCPHYS;
1896/** Pointer to const Current Context Physical Memory Address. */
1897typedef const RTCCPHYS RT_FAR *PCRTCCPHYS;
1898/** @def NIL_RTCCPHYS
1899 * NIL CC Physical Address.
1900 * NIL_RTCCPHYS is used to signal an invalid physical address, similar
1901 * to the NULL pointer.
1902 */
1903#ifdef IN_RC
1904# define NIL_RTCCPHYS NIL_RTGCPHYS
1905#else
1906# define NIL_RTCCPHYS NIL_RTHCPHYS
1907#endif
1908
1909/** Unsigned integer register in the current context. */
1910#if ARCH_BITS == 32
1911typedef uint32_t RTCCUINTREG;
1912#elif ARCH_BITS == 64
1913typedef uint64_t RTCCUINTREG;
1914#elif ARCH_BITS == 16
1915typedef uint16_t RTCCUINTREG;
1916#else
1917# error "Unsupported ARCH_BITS!"
1918#endif
1919/** Pointer to an unsigned integer register in the current context. */
1920typedef RTCCUINTREG RT_FAR *PRTCCUINTREG;
1921/** Pointer to a const unsigned integer register in the current context. */
1922typedef RTCCUINTREG const RT_FAR *PCRTCCUINTREG;
1923
1924/** Signed integer register in the current context. */
1925#if ARCH_BITS == 32
1926typedef int32_t RTCCINTREG;
1927#elif ARCH_BITS == 64
1928typedef int64_t RTCCINTREG;
1929#elif ARCH_BITS == 16
1930typedef int16_t RTCCINTREG;
1931#endif
1932/** Pointer to a signed integer register in the current context. */
1933typedef RTCCINTREG RT_FAR *PRTCCINTREG;
1934/** Pointer to a const signed integer register in the current context. */
1935typedef RTCCINTREG const RT_FAR *PCRTCCINTREG;
1936
1937/** Unsigned integer register in the current context.
1938 * @remarks This is for dealing with EAX in 16-bit mode. */
1939#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
1940typedef uint32_t RTCCUINTXREG;
1941#else
1942typedef RTCCUINTREG RTCCUINTXREG;
1943#endif
1944/** Pointer to an unsigned integer register in the current context. */
1945typedef RTCCUINTREG RT_FAR *PRTCCUINTXREG;
1946/** Pointer to a const unsigned integer register in the current context. */
1947typedef RTCCUINTREG const RT_FAR *PCRTCCUINTXREG;
1948
1949/** Signed integer extended register in the current context.
1950 * @remarks This is for dealing with EAX in 16-bit mode. */
1951#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
1952typedef int32_t RTCCINTXREG;
1953#else
1954typedef RTCCINTREG RTCCINTXREG;
1955#endif
1956/** Pointer to a signed integer extended register in the current context. */
1957typedef RTCCINTXREG RT_FAR *PRTCCINTXREG;
1958/** Pointer to a const signed integer extended register in the current
1959 * context. */
1960typedef RTCCINTXREG const RT_FAR *PCRTCCINTXREG;
1961
1962/** @def RTCCUINTREG_C
1963 * Defines a constant of RTCCUINTREG type.
1964 * @param a_Value Constant value */
1965/** @def RTCCUINTREG_MAX
1966 * Max value that RTCCUINTREG can hold. */
1967/** @def RTCCUINTREG_FMT
1968 * Generic IPRT format specifier for RTCCUINTREG. */
1969/** @def RTCCUINTREG_XFMT
1970 * Generic IPRT format specifier for RTCCUINTREG, hexadecimal. */
1971/** @def RTCCINTREG_C
1972 * Defines a constant of RTCCINTREG type.
1973 * @param a_Value Constant value */
1974/** @def RTCCINTREG_MAX
1975 * Max value that RTCCINTREG can hold. */
1976/** @def RTCCINTREG_MIN
1977 * Min value that RTCCINTREG can hold. */
1978/** @def RTCCINTREG_XFMT
1979 * Generic IPRT format specifier for RTCCINTREG, hexadecimal. */
1980#if ARCH_BITS == 32
1981# define RTCCUINTREG_C(a_Value) UINT32_C(a_Value)
1982# define RTCCUINTREG_MAX UINT32_MAX
1983# define RTCCUINTREG_FMT "RU32"
1984# define RTCCUINTREG_XFMT "RX32"
1985# define RTCCINTREG_C(a_Value) INT32_C(a_Value)
1986# define RTCCINTREG_MAX INT32_MAX
1987# define RTCCINTREG_MIN INT32_MIN
1988# define RTCCINTREG_FMT "RI32"
1989# define RTCCINTREG_XFMT "RX32"
1990#elif ARCH_BITS == 64
1991# define RTCCUINTREG_C(a_Value) UINT64_C(a_Value)
1992# define RTCCUINTREG_MAX UINT64_MAX
1993# define RTCCUINTREG_FMT "RU64"
1994# define RTCCUINTREG_XFMT "RX64"
1995# define RTCCINTREG_C(a_Value) INT64_C(a_Value)
1996# define RTCCINTREG_MAX INT64_MAX
1997# define RTCCINTREG_MIN INT64_MIN
1998# define RTCCINTREG_FMT "RI64"
1999# define RTCCINTREG_XFMT "RX64"
2000#elif ARCH_BITS == 16
2001# define RTCCUINTREG_C(a_Value) UINT16_C(a_Value)
2002# define RTCCUINTREG_MAX UINT16_MAX
2003# define RTCCUINTREG_FMT "RU16"
2004# define RTCCUINTREG_XFMT "RX16"
2005# define RTCCINTREG_C(a_Value) INT16_C(a_Value)
2006# define RTCCINTREG_MAX INT16_MAX
2007# define RTCCINTREG_MIN INT16_MIN
2008# define RTCCINTREG_FMT "RI16"
2009# define RTCCINTREG_XFMT "RX16"
2010#else
2011# error "Unsupported ARCH_BITS!"
2012#endif
2013/** @def RTCCUINTXREG_C
2014 * Defines a constant of RTCCUINTXREG type.
2015 * @param a_Value Constant value */
2016/** @def RTCCUINTXREG_MAX
2017 * Max value that RTCCUINTXREG can hold. */
2018/** @def RTCCUINTXREG_FMT
2019 * Generic IPRT format specifier for RTCCUINTXREG. */
2020/** @def RTCCUINTXREG_XFMT
2021 * Generic IPRT format specifier for RTCCUINTXREG, hexadecimal. */
2022/** @def RTCCINTXREG_C
2023 * Defines a constant of RTCCINTXREG type.
2024 * @param a_Value Constant value */
2025/** @def RTCCINTXREG_MAX
2026 * Max value that RTCCINTXREG can hold. */
2027/** @def RTCCINTXREG_MIN
2028 * Min value that RTCCINTXREG can hold. */
2029/** @def RTCCINTXREG_FMT
2030 * Generic IPRT format specifier for RTCCINTXREG. */
2031/** @def RTCCINTXREG_XFMT
2032 * Generic IPRT format specifier for RTCCINTXREG, hexadecimal. */
2033#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
2034# define RTCCUINTXREG_C(a_Value) UINT32_C(a_Value)
2035# define RTCCUINTXREG_MAX UINT32_MAX
2036# define RTCCUINTXREG_FMT "RU32"
2037# define RTCCUINTXREG_XFMT "RX32"
2038# define RTCCINTXREG_C(a_Value) INT32_C(a_Value)
2039# define RTCCINTXREG_MAX INT32_MAX
2040# define RTCCINTXREG_MIN INT32_MIN
2041# define RTCCINTXREG_FMT "RI32"
2042# define RTCCINTXREG_XFMT "RX32"
2043#else
2044# define RTCCUINTXREG_C(a_Value) RTCCUINTREG_C(a_Value)
2045# define RTCCUINTXREG_MAX RTCCUINTREG_MAX
2046# define RTCCUINTXREG_FMT RTCCUINTREG_FMT
2047# define RTCCUINTXREG_XFMT RTCCUINTREG_XFMT
2048# define RTCCINTXREG_C(a_Value) RTCCINTREG_C(a_Value)
2049# define RTCCINTXREG_MAX RTCCINTREG_MAX
2050# define RTCCINTXREG_MIN RTCCINTREG_MIN
2051# define RTCCINTXREG_FMT RTCCINTREG_FMT
2052# define RTCCINTXREG_XFMT RTCCINTREG_XFMT
2053#endif
2054/** @} */
2055
2056
2057
2058/** Pointer to a big integer number. */
2059typedef struct RTBIGNUM RT_FAR *PRTBIGNUM;
2060/** Pointer to a const big integer number. */
2061typedef struct RTBIGNUM const RT_FAR *PCRTBIGNUM;
2062
2063
2064/** Pointer to a critical section. */
2065typedef struct RTCRITSECT RT_FAR *PRTCRITSECT;
2066/** Pointer to a const critical section. */
2067typedef const struct RTCRITSECT RT_FAR *PCRTCRITSECT;
2068
2069/** Pointer to a read/write critical section. */
2070typedef struct RTCRITSECTRW RT_FAR *PRTCRITSECTRW;
2071/** Pointer to a const read/write critical section. */
2072typedef const struct RTCRITSECTRW RT_FAR *PCRTCRITSECTRW;
2073
2074
2075/** Condition variable handle. */
2076typedef R3PTRTYPE(struct RTCONDVARINTERNAL RT_FAR *) RTCONDVAR;
2077/** Pointer to a condition variable handle. */
2078typedef RTCONDVAR RT_FAR *PRTCONDVAR;
2079/** Nil condition variable handle. */
2080#define NIL_RTCONDVAR 0
2081
2082/** Cryptographic (certificate) store handle. */
2083typedef R3R0PTRTYPE(struct RTCRSTOREINT RT_FAR *) RTCRSTORE;
2084/** Pointer to a Cryptographic (certificate) store handle. */
2085typedef RTCRSTORE RT_FAR *PRTCRSTORE;
2086/** Nil Cryptographic (certificate) store handle. */
2087#define NIL_RTCRSTORE 0
2088
2089/** Pointer to a const (store) certificate context. */
2090typedef struct RTCRCERTCTX const RT_FAR *PCRTCRCERTCTX;
2091
2092/** Cryptographic message digest handle. */
2093typedef R3R0PTRTYPE(struct RTCRDIGESTINT RT_FAR *) RTCRDIGEST;
2094/** Pointer to a cryptographic message digest handle. */
2095typedef RTCRDIGEST RT_FAR *PRTCRDIGEST;
2096/** NIL cryptographic message digest handle. */
2097#define NIL_RTCRDIGEST (0)
2098
2099/** Cryptographic key handle. */
2100typedef R3R0PTRTYPE(struct RTCRKEYINT RT_FAR *) RTCRKEY;
2101/** Pointer to a cryptographic key handle. */
2102typedef RTCRKEY RT_FAR *PRTCRKEY;
2103/** Cryptographic key handle nil value. */
2104#define NIL_RTCRKEY (0)
2105
2106/** Public key encryption schema handle. */
2107typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT RT_FAR *) RTCRPKIXENCRYPTION;
2108/** Pointer to a public key encryption schema handle. */
2109typedef RTCRPKIXENCRYPTION RT_FAR *PRTCRPKIXENCRYPTION;
2110/** NIL public key encryption schema handle */
2111#define NIL_RTCRPKIXENCRYPTION (0)
2112
2113/** Public key signature schema handle. */
2114typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT RT_FAR *) RTCRPKIXSIGNATURE;
2115/** Pointer to a public key signature schema handle. */
2116typedef RTCRPKIXSIGNATURE RT_FAR *PRTCRPKIXSIGNATURE;
2117/** NIL public key signature schema handle */
2118#define NIL_RTCRPKIXSIGNATURE (0)
2119
2120/** X.509 certificate paths builder & validator handle. */
2121typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT RT_FAR *) RTCRX509CERTPATHS;
2122/** Pointer to a certificate paths builder & validator handle. */
2123typedef RTCRX509CERTPATHS RT_FAR *PRTCRX509CERTPATHS;
2124/** Nil certificate paths builder & validator handle. */
2125#define NIL_RTCRX509CERTPATHS 0
2126
2127/** Directory handle. */
2128typedef struct RTDIRINTERNAL *RTDIR;
2129/** Pointer to directory handle. */
2130typedef RTDIR *PRTDIR;
2131/** NIL directory handle. */
2132#define NIL_RTDIR ((RTDIR)0)
2133
2134/** File handle. */
2135typedef R3R0PTRTYPE(struct RTFILEINT RT_FAR *) RTFILE;
2136/** Pointer to file handle. */
2137typedef RTFILE RT_FAR *PRTFILE;
2138/** Nil file handle. */
2139#define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
2140
2141/** Async I/O request handle. */
2142typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL RT_FAR *) RTFILEAIOREQ;
2143/** Pointer to an async I/O request handle. */
2144typedef RTFILEAIOREQ RT_FAR *PRTFILEAIOREQ;
2145/** Nil request handle. */
2146#define NIL_RTFILEAIOREQ 0
2147
2148/** Async I/O completion context handle. */
2149typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL RT_FAR *) RTFILEAIOCTX;
2150/** Pointer to an async I/O completion context handle. */
2151typedef RTFILEAIOCTX RT_FAR *PRTFILEAIOCTX;
2152/** Nil context handle. */
2153#define NIL_RTFILEAIOCTX 0
2154
2155/** ISO image maker handle. */
2156typedef struct RTFSISOMAKERINT RT_FAR *RTFSISOMAKER;
2157/** Pointer to an ISO image maker handle. */
2158typedef RTFSISOMAKER RT_FAR *PRTFSISOMAKER;
2159/** NIL ISO maker handle. */
2160#define NIL_RTFSISOMAKER ((RTFSISOMAKER)0)
2161
2162/** INI-file handle. */
2163typedef struct RTINIFILEINT RT_FAR *RTINIFILE;
2164/** Pointer to an INI-file handle. */
2165typedef RTINIFILE RT_FAR *PRTINIFILE;
2166/** NIL INI-file handle. */
2167#define NIL_RTINIFILE ((RTINIFILE)0)
2168
2169/** Loader module handle. */
2170typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL RT_FAR *) RTLDRMOD;
2171/** Pointer to a loader module handle. */
2172typedef RTLDRMOD RT_FAR *PRTLDRMOD;
2173/** Nil loader module handle. */
2174#define NIL_RTLDRMOD 0
2175
2176/** Lock validator class handle. */
2177typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT RT_FAR *) RTLOCKVALCLASS;
2178/** Pointer to a lock validator class handle. */
2179typedef RTLOCKVALCLASS RT_FAR *PRTLOCKVALCLASS;
2180/** Nil lock validator class handle. */
2181#define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
2182
2183/** Ring-0 memory object handle. */
2184typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL RT_FAR *) RTR0MEMOBJ;
2185/** Pointer to a Ring-0 memory object handle. */
2186typedef RTR0MEMOBJ RT_FAR *PRTR0MEMOBJ;
2187/** Nil ring-0 memory object handle. */
2188#define NIL_RTR0MEMOBJ 0
2189
2190/** Native thread handle. */
2191typedef RTHCUINTPTR RTNATIVETHREAD;
2192/** Pointer to an native thread handle. */
2193typedef RTNATIVETHREAD RT_FAR *PRTNATIVETHREAD;
2194/** Nil native thread handle. */
2195#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
2196
2197/** Pipe handle. */
2198typedef R3R0PTRTYPE(struct RTPIPEINTERNAL RT_FAR *) RTPIPE;
2199/** Pointer to a pipe handle. */
2200typedef RTPIPE RT_FAR *PRTPIPE;
2201/** Nil pipe handle.
2202 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
2203#define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
2204
2205/** @typedef RTPOLLSET
2206 * Poll set handle. */
2207typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL RT_FAR *) RTPOLLSET;
2208/** Pointer to a poll set handle. */
2209typedef RTPOLLSET RT_FAR *PRTPOLLSET;
2210/** Nil poll set handle handle. */
2211#define NIL_RTPOLLSET ((RTPOLLSET)0)
2212
2213/** Process identifier. */
2214typedef uint32_t RTPROCESS;
2215/** Pointer to a process identifier. */
2216typedef RTPROCESS RT_FAR *PRTPROCESS;
2217/** Nil process identifier. */
2218#define NIL_RTPROCESS (~(RTPROCESS)0)
2219
2220/** Process ring-0 handle. */
2221typedef RTR0UINTPTR RTR0PROCESS;
2222/** Pointer to a ring-0 process handle. */
2223typedef RTR0PROCESS RT_FAR *PRTR0PROCESS;
2224/** Nil ring-0 process handle. */
2225#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
2226
2227/** @typedef RTSEMEVENT
2228 * Event Semaphore handle. */
2229typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL RT_FAR *) RTSEMEVENT;
2230/** Pointer to an event semaphore handle. */
2231typedef RTSEMEVENT RT_FAR *PRTSEMEVENT;
2232/** Nil event semaphore handle. */
2233#define NIL_RTSEMEVENT 0
2234
2235/** @typedef RTSEMEVENTMULTI
2236 * Event Multiple Release Semaphore handle. */
2237typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL RT_FAR *) RTSEMEVENTMULTI;
2238/** Pointer to an event multiple release semaphore handle. */
2239typedef RTSEMEVENTMULTI RT_FAR *PRTSEMEVENTMULTI;
2240/** Nil multiple release event semaphore handle. */
2241#define NIL_RTSEMEVENTMULTI 0
2242
2243/** @typedef RTSEMFASTMUTEX
2244 * Fast mutex Semaphore handle. */
2245typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL RT_FAR *) RTSEMFASTMUTEX;
2246/** Pointer to a fast mutex semaphore handle. */
2247typedef RTSEMFASTMUTEX RT_FAR *PRTSEMFASTMUTEX;
2248/** Nil fast mutex semaphore handle. */
2249#define NIL_RTSEMFASTMUTEX 0
2250
2251/** @typedef RTSEMMUTEX
2252 * Mutex Semaphore handle. */
2253typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL RT_FAR *) RTSEMMUTEX;
2254/** Pointer to a mutex semaphore handle. */
2255typedef RTSEMMUTEX RT_FAR *PRTSEMMUTEX;
2256/** Nil mutex semaphore handle. */
2257#define NIL_RTSEMMUTEX 0
2258
2259/** @typedef RTSEMSPINMUTEX
2260 * Spinning mutex Semaphore handle. */
2261typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL RT_FAR *) RTSEMSPINMUTEX;
2262/** Pointer to a spinning mutex semaphore handle. */
2263typedef RTSEMSPINMUTEX RT_FAR *PRTSEMSPINMUTEX;
2264/** Nil spinning mutex semaphore handle. */
2265#define NIL_RTSEMSPINMUTEX 0
2266
2267/** @typedef RTSEMRW
2268 * Read/Write Semaphore handle. */
2269typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL RT_FAR *) RTSEMRW;
2270/** Pointer to a read/write semaphore handle. */
2271typedef RTSEMRW RT_FAR *PRTSEMRW;
2272/** Nil read/write semaphore handle. */
2273#define NIL_RTSEMRW 0
2274
2275/** @typedef RTSEMXROADS
2276 * Crossroads semaphore handle. */
2277typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL RT_FAR *) RTSEMXROADS;
2278/** Pointer to a crossroads semaphore handle. */
2279typedef RTSEMXROADS RT_FAR *PRTSEMXROADS;
2280/** Nil crossroads semaphore handle. */
2281#define NIL_RTSEMXROADS ((RTSEMXROADS)0)
2282
2283/** Spinlock handle. */
2284typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL RT_FAR *) RTSPINLOCK;
2285/** Pointer to a spinlock handle. */
2286typedef RTSPINLOCK RT_FAR *PRTSPINLOCK;
2287/** Nil spinlock handle. */
2288#define NIL_RTSPINLOCK 0
2289
2290/** Socket handle. */
2291typedef R3R0PTRTYPE(struct RTSOCKETINT RT_FAR *) RTSOCKET;
2292/** Pointer to socket handle. */
2293typedef RTSOCKET RT_FAR *PRTSOCKET;
2294/** Nil socket handle. */
2295#define NIL_RTSOCKET ((RTSOCKET)0)
2296
2297/** Pointer to a RTTCPSERVER handle. */
2298typedef struct RTTCPSERVER RT_FAR *PRTTCPSERVER;
2299/** Pointer to a RTTCPSERVER handle. */
2300typedef PRTTCPSERVER RT_FAR *PPRTTCPSERVER;
2301/** Nil RTTCPSERVER handle. */
2302#define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
2303
2304/** Pointer to a RTUDPSERVER handle. */
2305typedef struct RTUDPSERVER RT_FAR *PRTUDPSERVER;
2306/** Pointer to a RTUDPSERVER handle. */
2307typedef PRTUDPSERVER RT_FAR *PPRTUDPSERVER;
2308/** Nil RTUDPSERVER handle. */
2309#define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
2310
2311/** Thread handle.*/
2312typedef R3R0PTRTYPE(struct RTTHREADINT RT_FAR *) RTTHREAD;
2313/** Pointer to thread handle. */
2314typedef RTTHREAD RT_FAR *PRTTHREAD;
2315/** Nil thread handle. */
2316#define NIL_RTTHREAD 0
2317
2318/** Thread context switching hook handle. */
2319typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT RT_FAR *) RTTHREADCTXHOOK;
2320/** Pointer to Thread context switching hook handle. */
2321typedef RTTHREADCTXHOOK RT_FAR *PRTTHREADCTXHOOK;
2322/** Nil Thread context switching hook handle. */
2323#define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
2324
2325/** A TLS index. */
2326typedef RTHCINTPTR RTTLS;
2327/** Pointer to a TLS index. */
2328typedef RTTLS RT_FAR *PRTTLS;
2329/** Pointer to a const TLS index. */
2330typedef RTTLS const RT_FAR *PCRTTLS;
2331/** NIL TLS index value. */
2332#define NIL_RTTLS ((RTTLS)-1)
2333
2334/** Trace buffer handle.
2335 * @remarks This is not a R3/R0 type like most other handles!
2336 */
2337typedef struct RTTRACEBUFINT RT_FAR *RTTRACEBUF;
2338/** Pointer to a trace buffer handle. */
2339typedef RTTRACEBUF RT_FAR *PRTTRACEBUF;
2340/** Nil trace buffer handle. */
2341#define NIL_RTTRACEBUF ((RTTRACEBUF)0)
2342/** The handle of the default trace buffer.
2343 * This can be used with any of the RTTraceBufAdd APIs. */
2344#define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
2345
2346/** Handle to a simple heap. */
2347typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL RT_FAR *) RTHEAPSIMPLE;
2348/** Pointer to a handle to a simple heap. */
2349typedef RTHEAPSIMPLE RT_FAR *PRTHEAPSIMPLE;
2350/** NIL simple heap handle. */
2351#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
2352
2353/** Handle to an offset based heap. */
2354typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL RT_FAR *) RTHEAPOFFSET;
2355/** Pointer to a handle to an offset based heap. */
2356typedef RTHEAPOFFSET RT_FAR *PRTHEAPOFFSET;
2357/** NIL offset based heap handle. */
2358#define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
2359
2360/** Handle to an environment block. */
2361typedef R3PTRTYPE(struct RTENVINTERNAL RT_FAR *) RTENV;
2362/** Pointer to a handle to an environment block. */
2363typedef RTENV RT_FAR *PRTENV;
2364/** NIL simple heap handle. */
2365#define NIL_RTENV ((RTENV)0)
2366
2367/** A CPU identifier.
2368 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
2369 * does it have to correspond to the bits in the affinity mask, at
2370 * least not until we've sorted out Windows NT. */
2371typedef uint32_t RTCPUID;
2372/** Pointer to a CPU identifier. */
2373typedef RTCPUID RT_FAR *PRTCPUID;
2374/** Pointer to a const CPU identifier. */
2375typedef RTCPUID const RT_FAR *PCRTCPUID;
2376/** Nil CPU Id. */
2377#define NIL_RTCPUID ((RTCPUID)~0)
2378
2379/** The maximum number of CPUs a set can contain and IPRT is able
2380 * to reference. (Should be max of support arch/platforms.)
2381 * @remarks Must be a multiple of 64 (see RTCPUSET). */
2382#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
2383# define RTCPUSET_MAX_CPUS 256
2384#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
2385# define RTCPUSET_MAX_CPUS 1024
2386#else
2387# define RTCPUSET_MAX_CPUS 64
2388#endif
2389/** A CPU set.
2390 * @note Treat this as an opaque type and always use RTCpuSet* for
2391 * manipulating it. */
2392typedef struct RTCPUSET
2393{
2394 /** The bitmap. */
2395 uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
2396} RTCPUSET;
2397/** Pointer to a CPU set. */
2398typedef RTCPUSET RT_FAR *PRTCPUSET;
2399/** Pointer to a const CPU set. */
2400typedef RTCPUSET const RT_FAR *PCRTCPUSET;
2401
2402/** A handle table handle. */
2403typedef R3R0PTRTYPE(struct RTHANDLETABLEINT RT_FAR *) RTHANDLETABLE;
2404/** A pointer to a handle table handle. */
2405typedef RTHANDLETABLE RT_FAR *PRTHANDLETABLE;
2406/** @def NIL_RTHANDLETABLE
2407 * NIL handle table handle. */
2408#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
2409
2410/** A handle to a low resolution timer. */
2411typedef R3R0PTRTYPE(struct RTTIMERLRINT RT_FAR *) RTTIMERLR;
2412/** A pointer to a low resolution timer handle. */
2413typedef RTTIMERLR RT_FAR *PRTTIMERLR;
2414/** @def NIL_RTTIMERLR
2415 * NIL low resolution timer handle value. */
2416#define NIL_RTTIMERLR ((RTTIMERLR)0)
2417
2418/** Handle to a random number generator. */
2419typedef R3R0PTRTYPE(struct RTRANDINT RT_FAR *) RTRAND;
2420/** Pointer to a random number generator handle. */
2421typedef RTRAND RT_FAR *PRTRAND;
2422/** NIL random number generator handle value. */
2423#define NIL_RTRAND ((RTRAND)0)
2424
2425/** Debug address space handle. */
2426typedef R3R0PTRTYPE(struct RTDBGASINT RT_FAR *) RTDBGAS;
2427/** Pointer to a debug address space handle. */
2428typedef RTDBGAS RT_FAR *PRTDBGAS;
2429/** NIL debug address space handle. */
2430#define NIL_RTDBGAS ((RTDBGAS)0)
2431
2432/** Debug module handle. */
2433typedef R3R0PTRTYPE(struct RTDBGMODINT RT_FAR *) RTDBGMOD;
2434/** Pointer to a debug module handle. */
2435typedef RTDBGMOD RT_FAR *PRTDBGMOD;
2436/** NIL debug module handle. */
2437#define NIL_RTDBGMOD ((RTDBGMOD)0)
2438
2439/** Pointer to an unwind machine state. */
2440typedef struct RTDBGUNWINDSTATE RT_FAR *PRTDBGUNWINDSTATE;
2441/** Pointer to a const unwind machine state. */
2442typedef struct RTDBGUNWINDSTATE const RT_FAR *PCRTDBGUNWINDSTATE;
2443
2444/** Manifest handle. */
2445typedef struct RTMANIFESTINT RT_FAR *RTMANIFEST;
2446/** Pointer to a manifest handle. */
2447typedef RTMANIFEST RT_FAR *PRTMANIFEST;
2448/** NIL manifest handle. */
2449#define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
2450
2451/** Memory pool handle. */
2452typedef R3R0PTRTYPE(struct RTMEMPOOLINT RT_FAR *) RTMEMPOOL;
2453/** Pointer to a memory pool handle. */
2454typedef RTMEMPOOL RT_FAR *PRTMEMPOOL;
2455/** NIL memory pool handle. */
2456#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
2457/** The default memory pool handle. */
2458#define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
2459
2460/** String cache handle. */
2461typedef R3R0PTRTYPE(struct RTSTRCACHEINT RT_FAR *) RTSTRCACHE;
2462/** Pointer to a string cache handle. */
2463typedef RTSTRCACHE RT_FAR *PRTSTRCACHE;
2464/** NIL string cache handle. */
2465#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
2466/** The default string cache handle. */
2467#define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
2468
2469
2470/** Virtual Filesystem handle. */
2471typedef struct RTVFSINTERNAL RT_FAR *RTVFS;
2472/** Pointer to a VFS handle. */
2473typedef RTVFS RT_FAR *PRTVFS;
2474/** A NIL VFS handle. */
2475#define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
2476
2477/** Virtual Filesystem base object handle. */
2478typedef struct RTVFSOBJINTERNAL RT_FAR *RTVFSOBJ;
2479/** Pointer to a VFS base object handle. */
2480typedef RTVFSOBJ RT_FAR *PRTVFSOBJ;
2481/** A NIL VFS base object handle. */
2482#define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
2483
2484/** Virtual Filesystem directory handle. */
2485typedef struct RTVFSDIRINTERNAL RT_FAR *RTVFSDIR;
2486/** Pointer to a VFS directory handle. */
2487typedef RTVFSDIR RT_FAR *PRTVFSDIR;
2488/** A NIL VFS directory handle. */
2489#define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
2490
2491/** Virtual Filesystem filesystem stream handle. */
2492typedef struct RTVFSFSSTREAMINTERNAL RT_FAR *RTVFSFSSTREAM;
2493/** Pointer to a VFS filesystem stream handle. */
2494typedef RTVFSFSSTREAM RT_FAR *PRTVFSFSSTREAM;
2495/** A NIL VFS filesystem stream handle. */
2496#define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
2497
2498/** Virtual Filesystem I/O stream handle. */
2499typedef struct RTVFSIOSTREAMINTERNAL RT_FAR *RTVFSIOSTREAM;
2500/** Pointer to a VFS I/O stream handle. */
2501typedef RTVFSIOSTREAM RT_FAR *PRTVFSIOSTREAM;
2502/** A NIL VFS I/O stream handle. */
2503#define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
2504
2505/** Virtual Filesystem file handle. */
2506typedef struct RTVFSFILEINTERNAL RT_FAR *RTVFSFILE;
2507/** Pointer to a VFS file handle. */
2508typedef RTVFSFILE RT_FAR *PRTVFSFILE;
2509/** A NIL VFS file handle. */
2510#define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
2511
2512/** Virtual Filesystem symbolic link handle. */
2513typedef struct RTVFSSYMLINKINTERNAL RT_FAR *RTVFSSYMLINK;
2514/** Pointer to a VFS symbolic link handle. */
2515typedef RTVFSSYMLINK RT_FAR *PRTVFSSYMLINK;
2516/** A NIL VFS symbolic link handle. */
2517#define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
2518
2519/** Async I/O manager handle. */
2520typedef struct RTAIOMGRINT RT_FAR *RTAIOMGR;
2521/** Pointer to a async I/O manager handle. */
2522typedef RTAIOMGR RT_FAR *PRTAIOMGR;
2523/** A NIL async I/O manager handle. */
2524#define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
2525
2526/** Async I/O manager file handle. */
2527typedef struct RTAIOMGRFILEINT RT_FAR *RTAIOMGRFILE;
2528/** Pointer to a async I/O manager file handle. */
2529typedef RTAIOMGRFILE RT_FAR *PRTAIOMGRFILE;
2530/** A NIL async I/O manager file handle. */
2531#define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
2532
2533/** Kernel module information record handle. */
2534typedef struct RTKRNLMODINFOINT RT_FAR *RTKRNLMODINFO;
2535/** Pointer to a kernel information record handle. */
2536typedef RTKRNLMODINFO RT_FAR *PRTKRNLMODINFO;
2537/** A NIL kernel module information record handle. */
2538#define NIL_RTKRNLMODINFO ((RTKRNLMODINFO)~(uintptr_t)0);
2539
2540/** Shared memory object handle. */
2541typedef struct RTSHMEMINT RT_FAR *RTSHMEM;
2542/** Pointer to a shared memory object handle. */
2543typedef RTSHMEM RT_FAR *PRTSHMEM;
2544/** A NIL shared memory object handle. */
2545#define NIL_RTSHMEM ((RTSHMEM)~(uintptr_t)0)
2546
2547/**
2548 * Handle type.
2549 *
2550 * This is usually used together with RTHANDLEUNION.
2551 */
2552typedef enum RTHANDLETYPE
2553{
2554 /** The invalid zero value. */
2555 RTHANDLETYPE_INVALID = 0,
2556 /** File handle. */
2557 RTHANDLETYPE_FILE,
2558 /** Pipe handle */
2559 RTHANDLETYPE_PIPE,
2560 /** Socket handle. */
2561 RTHANDLETYPE_SOCKET,
2562 /** Thread handle. */
2563 RTHANDLETYPE_THREAD,
2564 /** The end of the valid values. */
2565 RTHANDLETYPE_END,
2566 /** The 32-bit type blow up. */
2567 RTHANDLETYPE_32BIT_HACK = 0x7fffffff
2568} RTHANDLETYPE;
2569/** Pointer to a handle type. */
2570typedef RTHANDLETYPE RT_FAR *PRTHANDLETYPE;
2571
2572/**
2573 * Handle union.
2574 *
2575 * This is usually used together with RTHANDLETYPE or as RTHANDLE.
2576 */
2577typedef union RTHANDLEUNION
2578{
2579 RTFILE hFile; /**< File handle. */
2580 RTPIPE hPipe; /**< Pipe handle. */
2581 RTSOCKET hSocket; /**< Socket handle. */
2582 RTTHREAD hThread; /**< Thread handle. */
2583 /** Generic integer handle value.
2584 * Note that RTFILE is not yet pointer sized, so accessing it via this member
2585 * isn't necessarily safe or fully portable. */
2586 RTHCUINTPTR uInt;
2587} RTHANDLEUNION;
2588/** Pointer to a handle union. */
2589typedef RTHANDLEUNION RT_FAR *PRTHANDLEUNION;
2590/** Pointer to a const handle union. */
2591typedef RTHANDLEUNION const RT_FAR *PCRTHANDLEUNION;
2592
2593/**
2594 * Generic handle.
2595 */
2596typedef struct RTHANDLE
2597{
2598 /** The handle type. */
2599 RTHANDLETYPE enmType;
2600 /** The handle value. */
2601 RTHANDLEUNION u;
2602} RTHANDLE;
2603/** Pointer to a generic handle. */
2604typedef RTHANDLE RT_FAR *PRTHANDLE;
2605/** Pointer to a const generic handle. */
2606typedef RTHANDLE const RT_FAR *PCRTHANDLE;
2607
2608
2609/**
2610 * Standard handles.
2611 *
2612 * @remarks These have the correct file descriptor values for unixy systems and
2613 * can be used directly in code specific to those platforms.
2614 */
2615typedef enum RTHANDLESTD
2616{
2617 /** Invalid standard handle. */
2618 RTHANDLESTD_INVALID = -1,
2619 /** The standard input handle. */
2620 RTHANDLESTD_INPUT = 0,
2621 /** The standard output handle. */
2622 RTHANDLESTD_OUTPUT,
2623 /** The standard error handle. */
2624 RTHANDLESTD_ERROR,
2625 /** The typical 32-bit type hack. */
2626 RTHANDLESTD_32BIT_HACK = 0x7fffffff
2627} RTHANDLESTD;
2628
2629
2630/**
2631 * Error info.
2632 *
2633 * See RTErrInfo*.
2634 */
2635typedef struct RTERRINFO
2636{
2637 /** Flags, see RTERRINFO_FLAGS_XXX. */
2638 uint32_t fFlags;
2639 /** The status code. */
2640 int32_t rc;
2641 /** The size of the message */
2642 size_t cbMsg;
2643 /** The error buffer. */
2644 char *pszMsg;
2645 /** Reserved for future use. */
2646 void *apvReserved[2];
2647} RTERRINFO;
2648/** Pointer to an error info structure. */
2649typedef RTERRINFO RT_FAR *PRTERRINFO;
2650/** Pointer to a const error info structure. */
2651typedef RTERRINFO const RT_FAR *PCRTERRINFO;
2652
2653/**
2654 * Static error info structure, see RTErrInfoInitStatic.
2655 */
2656typedef struct RTERRINFOSTATIC
2657{
2658 /** The core error info. */
2659 RTERRINFO Core;
2660 /** The static message buffer. */
2661 char szMsg[3072];
2662} RTERRINFOSTATIC;
2663/** Pointer to a error info buffer. */
2664typedef RTERRINFOSTATIC RT_FAR *PRTERRINFOSTATIC;
2665/** Pointer to a const static error info buffer. */
2666typedef RTERRINFOSTATIC const RT_FAR *PCRTERRINFOSTATIC;
2667
2668
2669/**
2670 * UUID data type.
2671 *
2672 * See RTUuid*.
2673 *
2674 * @remarks IPRT defines that the first three integers in the @c Gen struct
2675 * interpretation are in little endian representation. This is
2676 * different to many other UUID implementation, and requires
2677 * conversion if you need to achieve consistent results.
2678 */
2679typedef union RTUUID
2680{
2681 /** 8-bit view. */
2682 uint8_t au8[16];
2683 /** 16-bit view. */
2684 uint16_t au16[8];
2685 /** 32-bit view. */
2686 uint32_t au32[4];
2687 /** 64-bit view. */
2688 uint64_t au64[2];
2689 /** The way the UUID is declared by the DCE specification. */
2690 struct
2691 {
2692 uint32_t u32TimeLow;
2693 uint16_t u16TimeMid;
2694 uint16_t u16TimeHiAndVersion;
2695 uint8_t u8ClockSeqHiAndReserved;
2696 uint8_t u8ClockSeqLow;
2697 uint8_t au8Node[6];
2698 } Gen;
2699} RTUUID;
2700/** Pointer to UUID data. */
2701typedef RTUUID RT_FAR *PRTUUID;
2702/** Pointer to readonly UUID data. */
2703typedef const RTUUID RT_FAR *PCRTUUID;
2704
2705/** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
2706#define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
2707
2708/** UUID string maximum length. */
2709#define RTUUID_STR_LENGTH 37
2710
2711
2712/** Compression handle. */
2713typedef struct RTZIPCOMP RT_FAR *PRTZIPCOMP;
2714/** Decompressor handle. */
2715typedef struct RTZIPDECOMP RT_FAR *PRTZIPDECOMP;
2716
2717
2718/**
2719 * Unicode Code Point.
2720 */
2721typedef uint32_t RTUNICP;
2722/** Pointer to an Unicode Code Point. */
2723typedef RTUNICP RT_FAR *PRTUNICP;
2724/** Pointer to an Unicode Code Point. */
2725typedef const RTUNICP RT_FAR *PCRTUNICP;
2726/** Max value a RTUNICP type can hold. */
2727#define RTUNICP_MAX ( ~(RTUNICP)0 )
2728/** Invalid code point.
2729 * This is returned when encountered invalid encodings or invalid
2730 * unicode code points. */
2731#define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
2732
2733
2734/**
2735 * UTF-16 character.
2736 * @remark wchar_t is not usable since it's compiler defined.
2737 * @remark When we use the term character we're not talking about unicode code point, but
2738 * the basic unit of the string encoding. Thus cwc - count of wide chars - means
2739 * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
2740 * and cch means count of the typedef 'char', which is assumed to be an octet.
2741 */
2742typedef uint16_t RTUTF16;
2743/** Pointer to a UTF-16 character. */
2744typedef RTUTF16 RT_FAR *PRTUTF16;
2745/** Pointer to a const UTF-16 character. */
2746typedef const RTUTF16 RT_FAR *PCRTUTF16;
2747
2748
2749/**
2750 * String tuple to go with the RT_STR_TUPLE macro.
2751 */
2752typedef struct RTSTRTUPLE
2753{
2754 /** The string. */
2755 const char *psz;
2756 /** The string length. */
2757 size_t cch;
2758} RTSTRTUPLE;
2759/** Pointer to a string tuple. */
2760typedef RTSTRTUPLE RT_FAR *PRTSTRTUPLE;
2761/** Pointer to a const string tuple. */
2762typedef RTSTRTUPLE const RT_FAR *PCRTSTRTUPLE;
2763
2764/**
2765 * Wait for ever if we have to.
2766 */
2767#define RT_INDEFINITE_WAIT (~0U)
2768
2769
2770/**
2771 * Generic process callback.
2772 *
2773 * @returns VBox status code. Failure will cancel the operation.
2774 * @param uPercentage The percentage of the operation which has been completed.
2775 * @param pvUser The user specified argument.
2776 */
2777typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
2778/** Pointer to a generic progress callback function, FNRTPROCESS(). */
2779typedef FNRTPROGRESS *PFNRTPROGRESS;
2780
2781/**
2782 * Generic vprintf-like callback function for dumpers.
2783 *
2784 * @param pvUser User argument.
2785 * @param pszFormat The format string.
2786 * @param va Arguments for the format string.
2787 */
2788typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
2789/** Pointer to a generic printf-like function for dumping. */
2790typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
2791
2792
2793/**
2794 * A point in a two dimentional coordinate system.
2795 */
2796typedef struct RTPOINT
2797{
2798 /** X coordinate. */
2799 int32_t x;
2800 /** Y coordinate. */
2801 int32_t y;
2802} RTPOINT;
2803/** Pointer to a point. */
2804typedef RTPOINT RT_FAR *PRTPOINT;
2805/** Pointer to a const point. */
2806typedef const RTPOINT RT_FAR *PCRTPOINT;
2807
2808
2809/**
2810 * Rectangle data type, double point.
2811 */
2812typedef struct RTRECT
2813{
2814 /** left X coordinate. */
2815 int32_t xLeft;
2816 /** top Y coordinate. */
2817 int32_t yTop;
2818 /** right X coordinate. (exclusive) */
2819 int32_t xRight;
2820 /** bottom Y coordinate. (exclusive) */
2821 int32_t yBottom;
2822} RTRECT;
2823/** Pointer to a double point rectangle. */
2824typedef RTRECT RT_FAR *PRTRECT;
2825/** Pointer to a const double point rectangle. */
2826typedef const RTRECT RT_FAR *PCRTRECT;
2827
2828
2829/**
2830 * Rectangle data type, point + size.
2831 */
2832typedef struct RTRECT2
2833{
2834 /** X coordinate.
2835 * Unless stated otherwise, this is the top left corner. */
2836 int32_t x;
2837 /** Y coordinate.
2838 * Unless stated otherwise, this is the top left corner. */
2839 int32_t y;
2840 /** The width.
2841 * Unless stated otherwise, this is to the right of (x,y) and will not
2842 * be a negative number. */
2843 int32_t cx;
2844 /** The height.
2845 * Unless stated otherwise, this is down from (x,y) and will not be a
2846 * negative number. */
2847 int32_t cy;
2848} RTRECT2;
2849/** Pointer to a point + size rectangle. */
2850typedef RTRECT2 RT_FAR *PRTRECT2;
2851/** Pointer to a const point + size rectangle. */
2852typedef const RTRECT2 RT_FAR *PCRTRECT2;
2853
2854
2855/**
2856 * The size of a rectangle.
2857 */
2858typedef struct RTRECTSIZE
2859{
2860 /** The width (along the x-axis). */
2861 uint32_t cx;
2862 /** The height (along the y-axis). */
2863 uint32_t cy;
2864} RTRECTSIZE;
2865/** Pointer to a rectangle size. */
2866typedef RTRECTSIZE RT_FAR *PRTRECTSIZE;
2867/** Pointer to a const rectangle size. */
2868typedef const RTRECTSIZE RT_FAR *PCRTRECTSIZE;
2869
2870
2871/**
2872 * Ethernet MAC address.
2873 *
2874 * The first 24 bits make up the Organisationally Unique Identifier (OUI),
2875 * where the first bit (little endian) indicates multicast (set) / unicast,
2876 * and the second bit indicates locally (set) / global administered. If all
2877 * bits are set, it's a broadcast.
2878 */
2879typedef union RTMAC
2880{
2881 /** @todo add a bitfield view of this stuff. */
2882 /** 8-bit view. */
2883 uint8_t au8[6];
2884 /** 16-bit view. */
2885 uint16_t au16[3];
2886} RTMAC;
2887/** Pointer to a MAC address. */
2888typedef RTMAC RT_FAR *PRTMAC;
2889/** Pointer to a readonly MAC address. */
2890typedef const RTMAC RT_FAR *PCRTMAC;
2891
2892
2893/** Pointer to a lock validator record.
2894 * The structure definition is found in iprt/lockvalidator.h. */
2895typedef struct RTLOCKVALRECEXCL RT_FAR *PRTLOCKVALRECEXCL;
2896/** Pointer to a record of one ownership share.
2897 * The structure definition is found in iprt/lockvalidator.h. */
2898typedef struct RTLOCKVALRECSHRD RT_FAR *PRTLOCKVALRECSHRD;
2899/** Pointer to a lock validator source position.
2900 * The structure definition is found in iprt/lockvalidator.h. */
2901typedef struct RTLOCKVALSRCPOS RT_FAR *PRTLOCKVALSRCPOS;
2902/** Pointer to a const lock validator source position.
2903 * The structure definition is found in iprt/lockvalidator.h. */
2904typedef struct RTLOCKVALSRCPOS const RT_FAR *PCRTLOCKVALSRCPOS;
2905
2906/** @name Special sub-class values.
2907 * The range 16..UINT32_MAX is available to the user, the range 0..15 is
2908 * reserved for the lock validator. In the user range the locks can only be
2909 * taking in ascending order.
2910 * @{ */
2911/** Invalid value. */
2912#define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
2913/** Not allowed to be taken with any other locks in the same class.
2914 * This is the recommended value. */
2915#define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
2916/** Any order is allowed within the class. */
2917#define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
2918/** The first user value. */
2919#define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
2920/** @} */
2921
2922
2923/**
2924 * Digest types.
2925 */
2926typedef enum RTDIGESTTYPE
2927{
2928 /** Invalid digest value. */
2929 RTDIGESTTYPE_INVALID = 0,
2930 /** Unknown digest type. */
2931 RTDIGESTTYPE_UNKNOWN,
2932 /** CRC32 checksum. */
2933 RTDIGESTTYPE_CRC32,
2934 /** CRC64 checksum. */
2935 RTDIGESTTYPE_CRC64,
2936 /** MD2 checksum (unsafe!). */
2937 RTDIGESTTYPE_MD2,
2938 /** MD4 checksum (unsafe!!). */
2939 RTDIGESTTYPE_MD4,
2940 /** MD5 checksum (unsafe!). */
2941 RTDIGESTTYPE_MD5,
2942 /** SHA-1 checksum (unsafe!). */
2943 RTDIGESTTYPE_SHA1,
2944 /** SHA-224 checksum. */
2945 RTDIGESTTYPE_SHA224,
2946 /** SHA-256 checksum. */
2947 RTDIGESTTYPE_SHA256,
2948 /** SHA-384 checksum. */
2949 RTDIGESTTYPE_SHA384,
2950 /** SHA-512 checksum. */
2951 RTDIGESTTYPE_SHA512,
2952 /** SHA-512/224 checksum. */
2953 RTDIGESTTYPE_SHA512T224,
2954 /** SHA-512/256 checksum. */
2955 RTDIGESTTYPE_SHA512T256,
2956 /** End of valid types. */
2957 RTDIGESTTYPE_END,
2958 /** Usual 32-bit type blowup. */
2959 RTDIGESTTYPE_32BIT_HACK = 0x7fffffff
2960} RTDIGESTTYPE;
2961
2962/**
2963 * Process exit codes.
2964 */
2965typedef enum RTEXITCODE
2966{
2967 /** Success. */
2968 RTEXITCODE_SUCCESS = 0,
2969 /** General failure. */
2970 RTEXITCODE_FAILURE = 1,
2971 /** Invalid arguments. */
2972 RTEXITCODE_SYNTAX = 2,
2973 /** Initialization failure (usually IPRT, but could be used for other
2974 * components as well). */
2975 RTEXITCODE_INIT = 3,
2976 /** Test skipped. */
2977 RTEXITCODE_SKIPPED = 4,
2978 /** The end of valid exit codes. */
2979 RTEXITCODE_END,
2980 /** The usual 32-bit type hack. */
2981 RTEXITCODE_32BIT_HACK = 0x7fffffff
2982} RTEXITCODE;
2983
2984/**
2985 * Range descriptor.
2986 */
2987typedef struct RTRANGE
2988{
2989 /** Start offset. */
2990 uint64_t offStart;
2991 /** Range size. */
2992 size_t cbRange;
2993} RTRANGE;
2994/** Pointer to a range descriptor. */
2995typedef RTRANGE RT_FAR *PRTRANGE;
2996/** Pointer to a readonly range descriptor. */
2997typedef const RTRANGE RT_FAR *PCRTRANGE;
2998
2999
3000/**
3001 * Generic pointer union.
3002 */
3003typedef union RTPTRUNION
3004{
3005 /** Pointer into the void. */
3006 void RT_FAR *pv;
3007 /** As a signed integer. */
3008 intptr_t i;
3009 /** As an unsigned integer. */
3010 uintptr_t u;
3011 /** Pointer to char value. */
3012 char RT_FAR *pch;
3013 /** Pointer to char value. */
3014 unsigned char RT_FAR *puch;
3015 /** Pointer to a int value. */
3016 int RT_FAR *pi;
3017 /** Pointer to a unsigned int value. */
3018 unsigned int RT_FAR *pu;
3019 /** Pointer to a long value. */
3020 long RT_FAR *pl;
3021 /** Pointer to a long value. */
3022 unsigned long RT_FAR *pul;
3023 /** Pointer to a 8-bit unsigned value. */
3024 uint8_t RT_FAR *pu8;
3025 /** Pointer to a 16-bit unsigned value. */
3026 uint16_t RT_FAR *pu16;
3027 /** Pointer to a 32-bit unsigned value. */
3028 uint32_t RT_FAR *pu32;
3029 /** Pointer to a 64-bit unsigned value. */
3030 uint64_t RT_FAR *pu64;
3031 /** Pointer to a 8-bit signed value. */
3032 int8_t RT_FAR *pi8;
3033 /** Pointer to a 16-bit signed value. */
3034 int16_t RT_FAR *pi16;
3035 /** Pointer to a 32-bit signed value. */
3036 int32_t RT_FAR *pi32;
3037 /** Pointer to a 64-bit signed value. */
3038 int64_t RT_FAR *pi64;
3039 /** Pointer to a UTF-16 character. */
3040 PRTUTF16 pwc;
3041 /** Pointer to a UUID character. */
3042 PRTUUID pUuid;
3043} RTPTRUNION;
3044/** Pointer to a pointer union. */
3045typedef RTPTRUNION RT_FAR *PRTPTRUNION;
3046
3047/**
3048 * Generic const pointer union.
3049 */
3050typedef union RTCPTRUNION
3051{
3052 /** Pointer into the void. */
3053 void const RT_FAR *pv;
3054 /** As a signed integer. */
3055 intptr_t i;
3056 /** As an unsigned integer. */
3057 uintptr_t u;
3058 /** Pointer to char value. */
3059 char const RT_FAR *pch;
3060 /** Pointer to char value. */
3061 unsigned char const RT_FAR *puch;
3062 /** Pointer to a int value. */
3063 int const RT_FAR *pi;
3064 /** Pointer to a unsigned int value. */
3065 unsigned int const RT_FAR *pu;
3066 /** Pointer to a long value. */
3067 long const RT_FAR *pl;
3068 /** Pointer to a long value. */
3069 unsigned long const RT_FAR *pul;
3070 /** Pointer to a 8-bit unsigned value. */
3071 uint8_t const RT_FAR *pu8;
3072 /** Pointer to a 16-bit unsigned value. */
3073 uint16_t const RT_FAR *pu16;
3074 /** Pointer to a 32-bit unsigned value. */
3075 uint32_t const RT_FAR *pu32;
3076 /** Pointer to a 64-bit unsigned value. */
3077 uint64_t const RT_FAR *pu64;
3078 /** Pointer to a 8-bit signed value. */
3079 int8_t const RT_FAR *pi8;
3080 /** Pointer to a 16-bit signed value. */
3081 int16_t const RT_FAR *pi16;
3082 /** Pointer to a 32-bit signed value. */
3083 int32_t const RT_FAR *pi32;
3084 /** Pointer to a 64-bit signed value. */
3085 int64_t const RT_FAR *pi64;
3086 /** Pointer to a UTF-16 character. */
3087 PCRTUTF16 pwc;
3088 /** Pointer to a UUID character. */
3089 PCRTUUID pUuid;
3090} RTCPTRUNION;
3091/** Pointer to a const pointer union. */
3092typedef RTCPTRUNION RT_FAR *PRTCPTRUNION;
3093
3094/**
3095 * Generic volatile pointer union.
3096 */
3097typedef union RTVPTRUNION
3098{
3099 /** Pointer into the void. */
3100 void volatile RT_FAR *pv;
3101 /** As a signed integer. */
3102 intptr_t i;
3103 /** As an unsigned integer. */
3104 uintptr_t u;
3105 /** Pointer to char value. */
3106 char volatile RT_FAR *pch;
3107 /** Pointer to char value. */
3108 unsigned char volatile RT_FAR *puch;
3109 /** Pointer to a int value. */
3110 int volatile RT_FAR *pi;
3111 /** Pointer to a unsigned int value. */
3112 unsigned int volatile RT_FAR *pu;
3113 /** Pointer to a long value. */
3114 long volatile RT_FAR *pl;
3115 /** Pointer to a long value. */
3116 unsigned long volatile RT_FAR *pul;
3117 /** Pointer to a 8-bit unsigned value. */
3118 uint8_t volatile RT_FAR *pu8;
3119 /** Pointer to a 16-bit unsigned value. */
3120 uint16_t volatile RT_FAR *pu16;
3121 /** Pointer to a 32-bit unsigned value. */
3122 uint32_t volatile RT_FAR *pu32;
3123 /** Pointer to a 64-bit unsigned value. */
3124 uint64_t volatile RT_FAR *pu64;
3125 /** Pointer to a 8-bit signed value. */
3126 int8_t volatile RT_FAR *pi8;
3127 /** Pointer to a 16-bit signed value. */
3128 int16_t volatile RT_FAR *pi16;
3129 /** Pointer to a 32-bit signed value. */
3130 int32_t volatile RT_FAR *pi32;
3131 /** Pointer to a 64-bit signed value. */
3132 int64_t volatile RT_FAR *pi64;
3133 /** Pointer to a UTF-16 character. */
3134 RTUTF16 volatile RT_FAR *pwc;
3135 /** Pointer to a UUID character. */
3136 RTUUID volatile RT_FAR *pUuid;
3137} RTVPTRUNION;
3138/** Pointer to a const pointer union. */
3139typedef RTVPTRUNION RT_FAR *PRTVPTRUNION;
3140
3141/**
3142 * Generic const volatile pointer union.
3143 */
3144typedef union RTCVPTRUNION
3145{
3146 /** Pointer into the void. */
3147 void const volatile RT_FAR *pv;
3148 /** As a signed integer. */
3149 intptr_t i;
3150 /** As an unsigned integer. */
3151 uintptr_t u;
3152 /** Pointer to char value. */
3153 char const volatile RT_FAR *pch;
3154 /** Pointer to char value. */
3155 unsigned char const volatile RT_FAR *puch;
3156 /** Pointer to a int value. */
3157 int const volatile RT_FAR *pi;
3158 /** Pointer to a unsigned int value. */
3159 unsigned int const volatile RT_FAR *pu;
3160 /** Pointer to a long value. */
3161 long const volatile RT_FAR *pl;
3162 /** Pointer to a long value. */
3163 unsigned long const volatile RT_FAR *pul;
3164 /** Pointer to a 8-bit unsigned value. */
3165 uint8_t const volatile RT_FAR *pu8;
3166 /** Pointer to a 16-bit unsigned value. */
3167 uint16_t const volatile RT_FAR *pu16;
3168 /** Pointer to a 32-bit unsigned value. */
3169 uint32_t const volatile RT_FAR *pu32;
3170 /** Pointer to a 64-bit unsigned value. */
3171 uint64_t const volatile RT_FAR *pu64;
3172 /** Pointer to a 8-bit signed value. */
3173 int8_t const volatile RT_FAR *pi8;
3174 /** Pointer to a 16-bit signed value. */
3175 int16_t const volatile RT_FAR *pi16;
3176 /** Pointer to a 32-bit signed value. */
3177 int32_t const volatile RT_FAR *pi32;
3178 /** Pointer to a 64-bit signed value. */
3179 int64_t const volatile RT_FAR *pi64;
3180 /** Pointer to a UTF-16 character. */
3181 RTUTF16 const volatile RT_FAR *pwc;
3182 /** Pointer to a UUID character. */
3183 RTUUID const volatile RT_FAR *pUuid;
3184} RTCVPTRUNION;
3185/** Pointer to a const pointer union. */
3186typedef RTCVPTRUNION RT_FAR *PRTCVPTRUNION;
3187
3188
3189
3190#ifdef __cplusplus
3191/**
3192 * Strict type validation helper class.
3193 *
3194 * See RTErrStrictType and RT_SUCCESS_NP.
3195 */
3196class RTErrStrictType2
3197{
3198protected:
3199 /** The status code. */
3200 int32_t m_rc;
3201
3202public:
3203 /**
3204 * Constructor.
3205 * @param rc IPRT style status code.
3206 */
3207 RTErrStrictType2(int32_t rc) : m_rc(rc)
3208 {
3209 }
3210
3211 /**
3212 * Get the status code.
3213 * @returns IPRT style status code.
3214 */
3215 int32_t getValue() const
3216 {
3217 return m_rc;
3218 }
3219};
3220#endif /* __cplusplus */
3221/** @} */
3222
3223#endif /* !IPRT_INCLUDED_types_h */
3224
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use