VirtualBox

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

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

IEM: Implemented fbstp instruction (used by OLE and indirectly MS Word 6.0 and similar).

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