VirtualBox

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

Last change on this file since 76512 was 76507, checked in by vboxsync, 6 years ago

/include: scm --fix-header-guards. bugref:9344

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

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