VirtualBox

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

Last change on this file since 58703 was 58703, checked in by vboxsync, 9 years ago

iprt/types.h: Introduced RTCCUINTXREG and RTCCINTXREG types for dealing with 32-bit registers in 16-bit mode (ARCH_BITS == 16).

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