VirtualBox

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

Last change on this file since 21751 was 21513, checked in by vboxsync, 15 years ago

iprt/semaphore.h,types.h: Defined a new semaphore type for use with the logger.

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