VirtualBox

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

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

iprt/types.h: Fix for recent FreeBSD versions

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