VirtualBox

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

Last change on this file since 25614 was 25607, checked in by vboxsync, 15 years ago

iprt,pdmcritsect: Shortening and cleaning up the lock validator structure names.

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