VirtualBox

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

Last change on this file since 22418 was 22398, checked in by vboxsync, 16 years ago

IPRT: Fix compiling on FreeBSD amd64. When compiling code for 32bit our declerations for uint64_t and int64_t clash with the ones from FreeBSD. The ones from FreeBSD are actually wrong (guess they don't expect to compile 32bit software on 64bit) because they define uint64_t as 'unsigned long' whereas it needs to be 'unsigned long long' on 32bit. Before including sys/types.h we define them as declared to omit decleration in the system headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 42.9 KB
Line 
1/** @file
2 * IPRT - Types.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___iprt_types_h
31#define ___iprt_types_h
32
33#include <iprt/cdefs.h>
34#include <iprt/stdint.h>
35
36/*
37 * Include standard C types.
38 */
39#ifndef IPRT_NO_CRT
40
41# if defined(RT_OS_DARWIN) && defined(KERNEL)
42 /*
43 * Kludge for the darwin kernel:
44 * stddef.h is missing IIRC.
45 */
46# ifndef _PTRDIFF_T
47# define _PTRDIFF_T
48 typedef __darwin_ptrdiff_t ptrdiff_t;
49# endif
50# include <sys/types.h>
51
52# elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
53 /*
54 * Kludge for the FreeBSD kernel:
55 * stddef.h and sys/types.h have slightly different offsetof definitions
56 * when compiling in kernel mode. This is just to make GCC shut up.
57 */
58# ifndef _STDDEF_H_
59# undef offsetof
60# endif
61# include <stddef.h>
62# ifndef _SYS_TYPES_H_
63# undef offsetof
64# endif
65# include <sys/types.h>
66# ifndef offsetof
67# error "offsetof is not defined..."
68# endif
69
70# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
71 /*
72 * Kludge for the linux kernel:
73 * 1. sys/types.h doesn't mix with the kernel.
74 * 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
75 * declares false and true as enum values.
76 * 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
77 * We work around these issues here and nowhere else.
78 */
79# include <stddef.h>
80# if defined(__cplusplus)
81 typedef bool _Bool;
82# endif
83# define bool linux_bool
84# define true linux_true
85# define false linux_false
86# define uintptr_t linux_uintptr_t
87# include <linux/autoconf.h>
88# include <linux/types.h>
89# include <linux/stddef.h>
90# undef uintptr_t
91# undef false
92# undef true
93# undef bool
94
95# else
96# include <stddef.h>
97# if defined(RT_OS_FREEBSD) && (HC_ARCH_BITS == 64) && defined(RT_ARCH_X86)
98 /* Compiling on a 64bit machine in 32bit mode. FreeBSD declares
99 * uint64_t and int64_t wrong (long unsigned and long int
100 * though they need to be long long unsigned and long long int)
101 *
102 * These defines conflict with our decleration in stdint.h.
103 * Adding the defines below omits the definitions in the system header.
104 */
105# define _UINT64_T_DECLARED
106# define _INT64_T_DECLARED
107# endif
108# include <sys/types.h>
109# endif
110
111/* Define any types missing from sys/types.h on windows. */
112# ifdef _MSC_VER
113# undef ssize_t
114 typedef intptr_t ssize_t;
115# endif
116
117#else /* no crt */
118# include <iprt/nocrt/compiler/compiler.h>
119#endif /* no crt */
120
121
122
123/** @defgroup grp_rt_types IPRT Base Types
124 * @{
125 */
126
127/* define wchar_t, we don't wanna include all the wcsstuff to get this. */
128#ifdef _MSC_VER
129# ifndef _WCHAR_T_DEFINED
130 typedef unsigned short wchar_t;
131# define _WCHAR_T_DEFINED
132# endif
133#endif
134#ifdef __GNUC__
135/** @todo wchar_t on GNUC */
136#endif
137
138/*
139 * C doesn't have bool.
140 */
141#ifndef __cplusplus
142# if defined(__GNUC__)
143# if defined(RT_OS_LINUX) && __GNUC__ < 3
144typedef uint8_t bool;
145# else
146# if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
147# undef bool
148# endif
149typedef _Bool bool;
150# endif
151# else
152typedef unsigned char bool;
153# endif
154# ifndef true
155# define true (1)
156# endif
157# ifndef false
158# define false (0)
159# endif
160#endif
161
162/**
163 * 128-bit unsigned integer.
164 */
165#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
166typedef __uint128_t uint128_t;
167#else
168typedef struct uint128_s
169{
170 uint64_t Lo;
171 uint64_t Hi;
172} uint128_t;
173#endif
174
175
176/**
177 * 128-bit signed integer.
178 */
179#if defined(__GNUC__) && defined(RT_ARCH_AMD64)
180typedef __int128_t int128_t;
181#else
182typedef struct int128_s
183{
184 uint64_t lo;
185 int64_t hi;
186} int128_t;
187#endif
188
189
190/**
191 * 16-bit unsigned integer union.
192 */
193typedef union RTUINT16U
194{
195 /** natural view. */
196 uint16_t u;
197
198 /** 16-bit view. */
199 uint16_t au16[1];
200 /** 8-bit view. */
201 uint8_t au8[4];
202 /** 16-bit hi/lo view. */
203 struct
204 {
205 uint16_t Lo;
206 uint16_t Hi;
207 } s;
208} RTUINT16U;
209/** Pointer to a 16-bit unsigned integer union. */
210typedef RTUINT16U *PRTUINT16U;
211/** Pointer to a const 32-bit unsigned integer union. */
212typedef const RTUINT16U *PCRTUINT16U;
213
214
215/**
216 * 32-bit unsigned integer union.
217 */
218typedef union RTUINT32U
219{
220 /** natural view. */
221 uint32_t u;
222 /** Hi/Low view. */
223 struct
224 {
225 uint16_t Lo;
226 uint16_t Hi;
227 } s;
228 /** Word view. */
229 struct
230 {
231 uint16_t w0;
232 uint16_t w1;
233 } Words;
234
235 /** 32-bit view. */
236 uint32_t au32[1];
237 /** 16-bit view. */
238 uint16_t au16[2];
239 /** 8-bit view. */
240 uint8_t au8[4];
241} RTUINT32U;
242/** Pointer to a 32-bit unsigned integer union. */
243typedef RTUINT32U *PRTUINT32U;
244/** Pointer to a const 32-bit unsigned integer union. */
245typedef const RTUINT32U *PCRTUINT32U;
246
247
248/**
249 * 64-bit unsigned integer union.
250 */
251typedef union RTUINT64U
252{
253 /** Natural view. */
254 uint64_t u;
255 /** Hi/Low view. */
256 struct
257 {
258 uint32_t Lo;
259 uint32_t Hi;
260 } s;
261 /** Double-Word view. */
262 struct
263 {
264 uint32_t dw0;
265 uint32_t dw1;
266 } DWords;
267 /** Word view. */
268 struct
269 {
270 uint16_t w0;
271 uint16_t w1;
272 uint16_t w2;
273 uint16_t w3;
274 } Words;
275
276 /** 64-bit view. */
277 uint64_t au64[1];
278 /** 32-bit view. */
279 uint32_t au32[2];
280 /** 16-bit view. */
281 uint16_t au16[4];
282 /** 8-bit view. */
283 uint8_t au8[8];
284} RTUINT64U;
285/** Pointer to a 64-bit unsigned integer union. */
286typedef RTUINT64U *PRTUINT64U;
287/** Pointer to a const 64-bit unsigned integer union. */
288typedef const RTUINT64U *PCRTUINT64U;
289
290
291/**
292 * 128-bit unsigned integer union.
293 */
294typedef union RTUINT128U
295{
296 /** Natural view.
297 * WARNING! This member depends on the compiler supporting 128-bit stuff. */
298 uint128_t u;
299 /** Hi/Low view. */
300 struct
301 {
302 uint64_t Lo;
303 uint64_t Hi;
304 } s;
305 /** Quad-Word view. */
306 struct
307 {
308 uint64_t qw0;
309 uint64_t qw1;
310 } QWords;
311 /** Double-Word view. */
312 struct
313 {
314 uint32_t dw0;
315 uint32_t dw1;
316 uint32_t dw2;
317 uint32_t dw3;
318 } DWords;
319 /** Word view. */
320 struct
321 {
322 uint16_t w0;
323 uint16_t w1;
324 uint16_t w2;
325 uint16_t w3;
326 uint16_t w4;
327 uint16_t w5;
328 uint16_t w6;
329 uint16_t w7;
330 } Words;
331
332 /** 64-bit view. */
333 uint64_t au64[2];
334 /** 32-bit view. */
335 uint32_t au32[4];
336 /** 16-bit view. */
337 uint16_t au16[8];
338 /** 8-bit view. */
339 uint8_t au8[16];
340} RTUINT128U;
341/** Pointer to a 64-bit unsigned integer union. */
342typedef RTUINT128U *PRTUINT128U;
343/** Pointer to a const 64-bit unsigned integer union. */
344typedef const RTUINT128U *PCRTUINT128U;
345
346
347/** Generic function type.
348 * @see PFNRT
349 */
350typedef DECLCALLBACK(void) FNRT(void);
351
352/** Generic function pointer.
353 * With -pedantic, gcc-4 complains when casting a function to a data object, for example
354 *
355 * @code
356 * void foo(void)
357 * {
358 * }
359 *
360 * void *bar = (void *)foo;
361 * @endcode
362 *
363 * The compiler would warn with "ISO C++ forbids casting between pointer-to-function and
364 * pointer-to-object". The purpose of this warning is not to bother the programmer but to
365 * point out that he is probably doing something dangerous, assigning a pointer to executable
366 * code to a data object.
367 */
368typedef FNRT *PFNRT;
369
370
371/** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
372 * @ingroup grp_rt_types
373 * @{
374 */
375
376/** Signed integer which can contain both GC and HC pointers. */
377#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
378typedef int32_t RTINTPTR;
379#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
380typedef int64_t RTINTPTR;
381#else
382# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
383#endif
384/** Pointer to signed integer which can contain both GC and HC pointers. */
385typedef RTINTPTR *PRTINTPTR;
386/** Pointer const to signed integer which can contain both GC and HC pointers. */
387typedef const RTINTPTR *PCRTINTPTR;
388
389/** Unsigned integer which can contain both GC and HC pointers. */
390#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
391typedef uint32_t RTUINTPTR;
392#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
393typedef uint64_t RTUINTPTR;
394#else
395# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
396#endif
397/** Pointer to unsigned integer which can contain both GC and HC pointers. */
398typedef RTUINTPTR *PRTUINTPTR;
399/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
400typedef const RTUINTPTR *PCRTUINTPTR;
401/** The maximum value the RTUINTPTR type can hold. */
402#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
403# define RTUINTPTR_MAX UINT32_MAX
404#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
405# define RTUINTPTR_MAX UINT64_MAX
406#else
407# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
408#endif
409
410/** Signed integer. */
411typedef int32_t RTINT;
412/** Pointer to signed integer. */
413typedef RTINT *PRTINT;
414/** Pointer to const signed integer. */
415typedef const RTINT *PCRTINT;
416
417/** Unsigned integer. */
418typedef uint32_t RTUINT;
419/** Pointer to unsigned integer. */
420typedef RTUINT *PRTUINT;
421/** Pointer to const unsigned integer. */
422typedef const RTUINT *PCRTUINT;
423
424/** A file offset / size (off_t). */
425typedef int64_t RTFOFF;
426/** Pointer to a file offset / size. */
427typedef RTFOFF *PRTFOFF;
428/** The max value for RTFOFF. */
429#define RTFOFF_MAX INT64_MAX
430/** The min value for RTFOFF. */
431#define RTFOFF_MIN INT64_MIN
432
433/** File mode (see iprt/fs.h). */
434typedef uint32_t RTFMODE;
435/** Pointer to file mode. */
436typedef RTFMODE *PRTFMODE;
437
438/** Device unix number. */
439typedef uint32_t RTDEV;
440/** Pointer to a device unix number. */
441typedef RTDEV *PRTDEV;
442
443/** i-node number. */
444typedef uint64_t RTINODE;
445/** Pointer to a i-node number. */
446typedef RTINODE *PRTINODE;
447
448/** User id. */
449typedef uint32_t RTUID;
450/** Pointer to a user id. */
451typedef RTUID *PRTUID;
452/** NIL user id.
453 * @todo check this for portability! */
454#define NIL_RTUID (~(RTUID)0);
455
456/** Group id. */
457typedef uint32_t RTGID;
458/** Pointer to a group id. */
459typedef RTGID *PRTGID;
460/** NIL group id.
461 * @todo check this for portability! */
462#define NIL_RTGID (~(RTGID)0);
463
464/** I/O Port. */
465typedef uint16_t RTIOPORT;
466/** Pointer to I/O Port. */
467typedef RTIOPORT *PRTIOPORT;
468/** Pointer to const I/O Port. */
469typedef const RTIOPORT *PCRTIOPORT;
470
471/** Selector. */
472typedef uint16_t RTSEL;
473/** Pointer to selector. */
474typedef RTSEL *PRTSEL;
475/** Pointer to const selector. */
476typedef const RTSEL *PCRTSEL;
477/** Max selector value. */
478#define RTSEL_MAX UINT16_MAX
479
480/** Far 16-bit pointer. */
481#pragma pack(1)
482typedef struct RTFAR16
483{
484 uint16_t off;
485 RTSEL sel;
486} RTFAR16;
487#pragma pack()
488/** Pointer to Far 16-bit pointer. */
489typedef RTFAR16 *PRTFAR16;
490/** Pointer to const Far 16-bit pointer. */
491typedef const RTFAR16 *PCRTFAR16;
492
493/** Far 32-bit pointer. */
494#pragma pack(1)
495typedef struct RTFAR32
496{
497 uint32_t off;
498 RTSEL sel;
499} RTFAR32;
500#pragma pack()
501/** Pointer to Far 32-bit pointer. */
502typedef RTFAR32 *PRTFAR32;
503/** Pointer to const Far 32-bit pointer. */
504typedef const RTFAR32 *PCRTFAR32;
505
506/** Far 64-bit pointer. */
507#pragma pack(1)
508typedef struct RTFAR64
509{
510 uint64_t off;
511 RTSEL sel;
512} RTFAR64;
513#pragma pack()
514/** Pointer to Far 64-bit pointer. */
515typedef RTFAR64 *PRTFAR64;
516/** Pointer to const Far 64-bit pointer. */
517typedef const RTFAR64 *PCRTFAR64;
518
519/** @} */
520
521
522/** @defgroup grp_rt_types_hc Host Context Basic Types
523 * @ingroup grp_rt_types
524 * @{
525 */
526
527/** HC Natural signed integer.
528 * @deprecated silly type. */
529typedef int32_t RTHCINT;
530/** Pointer to HC Natural signed integer.
531 * @deprecated silly type. */
532typedef RTHCINT *PRTHCINT;
533/** Pointer to const HC Natural signed integer.
534 * @deprecated silly type. */
535typedef const RTHCINT *PCRTHCINT;
536
537/** HC Natural unsigned integer.
538 * @deprecated silly type. */
539typedef uint32_t RTHCUINT;
540/** Pointer to HC Natural unsigned integer.
541 * @deprecated silly type. */
542typedef RTHCUINT *PRTHCUINT;
543/** Pointer to const HC Natural unsigned integer.
544 * @deprecated silly type. */
545typedef const RTHCUINT *PCRTHCUINT;
546
547
548/** Signed integer which can contain a HC pointer. */
549#if HC_ARCH_BITS == 32
550typedef int32_t RTHCINTPTR;
551#elif HC_ARCH_BITS == 64
552typedef int64_t RTHCINTPTR;
553#else
554# error Unsupported HC_ARCH_BITS value.
555#endif
556/** Pointer to signed integer which can contain a HC pointer. */
557typedef RTHCINTPTR *PRTHCINTPTR;
558/** Pointer to const signed integer which can contain a HC pointer. */
559typedef const RTHCINTPTR *PCRTHCINTPTR;
560/** Max RTHCINTPTR value. */
561#if HC_ARCH_BITS == 32
562# define RTHCINTPTR_MAX INT32_MAX
563#else
564# define RTHCINTPTR_MAX INT64_MAX
565#endif
566/** Min RTHCINTPTR value. */
567#if HC_ARCH_BITS == 32
568# define RTHCINTPTR_MIN INT32_MIN
569#else
570# define RTHCINTPTR_MIN INT64_MIN
571#endif
572
573/** Signed integer which can contain a HC ring-3 pointer. */
574#if R3_ARCH_BITS == 32
575typedef int32_t RTR3INTPTR;
576#elif R3_ARCH_BITS == 64
577typedef int64_t RTR3INTPTR;
578#else
579# error Unsupported R3_ARCH_BITS value.
580#endif
581/** Pointer to signed integer which can contain a HC ring-3 pointer. */
582typedef RTR3INTPTR *PRTR3INTPTR;
583/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
584typedef const RTR3INTPTR *PCRTR3INTPTR;
585/** Max RTR3INTPTR value. */
586#if R3_ARCH_BITS == 32
587# define RTR3INTPTR_MAX INT32_MAX
588#else
589# define RTR3INTPTR_MAX INT64_MAX
590#endif
591/** Min RTR3INTPTR value. */
592#if R3_ARCH_BITS == 32
593# define RTR3INTPTR_MIN INT32_MIN
594#else
595# define RTR3INTPTR_MIN INT64_MIN
596#endif
597
598/** Signed integer which can contain a HC ring-0 pointer. */
599#if R0_ARCH_BITS == 32
600typedef int32_t RTR0INTPTR;
601#elif R0_ARCH_BITS == 64
602typedef int64_t RTR0INTPTR;
603#else
604# error Unsupported R0_ARCH_BITS value.
605#endif
606/** Pointer to signed integer which can contain a HC ring-0 pointer. */
607typedef RTR0INTPTR *PRTR0INTPTR;
608/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
609typedef const RTR0INTPTR *PCRTR0INTPTR;
610/** Max RTR0INTPTR value. */
611#if R0_ARCH_BITS == 32
612# define RTR0INTPTR_MAX INT32_MAX
613#else
614# define RTR0INTPTR_MAX INT64_MAX
615#endif
616/** Min RTHCINTPTR value. */
617#if R0_ARCH_BITS == 32
618# define RTR0INTPTR_MIN INT32_MIN
619#else
620# define RTR0INTPTR_MIN INT64_MIN
621#endif
622
623
624/** Unsigned integer which can contain a HC pointer. */
625#if HC_ARCH_BITS == 32
626typedef uint32_t RTHCUINTPTR;
627#elif HC_ARCH_BITS == 64
628typedef uint64_t RTHCUINTPTR;
629#else
630# error Unsupported HC_ARCH_BITS value.
631#endif
632/** Pointer to unsigned integer which can contain a HC pointer. */
633typedef RTHCUINTPTR *PRTHCUINTPTR;
634/** Pointer to unsigned integer which can contain a HC pointer. */
635typedef const RTHCUINTPTR *PCRTHCUINTPTR;
636/** Max RTHCUINTTPR value. */
637#if HC_ARCH_BITS == 32
638# define RTHCUINTPTR_MAX UINT32_MAX
639#else
640# define RTHCUINTPTR_MAX UINT64_MAX
641#endif
642
643/** Unsigned integer which can contain a HC ring-3 pointer. */
644#if R3_ARCH_BITS == 32
645typedef uint32_t RTR3UINTPTR;
646#elif R3_ARCH_BITS == 64
647typedef uint64_t RTR3UINTPTR;
648#else
649# error Unsupported R3_ARCH_BITS value.
650#endif
651/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
652typedef RTR3UINTPTR *PRTR3UINTPTR;
653/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
654typedef const RTR3UINTPTR *PCRTR3UINTPTR;
655/** Max RTHCUINTTPR value. */
656#if R3_ARCH_BITS == 32
657# define RTR3UINTPTR_MAX UINT32_MAX
658#else
659# define RTR3UINTPTR_MAX UINT64_MAX
660#endif
661
662/** Unsigned integer which can contain a HC ring-0 pointer. */
663#if R0_ARCH_BITS == 32
664typedef uint32_t RTR0UINTPTR;
665#elif R0_ARCH_BITS == 64
666typedef uint64_t RTR0UINTPTR;
667#else
668# error Unsupported R0_ARCH_BITS value.
669#endif
670/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
671typedef RTR0UINTPTR *PRTR0UINTPTR;
672/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
673typedef const RTR0UINTPTR *PCRTR0UINTPTR;
674/** Max RTR0UINTTPR value. */
675#if HC_ARCH_BITS == 32
676# define RTR0UINTPTR_MAX UINT32_MAX
677#else
678# define RTR0UINTPTR_MAX UINT64_MAX
679#endif
680
681
682/** Host Physical Memory Address. */
683typedef uint64_t RTHCPHYS;
684/** Pointer to Host Physical Memory Address. */
685typedef RTHCPHYS *PRTHCPHYS;
686/** Pointer to const Host Physical Memory Address. */
687typedef const RTHCPHYS *PCRTHCPHYS;
688/** @def NIL_RTHCPHYS
689 * NIL HC Physical Address.
690 * NIL_RTHCPHYS is used to signal an invalid physical address, similar
691 * to the NULL pointer.
692 */
693#define NIL_RTHCPHYS (~(RTHCPHYS)0)
694/** Max RTHCPHYS value. */
695#define RTHCPHYS_MAX UINT64_MAX
696
697
698/** HC pointer. */
699#ifndef IN_RC
700typedef void * RTHCPTR;
701#else
702typedef RTHCUINTPTR RTHCPTR;
703#endif
704/** Pointer to HC pointer. */
705typedef RTHCPTR *PRTHCPTR;
706/** Pointer to const HC pointer. */
707typedef const RTHCPTR *PCRTHCPTR;
708/** @def NIL_RTHCPTR
709 * NIL HC pointer.
710 */
711#define NIL_RTHCPTR ((RTHCPTR)0)
712/** Max RTHCPTR value. */
713#define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
714
715
716/** HC ring-3 pointer. */
717#ifdef IN_RING3
718typedef void * RTR3PTR;
719#else
720typedef RTR3UINTPTR RTR3PTR;
721#endif
722/** Pointer to HC ring-3 pointer. */
723typedef RTR3PTR *PRTR3PTR;
724/** Pointer to const HC ring-3 pointer. */
725typedef const RTR3PTR *PCRTR3PTR;
726/** @def NIL_RTR3PTR
727 * NIL HC ring-3 pointer.
728 */
729#define NIL_RTR3PTR ((RTR3PTR)0)
730/** Max RTR3PTR value. */
731#define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
732
733/** HC ring-0 pointer. */
734#ifdef IN_RING0
735typedef void * RTR0PTR;
736#else
737typedef RTR0UINTPTR RTR0PTR;
738#endif
739/** Pointer to HC ring-0 pointer. */
740typedef RTR0PTR *PRTR0PTR;
741/** Pointer to const HC ring-0 pointer. */
742typedef const RTR0PTR *PCRTR0PTR;
743/** @def NIL_RTR0PTR
744 * NIL HC ring-0 pointer.
745 */
746#define NIL_RTR0PTR ((RTR0PTR)0)
747/** Max RTR3PTR value. */
748#define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
749
750
751/** Unsigned integer register in the host context. */
752#if HC_ARCH_BITS == 32
753typedef uint32_t RTHCUINTREG;
754#elif HC_ARCH_BITS == 64
755typedef uint64_t RTHCUINTREG;
756#else
757# error "Unsupported HC_ARCH_BITS!"
758#endif
759/** Pointer to an unsigned integer register in the host context. */
760typedef RTHCUINTREG *PRTHCUINTREG;
761/** Pointer to a const unsigned integer register in the host context. */
762typedef const RTHCUINTREG *PCRTHCUINTREG;
763
764/** Unsigned integer register in the host ring-3 context. */
765#if R3_ARCH_BITS == 32
766typedef uint32_t RTR3UINTREG;
767#elif R3_ARCH_BITS == 64
768typedef uint64_t RTR3UINTREG;
769#else
770# error "Unsupported R3_ARCH_BITS!"
771#endif
772/** Pointer to an unsigned integer register in the host ring-3 context. */
773typedef RTR3UINTREG *PRTR3UINTREG;
774/** Pointer to a const unsigned integer register in the host ring-3 context. */
775typedef const RTR3UINTREG *PCRTR3UINTREG;
776
777/** Unsigned integer register in the host ring-3 context. */
778#if R0_ARCH_BITS == 32
779typedef uint32_t RTR0UINTREG;
780#elif R0_ARCH_BITS == 64
781typedef uint64_t RTR0UINTREG;
782#else
783# error "Unsupported R3_ARCH_BITS!"
784#endif
785/** Pointer to an unsigned integer register in the host ring-3 context. */
786typedef RTR0UINTREG *PRTR0UINTREG;
787/** Pointer to a const unsigned integer register in the host ring-3 context. */
788typedef const RTR0UINTREG *PCRTR0UINTREG;
789
790/** @} */
791
792
793/** @defgroup grp_rt_types_gc Guest Context Basic Types
794 * @ingroup grp_rt_types
795 * @{
796 */
797
798/** Natural signed integer in the GC.
799 * @deprecated silly type. */
800#if GC_ARCH_BITS == 32
801typedef int32_t RTGCINT;
802#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
803typedef int64_t RTGCINT;
804#endif
805/** Pointer to natural signed integer in GC.
806 * @deprecated silly type. */
807typedef RTGCINT *PRTGCINT;
808/** Pointer to const natural signed integer in GC.
809 * @deprecated silly type. */
810typedef const RTGCINT *PCRTGCINT;
811
812/** Natural unsigned integer in the GC.
813 * @deprecated silly type. */
814#if GC_ARCH_BITS == 32
815typedef uint32_t RTGCUINT;
816#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
817typedef uint64_t RTGCUINT;
818#endif
819/** Pointer to natural unsigned integer in GC.
820 * @deprecated silly type. */
821typedef RTGCUINT *PRTGCUINT;
822/** Pointer to const natural unsigned integer in GC.
823 * @deprecated silly type. */
824typedef const RTGCUINT *PCRTGCUINT;
825
826/** Signed integer which can contain a GC pointer. */
827#if GC_ARCH_BITS == 32
828typedef int32_t RTGCINTPTR;
829#elif GC_ARCH_BITS == 64
830typedef int64_t RTGCINTPTR;
831#endif
832/** Pointer to signed integer which can contain a GC pointer. */
833typedef RTGCINTPTR *PRTGCINTPTR;
834/** Pointer to const signed integer which can contain a GC pointer. */
835typedef const RTGCINTPTR *PCRTGCINTPTR;
836
837/** Unsigned integer which can contain a GC pointer. */
838#if GC_ARCH_BITS == 32
839typedef uint32_t RTGCUINTPTR;
840#elif GC_ARCH_BITS == 64
841typedef uint64_t RTGCUINTPTR;
842#else
843# error Unsupported GC_ARCH_BITS value.
844#endif
845/** Pointer to unsigned integer which can contain a GC pointer. */
846typedef RTGCUINTPTR *PRTGCUINTPTR;
847/** Pointer to unsigned integer which can contain a GC pointer. */
848typedef const RTGCUINTPTR *PCRTGCUINTPTR;
849
850/** Unsigned integer which can contain a 32 bits GC pointer. */
851typedef uint32_t RTGCUINTPTR32;
852/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
853typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
854/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
855typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;
856
857/** Unsigned integer which can contain a 64 bits GC pointer. */
858typedef uint64_t RTGCUINTPTR64;
859/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
860typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
861/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
862typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
863
864/** Guest Physical Memory Address.*/
865typedef uint64_t RTGCPHYS;
866/** Pointer to Guest Physical Memory Address. */
867typedef RTGCPHYS *PRTGCPHYS;
868/** Pointer to const Guest Physical Memory Address. */
869typedef const RTGCPHYS *PCRTGCPHYS;
870/** @def NIL_RTGCPHYS
871 * NIL GC Physical Address.
872 * NIL_RTGCPHYS is used to signal an invalid physical address, similar
873 * to the NULL pointer. Note that this value may actually be valid in
874 * some contexts.
875 */
876#define NIL_RTGCPHYS (~(RTGCPHYS)0U)
877/** Max guest physical memory address value. */
878#define RTGCPHYS_MAX UINT64_MAX
879
880
881/** Guest Physical Memory Address; limited to 32 bits.*/
882typedef uint32_t RTGCPHYS32;
883/** Pointer to Guest Physical Memory Address. */
884typedef RTGCPHYS32 *PRTGCPHYS32;
885/** Pointer to const Guest Physical Memory Address. */
886typedef const RTGCPHYS32 *PCRTGCPHYS32;
887/** @def NIL_RTGCPHYS32
888 * NIL GC Physical Address.
889 * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
890 * to the NULL pointer. Note that this value may actually be valid in
891 * some contexts.
892 */
893#define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
894
895
896/** Guest Physical Memory Address; limited to 64 bits.*/
897typedef uint64_t RTGCPHYS64;
898/** Pointer to Guest Physical Memory Address. */
899typedef RTGCPHYS64 *PRTGCPHYS64;
900/** Pointer to const Guest Physical Memory Address. */
901typedef const RTGCPHYS64 *PCRTGCPHYS64;
902/** @def NIL_RTGCPHYS64
903 * NIL GC Physical Address.
904 * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
905 * to the NULL pointer. Note that this value may actually be valid in
906 * some contexts.
907 */
908#define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
909
910/** Guest context pointer, 32 bits.
911 * Keep in mind that this type is an unsigned integer in
912 * HC and void pointer in GC.
913 */
914typedef RTGCUINTPTR32 RTGCPTR32;
915/** Pointer to a guest context pointer. */
916typedef RTGCPTR32 *PRTGCPTR32;
917/** Pointer to a const guest context pointer. */
918typedef const RTGCPTR32 *PCRTGCPTR32;
919/** @def NIL_RTGCPTR32
920 * NIL GC pointer.
921 */
922#define NIL_RTGCPTR32 ((RTGCPTR32)0)
923
924/** Guest context pointer, 64 bits.
925 */
926typedef RTGCUINTPTR64 RTGCPTR64;
927/** Pointer to a guest context pointer. */
928typedef RTGCPTR64 *PRTGCPTR64;
929/** Pointer to a const guest context pointer. */
930typedef const RTGCPTR64 *PCRTGCPTR64;
931/** @def NIL_RTGCPTR64
932 * NIL GC pointer.
933 */
934#define NIL_RTGCPTR64 ((RTGCPTR64)0)
935
936/** Guest context pointer.
937 * Keep in mind that this type is an unsigned integer in
938 * HC and void pointer in GC.
939 */
940#if GC_ARCH_BITS == 64
941typedef RTGCPTR64 RTGCPTR;
942/** Pointer to a guest context pointer. */
943typedef PRTGCPTR64 PRTGCPTR;
944/** Pointer to a const guest context pointer. */
945typedef PCRTGCPTR64 PCRTGCPTR;
946/** @def NIL_RTGCPTR
947 * NIL GC pointer.
948 */
949# define NIL_RTGCPTR NIL_RTGCPTR64
950/** Max RTGCPTR value. */
951# define RTGCPTR_MAX UINT64_MAX
952#elif GC_ARCH_BITS == 32
953typedef RTGCPTR32 RTGCPTR;
954/** Pointer to a guest context pointer. */
955typedef PRTGCPTR32 PRTGCPTR;
956/** Pointer to a const guest context pointer. */
957typedef PCRTGCPTR32 PCRTGCPTR;
958/** @def NIL_RTGCPTR
959 * NIL GC pointer.
960 */
961# define NIL_RTGCPTR NIL_RTGCPTR32
962/** Max RTGCPTR value. */
963# define RTGCPTR_MAX UINT32_MAX
964#else
965# error "Unsupported GC_ARCH_BITS!"
966#endif
967
968/** Unsigned integer register in the guest context. */
969typedef uint32_t RTGCUINTREG32;
970/** Pointer to an unsigned integer register in the guest context. */
971typedef RTGCUINTREG32 *PRTGCUINTREG32;
972/** Pointer to a const unsigned integer register in the guest context. */
973typedef const RTGCUINTREG32 *PCRTGCUINTREG32;
974
975typedef uint64_t RTGCUINTREG64;
976/** Pointer to an unsigned integer register in the guest context. */
977typedef RTGCUINTREG64 *PRTGCUINTREG64;
978/** Pointer to a const unsigned integer register in the guest context. */
979typedef const RTGCUINTREG64 *PCRTGCUINTREG64;
980
981#if GC_ARCH_BITS == 64
982typedef RTGCUINTREG64 RTGCUINTREG;
983#elif GC_ARCH_BITS == 32
984typedef RTGCUINTREG32 RTGCUINTREG;
985#else
986# error "Unsupported GC_ARCH_BITS!"
987#endif
988/** Pointer to an unsigned integer register in the guest context. */
989typedef RTGCUINTREG *PRTGCUINTREG;
990/** Pointer to a const unsigned integer register in the guest context. */
991typedef const RTGCUINTREG *PCRTGCUINTREG;
992
993/** @} */
994
995/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
996 * @ingroup grp_rt_types
997 * @{
998 */
999
1000/** Raw mode context pointer; a 32 bits guest context pointer.
1001 * Keep in mind that this type is an unsigned integer in
1002 * HC and void pointer in RC.
1003 */
1004#ifdef IN_RC
1005typedef void * RTRCPTR;
1006#else
1007typedef uint32_t RTRCPTR;
1008#endif
1009/** Pointer to a raw mode context pointer. */
1010typedef RTRCPTR *PRTRCPTR;
1011/** Pointer to a const raw mode context pointer. */
1012typedef const RTRCPTR *PCRTRCPTR;
1013/** @def NIL_RTGCPTR
1014 * NIL RC pointer.
1015 */
1016#define NIL_RTRCPTR ((RTRCPTR)0)
1017/** @def RTRCPTR_MAX
1018 * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
1019 */
1020#define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
1021
1022/** Raw mode context pointer, unsigned integer variant. */
1023typedef int32_t RTRCINTPTR;
1024/** @def RTRCUINPTR_MAX
1025 * The maximum value a RTRCUINPTR can have.
1026 */
1027#define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
1028
1029/** Raw mode context pointer, signed integer variant. */
1030typedef uint32_t RTRCUINTPTR;
1031/** @def RTRCINPTR_MIN
1032 * The minimum value a RTRCINPTR can have.
1033 */
1034#define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
1035/** @def RTRCINPTR_MAX
1036 * The maximum value a RTRCINPTR can have.
1037 */
1038#define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
1039
1040/** @} */
1041
1042
1043/** @defgroup grp_rt_types_cc Current Context Basic Types
1044 * @ingroup grp_rt_types
1045 * @{
1046 */
1047
1048/** Current Context Physical Memory Address.*/
1049#ifdef IN_RC
1050typedef RTGCPHYS RTCCPHYS;
1051#else
1052typedef RTHCPHYS RTCCPHYS;
1053#endif
1054/** Pointer to Current Context Physical Memory Address. */
1055typedef RTCCPHYS *PRTCCPHYS;
1056/** Pointer to const Current Context Physical Memory Address. */
1057typedef const RTCCPHYS *PCRTCCPHYS;
1058/** @def NIL_RTCCPHYS
1059 * NIL CC Physical Address.
1060 * NIL_RTCCPHYS is used to signal an invalid physical address, similar
1061 * to the NULL pointer.
1062 */
1063#ifdef IN_RC
1064# define NIL_RTCCPHYS NIL_RTGCPHYS
1065#else
1066# define NIL_RTCCPHYS NIL_RTHCPHYS
1067#endif
1068
1069/** Unsigned integer register in the current context. */
1070#if ARCH_BITS == 32
1071typedef uint32_t RTCCUINTREG;
1072#elif ARCH_BITS == 64
1073typedef uint64_t RTCCUINTREG;
1074#else
1075# error "Unsupported ARCH_BITS!"
1076#endif
1077/** Pointer to an unsigned integer register in the current context. */
1078typedef RTCCUINTREG *PRTCCUINTREG;
1079/** Pointer to a const unsigned integer register in the current context. */
1080typedef RTCCUINTREG const *PCRTCCUINTREG;
1081
1082/** Signed integer register in the current context. */
1083#if ARCH_BITS == 32
1084typedef int32_t RTCCINTREG;
1085#elif ARCH_BITS == 64
1086typedef int64_t RTCCINTREG;
1087#endif
1088/** Pointer to a signed integer register in the current context. */
1089typedef RTCCINTREG *PRTCCINTREG;
1090/** Pointer to a const signed integer register in the current context. */
1091typedef RTCCINTREG const *PCRTCCINTREG;
1092
1093/** @} */
1094
1095
1096/** File handle. */
1097typedef RTUINT RTFILE;
1098/** Pointer to file handle. */
1099typedef RTFILE *PRTFILE;
1100/** Nil file handle. */
1101#define NIL_RTFILE (~(RTFILE)0)
1102
1103/** Async I/O request handle. */
1104typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL *) RTFILEAIOREQ;
1105/** Pointer to a async I/O request handle. */
1106typedef RTFILEAIOREQ *PRTFILEAIOREQ;
1107/** Nil request handle. */
1108#define NIL_RTFILEAIOREQ 0
1109
1110/** Async I/O completion context handle. */
1111typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL *) RTFILEAIOCTX;
1112/** Pointer to a async I/O completion context handle. */
1113typedef RTFILEAIOCTX *PRTFILEAIOCTX;
1114/** Nil context handle. */
1115#define NIL_RTFILEAIOCTX 0
1116
1117/** Loader module handle. */
1118typedef R3PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
1119/** Pointer to a loader module handle. */
1120typedef RTLDRMOD *PRTLDRMOD;
1121/** Nil loader module handle. */
1122#define NIL_RTLDRMOD 0
1123
1124/** Ring-0 memory object handle. */
1125typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *) RTR0MEMOBJ;
1126/** Pointer to a Ring-0 memory object handle. */
1127typedef RTR0MEMOBJ *PRTR0MEMOBJ;
1128/** Nil ring-0 memory object handle. */
1129#define NIL_RTR0MEMOBJ 0
1130
1131/** Native thread handle. */
1132typedef RTHCUINTPTR RTNATIVETHREAD;
1133/** Pointer to an native thread handle. */
1134typedef RTNATIVETHREAD *PRTNATIVETHREAD;
1135/** Nil native thread handle. */
1136#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
1137
1138/** Process identifier. */
1139typedef uint32_t RTPROCESS;
1140/** Pointer to a process identifier. */
1141typedef RTPROCESS *PRTPROCESS;
1142/** Nil process identifier. */
1143#define NIL_RTPROCESS (~(RTPROCESS)0)
1144
1145/** Process ring-0 handle. */
1146typedef RTR0UINTPTR RTR0PROCESS;
1147/** Pointer to a ring-0 process handle. */
1148typedef RTR0PROCESS *PRTR0PROCESS;
1149/** Nil ring-0 process handle. */
1150#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
1151
1152/** @typedef RTSEMEVENT
1153 * Event Semaphore handle. */
1154typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *) RTSEMEVENT;
1155/** Pointer to an event semaphore handle. */
1156typedef RTSEMEVENT *PRTSEMEVENT;
1157/** Nil event semaphore handle. */
1158#define NIL_RTSEMEVENT 0
1159
1160/** @typedef RTSEMEVENTMULTI
1161 * Event Multiple Release Semaphore handle. */
1162typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
1163/** Pointer to an event multiple release semaphore handle. */
1164typedef RTSEMEVENTMULTI *PRTSEMEVENTMULTI;
1165/** Nil multiple release event semaphore handle. */
1166#define NIL_RTSEMEVENTMULTI 0
1167
1168/** @typedef RTSEMFASTMUTEX
1169 * Fast mutex Semaphore handle. */
1170typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
1171/** Pointer to a fast mutex semaphore handle. */
1172typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
1173/** Nil fast mutex semaphore handle. */
1174#define NIL_RTSEMFASTMUTEX 0
1175
1176/** @typedef RTSEMMUTEX
1177 * Mutex Semaphore handle. */
1178typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *) RTSEMMUTEX;
1179/** Pointer to a mutex semaphore handle. */
1180typedef RTSEMMUTEX *PRTSEMMUTEX;
1181/** Nil mutex semaphore handle. */
1182#define NIL_RTSEMMUTEX 0
1183
1184/** @typedef RTSEMSPINMUTEX
1185 * Spinning mutex Semaphore handle. */
1186typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL *) RTSEMSPINMUTEX;
1187/** Pointer to a spinning mutex semaphore handle. */
1188typedef RTSEMSPINMUTEX *PRTSEMSPINMUTEX;
1189/** Nil spinning mutex semaphore handle. */
1190#define NIL_RTSEMSPINMUTEX 0
1191
1192/** @typedef RTSEMRW
1193 * Read/Write Semaphore handle. */
1194typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *) RTSEMRW;
1195/** Pointer to a read/write semaphore handle. */
1196typedef RTSEMRW *PRTSEMRW;
1197/** Nil read/write semaphore handle. */
1198#define NIL_RTSEMRW 0
1199
1200/** Spinlock handle. */
1201typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *) RTSPINLOCK;
1202/** Pointer to a spinlock handle. */
1203typedef RTSPINLOCK *PRTSPINLOCK;
1204/** Nil spinlock handle. */
1205#define NIL_RTSPINLOCK 0
1206
1207/** Socket handle. */
1208typedef int RTSOCKET;
1209/** Pointer to socket handle. */
1210typedef RTSOCKET *PRTSOCKET;
1211/** Nil socket handle. */
1212#define NIL_RTSOCKET (~(RTSOCKET)0)
1213
1214/** Thread handle.*/
1215typedef R3R0PTRTYPE(struct RTTHREADINT *) RTTHREAD;
1216/** Pointer to thread handle. */
1217typedef RTTHREAD *PRTTHREAD;
1218/** Nil thread handle. */
1219#define NIL_RTTHREAD 0
1220
1221/** A TLS index. */
1222typedef RTHCINTPTR RTTLS;
1223/** Pointer to a TLS index. */
1224typedef RTTLS *PRTTLS;
1225/** Pointer to a const TLS index. */
1226typedef RTTLS const *PCRTTLS;
1227/** NIL TLS index value. */
1228#define NIL_RTTLS (-1)
1229
1230/** Handle to a simple heap. */
1231typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *) RTHEAPSIMPLE;
1232/** Pointer to a handle to a simple heap. */
1233typedef RTHEAPSIMPLE *PRTHEAPSIMPLE;
1234/** NIL simple heap handle. */
1235#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
1236
1237/** Handle to an environment block. */
1238typedef R3PTRTYPE(struct RTENVINTERNAL *) RTENV;
1239/** Pointer to a handle to an environment block. */
1240typedef RTENV *PRTENV;
1241/** NIL simple heap handle. */
1242#define NIL_RTENV ((RTENV)0)
1243
1244/** A CPU identifier.
1245 * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
1246 * does it have to correspond to the bits in the affinity mask, at
1247 * least not until we've sorted out Windows NT. */
1248typedef uint32_t RTCPUID;
1249/** Pointer to a CPU identifier. */
1250typedef RTCPUID *PRTCPUID;
1251/** Pointer to a const CPU identifier. */
1252typedef RTCPUID const *PCRTCPUID;
1253/** Nil CPU Id. */
1254#define NIL_RTCPUID ((RTCPUID)~0)
1255
1256/** A CPU set.
1257 * Treat this as an opaque type and always use RTCpuSet* for manupulating it.
1258 * @remarks Subject to change. */
1259typedef uint64_t RTCPUSET;
1260/** Pointer to a CPU set. */
1261typedef RTCPUSET *PRTCPUSET;
1262/** Pointer to a const CPU set. */
1263typedef RTCPUSET const *PCRTCPUSET;
1264
1265/** A handle table handle. */
1266typedef R3R0PTRTYPE(struct RTHANDLETABLEINT *) RTHANDLETABLE;
1267/** A pointer to a handle table handle. */
1268typedef RTHANDLETABLE *PRTHANDLETABLE;
1269/** @def NIL_RTHANDLETABLE
1270 * NIL handle table handle. */
1271#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
1272
1273/** A handle to a low resolution timer. */
1274typedef R3R0PTRTYPE(struct RTTIMERLRINT *) RTTIMERLR;
1275/** A pointer to a low resolution timer handle. */
1276typedef RTTIMERLR *PRTTIMERLR;
1277/** @def NIL_RTTIMERLR
1278 * NIL low resolution timer handle value. */
1279#define NIL_RTTIMERLR ((RTTIMERLR)0)
1280
1281/** Handle to a random number generator. */
1282typedef R3R0PTRTYPE(struct RTRANDINT *) RTRAND;
1283/** Pointer to a random number generator handle. */
1284typedef RTRAND *PRTRAND;
1285/** NIL random number genrator handle value. */
1286#define NIL_RTRAND ((RTRAND)0)
1287
1288/** Debug address space handle. */
1289typedef R3R0PTRTYPE(struct RTDBGASINT *) RTDBGAS;
1290/** Pointer to a debug address space handle. */
1291typedef RTDBGAS *PRTDBGAS;
1292/** NIL debug address space handle. */
1293#define NIL_RTDBGAS ((RTDBGAS)0)
1294
1295/** Debug module handle. */
1296typedef R3R0PTRTYPE(struct RTDBGMODINT *) RTDBGMOD;
1297/** Pointer to a debug module handle. */
1298typedef RTDBGMOD *PRTDBGMOD;
1299/** NIL debug module handle. */
1300#define NIL_RTDBGMOD ((RTDBGMOD)0)
1301
1302/** Memory pool handle. */
1303typedef R3R0PTRTYPE(struct RTMEMPOOLINT *) RTMEMPOOL;
1304/** Pointer to a memory pool handle. */
1305typedef RTMEMPOOL *PRTMEMPOOL;
1306/** NIL memory pool handle. */
1307#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
1308/** The default memory pool handle. */
1309#define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
1310
1311/** String cache handle. */
1312typedef R3R0PTRTYPE(struct RTSTRCACHEINT *) RTSTRCACHE;
1313/** Pointer to a string cache handle. */
1314typedef RTSTRCACHE *PRTSTRCACHE;
1315/** NIL string cache handle. */
1316#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
1317/** The default string cache handle. */
1318#define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
1319
1320
1321/**
1322 * UUID data type.
1323 *
1324 * @note IPRT defines that the first three integers in the @c Gen struct
1325 * interpretation are in little endian representation. This is different to
1326 * many other UUID implementation, and requires conversion if you need to
1327 * achieve consistent results.
1328 */
1329typedef union RTUUID
1330{
1331 /** 8-bit view. */
1332 uint8_t au8[16];
1333 /** 16-bit view. */
1334 uint16_t au16[8];
1335 /** 32-bit view. */
1336 uint32_t au32[4];
1337 /** 64-bit view. */
1338 uint64_t au64[2];
1339 /** The way the UUID is declared by the DCE specification. */
1340 struct
1341 {
1342 uint32_t u32TimeLow;
1343 uint16_t u16TimeMid;
1344 uint16_t u16TimeHiAndVersion;
1345 uint8_t u8ClockSeqHiAndReserved;
1346 uint8_t u8ClockSeqLow;
1347 uint8_t au8Node[6];
1348 } Gen;
1349} RTUUID;
1350/** Pointer to UUID data. */
1351typedef RTUUID *PRTUUID;
1352/** Pointer to readonly UUID data. */
1353typedef const RTUUID *PCRTUUID;
1354
1355/**
1356 * UUID string maximum length.
1357 */
1358#define RTUUID_STR_LENGTH 37
1359
1360
1361/** Compression handle. */
1362typedef struct RTZIPCOMP *PRTZIPCOMP;
1363
1364/** Decompressor handle. */
1365typedef struct RTZIPDECOMP *PRTZIPDECOMP;
1366
1367
1368/**
1369 * Unicode Code Point.
1370 */
1371typedef uint32_t RTUNICP;
1372/** Pointer to an Unicode Code Point. */
1373typedef RTUNICP *PRTUNICP;
1374/** Pointer to an Unicode Code Point. */
1375typedef const RTUNICP *PCRTUNICP;
1376
1377
1378/**
1379 * UTF-16 character.
1380 * @remark wchar_t is not usable since it's compiler defined.
1381 * @remark When we use the term character we're not talking about unicode code point, but
1382 * the basic unit of the string encoding. Thus cwc - count of wide chars - means
1383 * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
1384 * and cch means count of the typedef 'char', which is assumed to be an octet.
1385 */
1386typedef uint16_t RTUTF16;
1387/** Pointer to a UTF-16 character. */
1388typedef RTUTF16 *PRTUTF16;
1389/** Pointer to a const UTF-16 character. */
1390typedef const RTUTF16 *PCRTUTF16;
1391
1392
1393/**
1394 * Wait for ever if we have to.
1395 */
1396#define RT_INDEFINITE_WAIT (~0U)
1397
1398
1399/**
1400 * Generic process callback.
1401 *
1402 * @returns VBox status code. Failure will cancel the operation.
1403 * @param uPercentage The percentage of the operation which has been completed.
1404 * @param pvUser The user specified argument.
1405 */
1406typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
1407/** Pointer to a generic progress callback function, FNRTPROCESS(). */
1408typedef FNRTPROGRESS *PFNRTPROGRESS;
1409
1410
1411/**
1412 * Rectangle data type.
1413 */
1414typedef struct RTRECT
1415{
1416 /** left X coordinate. */
1417 int32_t xLeft;
1418 /** top Y coordinate. */
1419 int32_t yTop;
1420 /** right X coordinate. (exclusive) */
1421 int32_t xRight;
1422 /** bottom Y coordinate. (exclusive) */
1423 int32_t yBottom;
1424} RTRECT;
1425/** Pointer to a rectangle. */
1426typedef RTRECT *PRTRECT;
1427/** Pointer to a const rectangle. */
1428typedef const RTRECT *PCRTRECT;
1429
1430
1431/**
1432 * Ethernet MAC address.
1433 *
1434 * The first 24 bits make up the Organisationally Unique Identifier (OUI),
1435 * where the first bit (little endian) indicates multicast (set) / unicast,
1436 * and the second bit indicates locally (set) / global administered. If all
1437 * bits are set, it's a broadcast.
1438 */
1439typedef union RTMAC
1440{
1441 /** @todo add a bitfield view of this stuff. */
1442 /** 8-bit view. */
1443 uint8_t au8[6];
1444 /** 16-bit view. */
1445 uint16_t au16[3];
1446} RTMAC;
1447/** Pointer to a MAC address. */
1448typedef RTMAC *PRTMAC;
1449/** Pointer to a readonly MAC address. */
1450typedef const RTMAC *PCRTMAC;
1451
1452/** @} */
1453
1454#endif
1455
Note: See TracBrowser for help on using the repository browser.

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