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
|
---|
133 | typedef uint8_t bool;
|
---|
134 | # else
|
---|
135 | # if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
|
---|
136 | # undef bool
|
---|
137 | # endif
|
---|
138 | typedef _Bool bool;
|
---|
139 | # endif
|
---|
140 | # else
|
---|
141 | typedef 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)
|
---|
155 | typedef __uint128_t uint128_t;
|
---|
156 | #else
|
---|
157 | typedef 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)
|
---|
169 | typedef __int128_t int128_t;
|
---|
170 | #else
|
---|
171 | typedef 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 | */
|
---|
182 | typedef 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. */
|
---|
199 | typedef RTUINT16U *PRTUINT16U;
|
---|
200 | /** Pointer to a const 32-bit unsigned integer union. */
|
---|
201 | typedef const RTUINT16U *PCRTUINT16U;
|
---|
202 |
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * 32-bit unsigned integer union.
|
---|
206 | */
|
---|
207 | typedef 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. */
|
---|
232 | typedef RTUINT32U *PRTUINT32U;
|
---|
233 | /** Pointer to a const 32-bit unsigned integer union. */
|
---|
234 | typedef const RTUINT32U *PCRTUINT32U;
|
---|
235 |
|
---|
236 |
|
---|
237 | /**
|
---|
238 | * 64-bit unsigned integer union.
|
---|
239 | */
|
---|
240 | typedef 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. */
|
---|
275 | typedef RTUINT64U *PRTUINT64U;
|
---|
276 | /** Pointer to a const 64-bit unsigned integer union. */
|
---|
277 | typedef const RTUINT64U *PCRTUINT64U;
|
---|
278 |
|
---|
279 |
|
---|
280 | /**
|
---|
281 | * 128-bit unsigned integer union.
|
---|
282 | */
|
---|
283 | typedef 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. */
|
---|
331 | typedef RTUINT128U *PRTUINT128U;
|
---|
332 | /** Pointer to a const 64-bit unsigned integer union. */
|
---|
333 | typedef const RTUINT128U *PCRTUINT128U;
|
---|
334 |
|
---|
335 |
|
---|
336 | /** Generic function type.
|
---|
337 | * @see PFNRT
|
---|
338 | */
|
---|
339 | typedef 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 | */
|
---|
357 | typedef 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)
|
---|
367 | typedef int32_t RTINTPTR;
|
---|
368 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
369 | typedef 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. */
|
---|
374 | typedef RTINTPTR *PRTINTPTR;
|
---|
375 | /** Pointer const to signed integer which can contain both GC and HC pointers. */
|
---|
376 | typedef 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)
|
---|
380 | typedef uint32_t RTUINTPTR;
|
---|
381 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
382 | typedef 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. */
|
---|
387 | typedef RTUINTPTR *PRTUINTPTR;
|
---|
388 | /** Pointer const to unsigned integer which can contain both GC and HC pointers. */
|
---|
389 | typedef const RTUINTPTR *PCRTUINTPTR;
|
---|
390 |
|
---|
391 | /** Signed integer. */
|
---|
392 | typedef int32_t RTINT;
|
---|
393 | /** Pointer to signed integer. */
|
---|
394 | typedef RTINT *PRTINT;
|
---|
395 | /** Pointer to const signed integer. */
|
---|
396 | typedef const RTINT *PCRTINT;
|
---|
397 |
|
---|
398 | /** Unsigned integer. */
|
---|
399 | typedef uint32_t RTUINT;
|
---|
400 | /** Pointer to unsigned integer. */
|
---|
401 | typedef RTUINT *PRTUINT;
|
---|
402 | /** Pointer to const unsigned integer. */
|
---|
403 | typedef const RTUINT *PCRTUINT;
|
---|
404 |
|
---|
405 | /** A file offset / size (off_t). */
|
---|
406 | typedef int64_t RTFOFF;
|
---|
407 | /** Pointer to a file offset / size. */
|
---|
408 | typedef RTFOFF *PRTFOFF;
|
---|
409 | /** The max value for RTFOFF. */
|
---|
410 | #define RTFOFF_MAX INT64_MAX
|
---|
411 | /** The min value for RTFOFF. */
|
---|
412 | #define RTFOFF_MIN INT64_MIN
|
---|
413 |
|
---|
414 | /** File mode (see iprt/fs.h). */
|
---|
415 | typedef uint32_t RTFMODE;
|
---|
416 | /** Pointer to file mode. */
|
---|
417 | typedef RTFMODE *PRTFMODE;
|
---|
418 |
|
---|
419 | /** Device unix number. */
|
---|
420 | typedef uint32_t RTDEV;
|
---|
421 | /** Pointer to a device unix number. */
|
---|
422 | typedef RTDEV *PRTDEV;
|
---|
423 |
|
---|
424 | /** i-node number. */
|
---|
425 | typedef uint64_t RTINODE;
|
---|
426 | /** Pointer to a i-node number. */
|
---|
427 | typedef RTINODE *PRTINODE;
|
---|
428 |
|
---|
429 | /** User id. */
|
---|
430 | typedef uint32_t RTUID;
|
---|
431 | /** Pointer to a user id. */
|
---|
432 | typedef RTUID *PRTUID;
|
---|
433 | /** NIL user id.
|
---|
434 | * @todo check this for portability! */
|
---|
435 | #define NIL_RTUID (~(RTUID)0);
|
---|
436 |
|
---|
437 | /** Group id. */
|
---|
438 | typedef uint32_t RTGID;
|
---|
439 | /** Pointer to a group id. */
|
---|
440 | typedef RTGID *PRTGID;
|
---|
441 | /** NIL group id.
|
---|
442 | * @todo check this for portability! */
|
---|
443 | #define NIL_RTGID (~(RTGID)0);
|
---|
444 |
|
---|
445 | /** I/O Port. */
|
---|
446 | typedef uint16_t RTIOPORT;
|
---|
447 | /** Pointer to I/O Port. */
|
---|
448 | typedef RTIOPORT *PRTIOPORT;
|
---|
449 | /** Pointer to const I/O Port. */
|
---|
450 | typedef const RTIOPORT *PCRTIOPORT;
|
---|
451 |
|
---|
452 | /** Selector. */
|
---|
453 | typedef uint16_t RTSEL;
|
---|
454 | /** Pointer to selector. */
|
---|
455 | typedef RTSEL *PRTSEL;
|
---|
456 | /** Pointer to const selector. */
|
---|
457 | typedef const RTSEL *PCRTSEL;
|
---|
458 | /** Max selector value. */
|
---|
459 | #define RTSEL_MAX UINT16_MAX
|
---|
460 |
|
---|
461 | /** Far 16-bit pointer. */
|
---|
462 | #pragma pack(1)
|
---|
463 | typedef struct RTFAR16
|
---|
464 | {
|
---|
465 | uint16_t off;
|
---|
466 | RTSEL sel;
|
---|
467 | } RTFAR16;
|
---|
468 | #pragma pack()
|
---|
469 | /** Pointer to Far 16-bit pointer. */
|
---|
470 | typedef RTFAR16 *PRTFAR16;
|
---|
471 | /** Pointer to const Far 16-bit pointer. */
|
---|
472 | typedef const RTFAR16 *PCRTFAR16;
|
---|
473 |
|
---|
474 | /** Far 32-bit pointer. */
|
---|
475 | #pragma pack(1)
|
---|
476 | typedef struct RTFAR32
|
---|
477 | {
|
---|
478 | uint32_t off;
|
---|
479 | RTSEL sel;
|
---|
480 | } RTFAR32;
|
---|
481 | #pragma pack()
|
---|
482 | /** Pointer to Far 32-bit pointer. */
|
---|
483 | typedef RTFAR32 *PRTFAR32;
|
---|
484 | /** Pointer to const Far 32-bit pointer. */
|
---|
485 | typedef const RTFAR32 *PCRTFAR32;
|
---|
486 |
|
---|
487 | /** Far 64-bit pointer. */
|
---|
488 | #pragma pack(1)
|
---|
489 | typedef struct RTFAR64
|
---|
490 | {
|
---|
491 | uint64_t off;
|
---|
492 | RTSEL sel;
|
---|
493 | } RTFAR64;
|
---|
494 | #pragma pack()
|
---|
495 | /** Pointer to Far 64-bit pointer. */
|
---|
496 | typedef RTFAR64 *PRTFAR64;
|
---|
497 | /** Pointer to const Far 64-bit pointer. */
|
---|
498 | typedef const RTFAR64 *PCRTFAR64;
|
---|
499 |
|
---|
500 | /** @} */
|
---|
501 |
|
---|
502 |
|
---|
503 | /** @defgroup grp_rt_types_hc Host Context Basic Types
|
---|
504 | * @ingroup grp_rt_types
|
---|
505 | * @{
|
---|
506 | */
|
---|
507 |
|
---|
508 | /** HC Natural signed integer.
|
---|
509 | * @deprecated silly type. */
|
---|
510 | typedef int32_t RTHCINT;
|
---|
511 | /** Pointer to HC Natural signed integer.
|
---|
512 | * @deprecated silly type. */
|
---|
513 | typedef RTHCINT *PRTHCINT;
|
---|
514 | /** Pointer to const HC Natural signed integer.
|
---|
515 | * @deprecated silly type. */
|
---|
516 | typedef const RTHCINT *PCRTHCINT;
|
---|
517 |
|
---|
518 | /** HC Natural unsigned integer.
|
---|
519 | * @deprecated silly type. */
|
---|
520 | typedef uint32_t RTHCUINT;
|
---|
521 | /** Pointer to HC Natural unsigned integer.
|
---|
522 | * @deprecated silly type. */
|
---|
523 | typedef RTHCUINT *PRTHCUINT;
|
---|
524 | /** Pointer to const HC Natural unsigned integer.
|
---|
525 | * @deprecated silly type. */
|
---|
526 | typedef const RTHCUINT *PCRTHCUINT;
|
---|
527 |
|
---|
528 |
|
---|
529 | /** Signed integer which can contain a HC pointer. */
|
---|
530 | #if HC_ARCH_BITS == 32
|
---|
531 | typedef int32_t RTHCINTPTR;
|
---|
532 | #elif HC_ARCH_BITS == 64
|
---|
533 | typedef int64_t RTHCINTPTR;
|
---|
534 | #else
|
---|
535 | # error Unsupported HC_ARCH_BITS value.
|
---|
536 | #endif
|
---|
537 | /** Pointer to signed integer which can contain a HC pointer. */
|
---|
538 | typedef RTHCINTPTR *PRTHCINTPTR;
|
---|
539 | /** Pointer to const signed integer which can contain a HC pointer. */
|
---|
540 | typedef const RTHCINTPTR *PCRTHCINTPTR;
|
---|
541 |
|
---|
542 | /** Signed integer which can contain a HC ring-3 pointer. */
|
---|
543 | #if R3_ARCH_BITS == 32
|
---|
544 | typedef int32_t RTR3INTPTR;
|
---|
545 | #elif R3_ARCH_BITS == 64
|
---|
546 | typedef int64_t RTR3INTPTR;
|
---|
547 | #else
|
---|
548 | # error Unsupported R3_ARCH_BITS value.
|
---|
549 | #endif
|
---|
550 | /** Pointer to signed integer which can contain a HC ring-3 pointer. */
|
---|
551 | typedef RTR3INTPTR *PRTR3INTPTR;
|
---|
552 | /** Pointer to const signed integer which can contain a HC ring-3 pointer. */
|
---|
553 | typedef const RTR3INTPTR *PCRTR3INTPTR;
|
---|
554 |
|
---|
555 | /** Signed integer which can contain a HC ring-0 pointer. */
|
---|
556 | #if R0_ARCH_BITS == 32
|
---|
557 | typedef int32_t RTR0INTPTR;
|
---|
558 | #elif R0_ARCH_BITS == 64
|
---|
559 | typedef int64_t RTR0INTPTR;
|
---|
560 | #else
|
---|
561 | # error Unsupported R0_ARCH_BITS value.
|
---|
562 | #endif
|
---|
563 | /** Pointer to signed integer which can contain a HC ring-0 pointer. */
|
---|
564 | typedef RTR0INTPTR *PRTR0INTPTR;
|
---|
565 | /** Pointer to const signed integer which can contain a HC ring-0 pointer. */
|
---|
566 | typedef const RTR0INTPTR *PCRTR0INTPTR;
|
---|
567 |
|
---|
568 |
|
---|
569 | /** Unsigned integer which can contain a HC pointer. */
|
---|
570 | #if HC_ARCH_BITS == 32
|
---|
571 | typedef uint32_t RTHCUINTPTR;
|
---|
572 | #elif HC_ARCH_BITS == 64
|
---|
573 | typedef uint64_t RTHCUINTPTR;
|
---|
574 | #else
|
---|
575 | # error Unsupported HC_ARCH_BITS value.
|
---|
576 | #endif
|
---|
577 | /** Pointer to unsigned integer which can contain a HC pointer. */
|
---|
578 | typedef RTHCUINTPTR *PRTHCUINTPTR;
|
---|
579 | /** Pointer to unsigned integer which can contain a HC pointer. */
|
---|
580 | typedef const RTHCUINTPTR *PCRTHCUINTPTR;
|
---|
581 |
|
---|
582 | /** Unsigned integer which can contain a HC ring-3 pointer. */
|
---|
583 | #if R3_ARCH_BITS == 32
|
---|
584 | typedef uint32_t RTR3UINTPTR;
|
---|
585 | #elif R3_ARCH_BITS == 64
|
---|
586 | typedef uint64_t RTR3UINTPTR;
|
---|
587 | #else
|
---|
588 | # error Unsupported R3_ARCH_BITS value.
|
---|
589 | #endif
|
---|
590 | /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
|
---|
591 | typedef RTR3UINTPTR *PRTR3UINTPTR;
|
---|
592 | /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
|
---|
593 | typedef const RTR3UINTPTR *PCRTR3UINTPTR;
|
---|
594 |
|
---|
595 | /** Unsigned integer which can contain a HC ring-0 pointer. */
|
---|
596 | #if R0_ARCH_BITS == 32
|
---|
597 | typedef uint32_t RTR0UINTPTR;
|
---|
598 | #elif R0_ARCH_BITS == 64
|
---|
599 | typedef uint64_t RTR0UINTPTR;
|
---|
600 | #else
|
---|
601 | # error Unsupported R0_ARCH_BITS value.
|
---|
602 | #endif
|
---|
603 | /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
|
---|
604 | typedef RTR0UINTPTR *PRTR0UINTPTR;
|
---|
605 | /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
|
---|
606 | typedef const RTR0UINTPTR *PCRTR0UINTPTR;
|
---|
607 |
|
---|
608 |
|
---|
609 | /** Host Physical Memory Address. */
|
---|
610 | typedef uint64_t RTHCPHYS;
|
---|
611 | /** Pointer to Host Physical Memory Address. */
|
---|
612 | typedef RTHCPHYS *PRTHCPHYS;
|
---|
613 | /** Pointer to const Host Physical Memory Address. */
|
---|
614 | typedef const RTHCPHYS *PCRTHCPHYS;
|
---|
615 | /** @def NIL_RTHCPHYS
|
---|
616 | * NIL HC Physical Address.
|
---|
617 | * NIL_RTHCPHYS is used to signal an invalid physical address, similar
|
---|
618 | * to the NULL pointer.
|
---|
619 | */
|
---|
620 | #define NIL_RTHCPHYS ((RTHCPHYS)~0U) /** @todo change this to (~(VBOXHCPHYS)0) */
|
---|
621 |
|
---|
622 |
|
---|
623 | /** HC pointer. */
|
---|
624 | #ifndef IN_RC
|
---|
625 | typedef void * RTHCPTR;
|
---|
626 | #else
|
---|
627 | typedef RTHCUINTPTR RTHCPTR;
|
---|
628 | #endif
|
---|
629 | /** Pointer to HC pointer. */
|
---|
630 | typedef RTHCPTR *PRTHCPTR;
|
---|
631 | /** Pointer to const HC pointer. */
|
---|
632 | typedef const RTHCPTR *PCRTHCPTR;
|
---|
633 | /** @def NIL_RTHCPTR
|
---|
634 | * NIL HC pointer.
|
---|
635 | */
|
---|
636 | #define NIL_RTHCPTR ((RTHCPTR)0)
|
---|
637 |
|
---|
638 | /** HC ring-3 pointer. */
|
---|
639 | #ifdef IN_RING3
|
---|
640 | typedef void * RTR3PTR;
|
---|
641 | #else
|
---|
642 | typedef RTR3UINTPTR RTR3PTR;
|
---|
643 | #endif
|
---|
644 | /** Pointer to HC ring-3 pointer. */
|
---|
645 | typedef RTR3PTR *PRTR3PTR;
|
---|
646 | /** Pointer to const HC ring-3 pointer. */
|
---|
647 | typedef const RTR3PTR *PCRTR3PTR;
|
---|
648 | /** @def NIL_RTR3PTR
|
---|
649 | * NIL HC ring-3 pointer.
|
---|
650 | */
|
---|
651 | #define NIL_RTR3PTR ((RTR3PTR)0)
|
---|
652 |
|
---|
653 | /** HC ring-0 pointer. */
|
---|
654 | #ifdef IN_RING0
|
---|
655 | typedef void * RTR0PTR;
|
---|
656 | #else
|
---|
657 | typedef RTR0UINTPTR RTR0PTR;
|
---|
658 | #endif
|
---|
659 | /** Pointer to HC ring-0 pointer. */
|
---|
660 | typedef RTR0PTR *PRTR0PTR;
|
---|
661 | /** Pointer to const HC ring-0 pointer. */
|
---|
662 | typedef const RTR0PTR *PCRTR0PTR;
|
---|
663 | /** @def NIL_RTR0PTR
|
---|
664 | * NIL HC ring-0 pointer.
|
---|
665 | */
|
---|
666 | #define NIL_RTR0PTR ((RTR0PTR)0)
|
---|
667 |
|
---|
668 |
|
---|
669 | /** Unsigned integer register in the host context. */
|
---|
670 | #if HC_ARCH_BITS == 32
|
---|
671 | typedef uint32_t RTHCUINTREG;
|
---|
672 | #elif HC_ARCH_BITS == 64
|
---|
673 | typedef uint64_t RTHCUINTREG;
|
---|
674 | #else
|
---|
675 | # error "Unsupported HC_ARCH_BITS!"
|
---|
676 | #endif
|
---|
677 | /** Pointer to an unsigned integer register in the host context. */
|
---|
678 | typedef RTHCUINTREG *PRTHCUINTREG;
|
---|
679 | /** Pointer to a const unsigned integer register in the host context. */
|
---|
680 | typedef const RTHCUINTREG *PCRTHCUINTREG;
|
---|
681 |
|
---|
682 | /** Unsigned integer register in the host ring-3 context. */
|
---|
683 | #if R3_ARCH_BITS == 32
|
---|
684 | typedef uint32_t RTR3UINTREG;
|
---|
685 | #elif R3_ARCH_BITS == 64
|
---|
686 | typedef uint64_t RTR3UINTREG;
|
---|
687 | #else
|
---|
688 | # error "Unsupported R3_ARCH_BITS!"
|
---|
689 | #endif
|
---|
690 | /** Pointer to an unsigned integer register in the host ring-3 context. */
|
---|
691 | typedef RTR3UINTREG *PRTR3UINTREG;
|
---|
692 | /** Pointer to a const unsigned integer register in the host ring-3 context. */
|
---|
693 | typedef const RTR3UINTREG *PCRTR3UINTREG;
|
---|
694 |
|
---|
695 | /** Unsigned integer register in the host ring-3 context. */
|
---|
696 | #if R0_ARCH_BITS == 32
|
---|
697 | typedef uint32_t RTR0UINTREG;
|
---|
698 | #elif R0_ARCH_BITS == 64
|
---|
699 | typedef uint64_t RTR0UINTREG;
|
---|
700 | #else
|
---|
701 | # error "Unsupported R3_ARCH_BITS!"
|
---|
702 | #endif
|
---|
703 | /** Pointer to an unsigned integer register in the host ring-3 context. */
|
---|
704 | typedef RTR0UINTREG *PRTR0UINTREG;
|
---|
705 | /** Pointer to a const unsigned integer register in the host ring-3 context. */
|
---|
706 | typedef const RTR0UINTREG *PCRTR0UINTREG;
|
---|
707 |
|
---|
708 | /** @} */
|
---|
709 |
|
---|
710 |
|
---|
711 | /** @defgroup grp_rt_types_gc Guest Context Basic Types
|
---|
712 | * @ingroup grp_rt_types
|
---|
713 | * @{
|
---|
714 | */
|
---|
715 |
|
---|
716 | /** Natural signed integer in the GC.
|
---|
717 | * @deprecated silly type. */
|
---|
718 | #if GC_ARCH_BITS == 32
|
---|
719 | typedef int32_t RTGCINT;
|
---|
720 | #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
|
---|
721 | typedef int64_t RTGCINT;
|
---|
722 | #endif
|
---|
723 | /** Pointer to natural signed integer in GC.
|
---|
724 | * @deprecated silly type. */
|
---|
725 | typedef RTGCINT *PRTGCINT;
|
---|
726 | /** Pointer to const natural signed integer in GC.
|
---|
727 | * @deprecated silly type. */
|
---|
728 | typedef const RTGCINT *PCRTGCINT;
|
---|
729 |
|
---|
730 | /** Natural unsigned integer in the GC.
|
---|
731 | * @deprecated silly type. */
|
---|
732 | #if GC_ARCH_BITS == 32
|
---|
733 | typedef uint32_t RTGCUINT;
|
---|
734 | #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
|
---|
735 | typedef uint64_t RTGCUINT;
|
---|
736 | #endif
|
---|
737 | /** Pointer to natural unsigned integer in GC.
|
---|
738 | * @deprecated silly type. */
|
---|
739 | typedef RTGCUINT *PRTGCUINT;
|
---|
740 | /** Pointer to const natural unsigned integer in GC.
|
---|
741 | * @deprecated silly type. */
|
---|
742 | typedef const RTGCUINT *PCRTGCUINT;
|
---|
743 |
|
---|
744 | /** Signed integer which can contain a GC pointer. */
|
---|
745 | #if GC_ARCH_BITS == 32
|
---|
746 | typedef int32_t RTGCINTPTR;
|
---|
747 | #elif GC_ARCH_BITS == 64
|
---|
748 | typedef int64_t RTGCINTPTR;
|
---|
749 | #endif
|
---|
750 | /** Pointer to signed integer which can contain a GC pointer. */
|
---|
751 | typedef RTGCINTPTR *PRTGCINTPTR;
|
---|
752 | /** Pointer to const signed integer which can contain a GC pointer. */
|
---|
753 | typedef const RTGCINTPTR *PCRTGCINTPTR;
|
---|
754 |
|
---|
755 | /** Unsigned integer which can contain a GC pointer. */
|
---|
756 | #if GC_ARCH_BITS == 32
|
---|
757 | typedef uint32_t RTGCUINTPTR;
|
---|
758 | #elif GC_ARCH_BITS == 64
|
---|
759 | typedef uint64_t RTGCUINTPTR;
|
---|
760 | #else
|
---|
761 | # error Unsupported GC_ARCH_BITS value.
|
---|
762 | #endif
|
---|
763 | /** Pointer to unsigned integer which can contain a GC pointer. */
|
---|
764 | typedef RTGCUINTPTR *PRTGCUINTPTR;
|
---|
765 | /** Pointer to unsigned integer which can contain a GC pointer. */
|
---|
766 | typedef const RTGCUINTPTR *PCRTGCUINTPTR;
|
---|
767 |
|
---|
768 | /** Unsigned integer which can contain a 32 bits GC pointer. */
|
---|
769 | typedef uint32_t RTGCUINTPTR32;
|
---|
770 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
771 | typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
|
---|
772 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
773 | typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;
|
---|
774 |
|
---|
775 | /** Unsigned integer which can contain a 64 bits GC pointer. */
|
---|
776 | typedef uint64_t RTGCUINTPTR64;
|
---|
777 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
778 | typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
|
---|
779 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
780 | typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
|
---|
781 |
|
---|
782 | /** Guest Physical Memory Address.*/
|
---|
783 | typedef uint64_t RTGCPHYS;
|
---|
784 | /** Pointer to Guest Physical Memory Address. */
|
---|
785 | typedef RTGCPHYS *PRTGCPHYS;
|
---|
786 | /** Pointer to const Guest Physical Memory Address. */
|
---|
787 | typedef const RTGCPHYS *PCRTGCPHYS;
|
---|
788 | /** @def NIL_RTGCPHYS
|
---|
789 | * NIL GC Physical Address.
|
---|
790 | * NIL_RTGCPHYS is used to signal an invalid physical address, similar
|
---|
791 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
792 | * some contexts.
|
---|
793 | */
|
---|
794 | #define NIL_RTGCPHYS (~(RTGCPHYS)0U)
|
---|
795 |
|
---|
796 |
|
---|
797 | /** Guest Physical Memory Address; limited to 32 bits.*/
|
---|
798 | typedef uint32_t RTGCPHYS32;
|
---|
799 | /** Pointer to Guest Physical Memory Address. */
|
---|
800 | typedef RTGCPHYS32 *PRTGCPHYS32;
|
---|
801 | /** Pointer to const Guest Physical Memory Address. */
|
---|
802 | typedef const RTGCPHYS32 *PCRTGCPHYS32;
|
---|
803 | /** @def NIL_RTGCPHYS32
|
---|
804 | * NIL GC Physical Address.
|
---|
805 | * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
|
---|
806 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
807 | * some contexts.
|
---|
808 | */
|
---|
809 | #define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
|
---|
810 |
|
---|
811 |
|
---|
812 | /** Guest Physical Memory Address; limited to 64 bits.*/
|
---|
813 | typedef uint64_t RTGCPHYS64;
|
---|
814 | /** Pointer to Guest Physical Memory Address. */
|
---|
815 | typedef RTGCPHYS64 *PRTGCPHYS64;
|
---|
816 | /** Pointer to const Guest Physical Memory Address. */
|
---|
817 | typedef const RTGCPHYS64 *PCRTGCPHYS64;
|
---|
818 | /** @def NIL_RTGCPHYS64
|
---|
819 | * NIL GC Physical Address.
|
---|
820 | * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
|
---|
821 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
822 | * some contexts.
|
---|
823 | */
|
---|
824 | #define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
|
---|
825 |
|
---|
826 | /** Guest context pointer, 32 bits.
|
---|
827 | * Keep in mind that this type is an unsigned integer in
|
---|
828 | * HC and void pointer in GC.
|
---|
829 | */
|
---|
830 | typedef RTGCUINTPTR32 RTGCPTR32;
|
---|
831 | /** Pointer to a guest context pointer. */
|
---|
832 | typedef RTGCPTR32 *PRTGCPTR32;
|
---|
833 | /** Pointer to a const guest context pointer. */
|
---|
834 | typedef const RTGCPTR32 *PCRTGCPTR32;
|
---|
835 | /** @def NIL_RTGCPTR32
|
---|
836 | * NIL GC pointer.
|
---|
837 | */
|
---|
838 | #define NIL_RTGCPTR32 ((RTGCPTR32)0)
|
---|
839 |
|
---|
840 | /** Guest context pointer, 64 bits.
|
---|
841 | */
|
---|
842 | typedef RTGCUINTPTR64 RTGCPTR64;
|
---|
843 | /** Pointer to a guest context pointer. */
|
---|
844 | typedef RTGCPTR64 *PRTGCPTR64;
|
---|
845 | /** Pointer to a const guest context pointer. */
|
---|
846 | typedef const RTGCPTR64 *PCRTGCPTR64;
|
---|
847 | /** @def NIL_RTGCPTR64
|
---|
848 | * NIL GC pointer.
|
---|
849 | */
|
---|
850 | #define NIL_RTGCPTR64 ((RTGCPTR64)0)
|
---|
851 |
|
---|
852 | /** Guest context pointer.
|
---|
853 | * Keep in mind that this type is an unsigned integer in
|
---|
854 | * HC and void pointer in GC.
|
---|
855 | */
|
---|
856 | #if GC_ARCH_BITS == 64
|
---|
857 | typedef RTGCPTR64 RTGCPTR;
|
---|
858 | /** Pointer to a guest context pointer. */
|
---|
859 | typedef PRTGCPTR64 PRTGCPTR;
|
---|
860 | /** Pointer to a const guest context pointer. */
|
---|
861 | typedef PCRTGCPTR64 PCRTGCPTR;
|
---|
862 | /** @def NIL_RTGCPTR
|
---|
863 | * NIL GC pointer.
|
---|
864 | */
|
---|
865 | #define NIL_RTGCPTR NIL_RTGCPTR64
|
---|
866 | #elif GC_ARCH_BITS == 32
|
---|
867 | typedef RTGCPTR32 RTGCPTR;
|
---|
868 | /** Pointer to a guest context pointer. */
|
---|
869 | typedef PRTGCPTR32 PRTGCPTR;
|
---|
870 | /** Pointer to a const guest context pointer. */
|
---|
871 | typedef PCRTGCPTR32 PCRTGCPTR;
|
---|
872 | /** @def NIL_RTGCPTR
|
---|
873 | * NIL GC pointer.
|
---|
874 | */
|
---|
875 | #define NIL_RTGCPTR NIL_RTGCPTR32
|
---|
876 | #else
|
---|
877 | # error "Unsupported GC_ARCH_BITS!"
|
---|
878 | #endif
|
---|
879 |
|
---|
880 | /** Unsigned integer register in the guest context. */
|
---|
881 | typedef uint32_t RTGCUINTREG32;
|
---|
882 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
883 | typedef RTGCUINTREG32 *PRTGCUINTREG32;
|
---|
884 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
885 | typedef const RTGCUINTREG32 *PCRTGCUINTREG32;
|
---|
886 |
|
---|
887 | typedef uint64_t RTGCUINTREG64;
|
---|
888 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
889 | typedef RTGCUINTREG64 *PRTGCUINTREG64;
|
---|
890 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
891 | typedef const RTGCUINTREG64 *PCRTGCUINTREG64;
|
---|
892 |
|
---|
893 | #if GC_ARCH_BITS == 64
|
---|
894 | typedef RTGCUINTREG64 RTGCUINTREG;
|
---|
895 | #elif GC_ARCH_BITS == 32
|
---|
896 | typedef RTGCUINTREG32 RTGCUINTREG;
|
---|
897 | #else
|
---|
898 | # error "Unsupported GC_ARCH_BITS!"
|
---|
899 | #endif
|
---|
900 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
901 | typedef RTGCUINTREG *PRTGCUINTREG;
|
---|
902 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
903 | typedef const RTGCUINTREG *PCRTGCUINTREG;
|
---|
904 |
|
---|
905 | /** @} */
|
---|
906 |
|
---|
907 | /** @defgroup grp_rt_types_rc Raw mode Context Basic Types
|
---|
908 | * @ingroup grp_rt_types
|
---|
909 | * @{
|
---|
910 | */
|
---|
911 |
|
---|
912 | /** Raw mode context pointer; a 32 bits guest context pointer.
|
---|
913 | * Keep in mind that this type is an unsigned integer in
|
---|
914 | * HC and void pointer in RC.
|
---|
915 | */
|
---|
916 | #ifdef IN_RC
|
---|
917 | typedef void * RTRCPTR;
|
---|
918 | #else
|
---|
919 | typedef uint32_t RTRCPTR;
|
---|
920 | #endif
|
---|
921 | /** Pointer to a raw mode context pointer. */
|
---|
922 | typedef RTRCPTR *PRTRCPTR;
|
---|
923 | /** Pointer to a const raw mode context pointer. */
|
---|
924 | typedef const RTRCPTR *PCRTRCPTR;
|
---|
925 | /** @def NIL_RTGCPTR
|
---|
926 | * NIL RC pointer.
|
---|
927 | */
|
---|
928 | #define NIL_RTRCPTR ((RTRCPTR)0)
|
---|
929 | /** @def RTRCPTR_MAX
|
---|
930 | * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
|
---|
931 | */
|
---|
932 | #define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
|
---|
933 |
|
---|
934 | /** Raw mode context pointer, unsigned integer variant. */
|
---|
935 | typedef int32_t RTRCINTPTR;
|
---|
936 | /** @def RTRCUINPTR_MAX
|
---|
937 | * The maximum value a RTRCUINPTR can have.
|
---|
938 | */
|
---|
939 | #define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
|
---|
940 |
|
---|
941 | /** Raw mode context pointer, signed integer variant. */
|
---|
942 | typedef uint32_t RTRCUINTPTR;
|
---|
943 | /** @def RTRCINPTR_MIN
|
---|
944 | * The minimum value a RTRCINPTR can have.
|
---|
945 | */
|
---|
946 | #define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
|
---|
947 | /** @def RTRCINPTR_MAX
|
---|
948 | * The maximum value a RTRCINPTR can have.
|
---|
949 | */
|
---|
950 | #define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
|
---|
951 |
|
---|
952 | /** @} */
|
---|
953 |
|
---|
954 |
|
---|
955 | /** @defgroup grp_rt_types_cc Current Context Basic Types
|
---|
956 | * @ingroup grp_rt_types
|
---|
957 | * @{
|
---|
958 | */
|
---|
959 |
|
---|
960 | /** Current Context Physical Memory Address.*/
|
---|
961 | #ifdef IN_RC
|
---|
962 | typedef RTGCPHYS RTCCPHYS;
|
---|
963 | #else
|
---|
964 | typedef RTHCPHYS RTCCPHYS;
|
---|
965 | #endif
|
---|
966 | /** Pointer to Current Context Physical Memory Address. */
|
---|
967 | typedef RTCCPHYS *PRTCCPHYS;
|
---|
968 | /** Pointer to const Current Context Physical Memory Address. */
|
---|
969 | typedef const RTCCPHYS *PCRTCCPHYS;
|
---|
970 | /** @def NIL_RTCCPHYS
|
---|
971 | * NIL CC Physical Address.
|
---|
972 | * NIL_RTCCPHYS is used to signal an invalid physical address, similar
|
---|
973 | * to the NULL pointer.
|
---|
974 | */
|
---|
975 | #ifdef IN_RC
|
---|
976 | # define NIL_RTCCPHYS NIL_RTGCPHYS
|
---|
977 | #else
|
---|
978 | # define NIL_RTCCPHYS NIL_RTHCPHYS
|
---|
979 | #endif
|
---|
980 |
|
---|
981 | /** Unsigned integer register in the current context. */
|
---|
982 | #if ARCH_BITS == 32
|
---|
983 | typedef uint32_t RTCCUINTREG;
|
---|
984 | #elif ARCH_BITS == 64
|
---|
985 | typedef uint64_t RTCCUINTREG;
|
---|
986 | #else
|
---|
987 | # error "Unsupported ARCH_BITS!"
|
---|
988 | #endif
|
---|
989 | /** Pointer to an unsigned integer register in the current context. */
|
---|
990 | typedef RTCCUINTREG *PRTCCUINTREG;
|
---|
991 | /** Pointer to a const unsigned integer register in the current context. */
|
---|
992 | typedef RTCCUINTREG const *PCRTCCUINTREG;
|
---|
993 |
|
---|
994 | /** Signed integer register in the current context. */
|
---|
995 | #if ARCH_BITS == 32
|
---|
996 | typedef int32_t RTCCINTREG;
|
---|
997 | #elif ARCH_BITS == 64
|
---|
998 | typedef int64_t RTCCINTREG;
|
---|
999 | #endif
|
---|
1000 | /** Pointer to a signed integer register in the current context. */
|
---|
1001 | typedef RTCCINTREG *PRTCCINTREG;
|
---|
1002 | /** Pointer to a const signed integer register in the current context. */
|
---|
1003 | typedef RTCCINTREG const *PCRTCCINTREG;
|
---|
1004 |
|
---|
1005 | /** @} */
|
---|
1006 |
|
---|
1007 |
|
---|
1008 | /** File handle. */
|
---|
1009 | typedef RTUINT RTFILE;
|
---|
1010 | /** Pointer to file handle. */
|
---|
1011 | typedef RTFILE *PRTFILE;
|
---|
1012 | /** Nil file handle. */
|
---|
1013 | #define NIL_RTFILE (~(RTFILE)0)
|
---|
1014 |
|
---|
1015 | /** Loader module handle. */
|
---|
1016 | typedef R3PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
|
---|
1017 | /** Pointer to a loader module handle. */
|
---|
1018 | typedef RTLDRMOD *PRTLDRMOD;
|
---|
1019 | /** Nil loader module handle. */
|
---|
1020 | #define NIL_RTLDRMOD 0
|
---|
1021 |
|
---|
1022 | /** Ring-0 memory object handle. */
|
---|
1023 | typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *) RTR0MEMOBJ;
|
---|
1024 | /** Pointer to a Ring-0 memory object handle. */
|
---|
1025 | typedef RTR0MEMOBJ *PRTR0MEMOBJ;
|
---|
1026 | /** Nil ring-0 memory object handle. */
|
---|
1027 | #define NIL_RTR0MEMOBJ 0
|
---|
1028 |
|
---|
1029 | /** Native thread handle. */
|
---|
1030 | typedef RTHCUINTPTR RTNATIVETHREAD;
|
---|
1031 | /** Pointer to an native thread handle. */
|
---|
1032 | typedef RTNATIVETHREAD *PRTNATIVETHREAD;
|
---|
1033 | /** Nil native thread handle. */
|
---|
1034 | #define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
|
---|
1035 |
|
---|
1036 | /** Process identifier. */
|
---|
1037 | typedef uint32_t RTPROCESS;
|
---|
1038 | /** Pointer to a process identifier. */
|
---|
1039 | typedef RTPROCESS *PRTPROCESS;
|
---|
1040 | /** Nil process identifier. */
|
---|
1041 | #define NIL_RTPROCESS (~(RTPROCESS)0)
|
---|
1042 |
|
---|
1043 | /** Process ring-0 handle. */
|
---|
1044 | typedef RTR0UINTPTR RTR0PROCESS;
|
---|
1045 | /** Pointer to a ring-0 process handle. */
|
---|
1046 | typedef RTR0PROCESS *PRTR0PROCESS;
|
---|
1047 | /** Nil ring-0 process handle. */
|
---|
1048 | #define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
|
---|
1049 |
|
---|
1050 | /** @typedef RTSEMEVENT
|
---|
1051 | * Event Semaphore handle. */
|
---|
1052 | typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *) RTSEMEVENT;
|
---|
1053 | /** Pointer to an event semaphore handle. */
|
---|
1054 | typedef RTSEMEVENT *PRTSEMEVENT;
|
---|
1055 | /** Nil event semaphore handle. */
|
---|
1056 | #define NIL_RTSEMEVENT 0
|
---|
1057 |
|
---|
1058 | /** @typedef RTSEMEVENTMULTI
|
---|
1059 | * Event Multiple Release Semaphore handle. */
|
---|
1060 | typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
|
---|
1061 | /** Pointer to an event multiple release semaphore handle. */
|
---|
1062 | typedef RTSEMEVENTMULTI *PRTSEMEVENTMULTI;
|
---|
1063 | /** Nil multiple release event semaphore handle. */
|
---|
1064 | #define NIL_RTSEMEVENTMULTI 0
|
---|
1065 |
|
---|
1066 | /** @typedef RTSEMFASTMUTEX
|
---|
1067 | * Fast mutex Semaphore handle. */
|
---|
1068 | typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
|
---|
1069 | /** Pointer to a mutex semaphore handle. */
|
---|
1070 | typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
|
---|
1071 | /** Nil fast mutex semaphore handle. */
|
---|
1072 | #define NIL_RTSEMFASTMUTEX 0
|
---|
1073 |
|
---|
1074 | /** @typedef RTSEMMUTEX
|
---|
1075 | * Mutex Semaphore handle. */
|
---|
1076 | typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *) RTSEMMUTEX;
|
---|
1077 | /** Pointer to a mutex semaphore handle. */
|
---|
1078 | typedef RTSEMMUTEX *PRTSEMMUTEX;
|
---|
1079 | /** Nil mutex semaphore handle. */
|
---|
1080 | #define NIL_RTSEMMUTEX 0
|
---|
1081 |
|
---|
1082 | /** @typedef RTSEMRW
|
---|
1083 | * Read/Write Semaphore handle. */
|
---|
1084 | typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *) RTSEMRW;
|
---|
1085 | /** Pointer to a read/write semaphore handle. */
|
---|
1086 | typedef RTSEMRW *PRTSEMRW;
|
---|
1087 | /** Nil read/write semaphore handle. */
|
---|
1088 | #define NIL_RTSEMRW 0
|
---|
1089 |
|
---|
1090 | /** Spinlock handle. */
|
---|
1091 | typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *) RTSPINLOCK;
|
---|
1092 | /** Pointer to a spinlock handle. */
|
---|
1093 | typedef RTSPINLOCK *PRTSPINLOCK;
|
---|
1094 | /** Nil spinlock handle. */
|
---|
1095 | #define NIL_RTSPINLOCK 0
|
---|
1096 |
|
---|
1097 | /** Socket handle. */
|
---|
1098 | typedef int RTSOCKET;
|
---|
1099 | /** Pointer to socket handle. */
|
---|
1100 | typedef RTSOCKET *PRTSOCKET;
|
---|
1101 | /** Nil socket handle. */
|
---|
1102 | #define NIL_RTSOCKET (~(RTSOCKET)0)
|
---|
1103 |
|
---|
1104 | /** Thread handle.*/
|
---|
1105 | typedef R3R0PTRTYPE(struct RTTHREADINT *) RTTHREAD;
|
---|
1106 | /** Pointer to thread handle. */
|
---|
1107 | typedef RTTHREAD *PRTTHREAD;
|
---|
1108 | /** Nil thread handle. */
|
---|
1109 | #define NIL_RTTHREAD 0
|
---|
1110 |
|
---|
1111 | /** A TLS index. */
|
---|
1112 | typedef RTHCINTPTR RTTLS;
|
---|
1113 | /** Pointer to a TLS index. */
|
---|
1114 | typedef RTTLS *PRTTLS;
|
---|
1115 | /** Pointer to a const TLS index. */
|
---|
1116 | typedef RTTLS const *PCRTTLS;
|
---|
1117 | /** NIL TLS index value. */
|
---|
1118 | #define NIL_RTTLS (-1)
|
---|
1119 |
|
---|
1120 | /** Handle to a simple heap. */
|
---|
1121 | typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *) RTHEAPSIMPLE;
|
---|
1122 | /** Pointer to a handle to a simple heap. */
|
---|
1123 | typedef RTHEAPSIMPLE *PRTHEAPSIMPLE;
|
---|
1124 | /** NIL simple heap handle. */
|
---|
1125 | #define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
|
---|
1126 |
|
---|
1127 | /** Handle to an environment block. */
|
---|
1128 | typedef R3PTRTYPE(struct RTENVINTERNAL *) RTENV;
|
---|
1129 | /** Pointer to a handle to an environment block. */
|
---|
1130 | typedef RTENV *PRTENV;
|
---|
1131 | /** NIL simple heap handle. */
|
---|
1132 | #define NIL_RTENV ((RTENV)0)
|
---|
1133 |
|
---|
1134 | /** A CPU identifier.
|
---|
1135 | * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
|
---|
1136 | * does it have to correspond to the bits in the affinity mask, at
|
---|
1137 | * least not until we've sorted out Windows NT. */
|
---|
1138 | typedef RTHCUINTPTR RTCPUID;
|
---|
1139 | /** Pointer to a CPU identifier. */
|
---|
1140 | typedef RTCPUID *PRTCPUID;
|
---|
1141 | /** Pointer to a const CPU identifier. */
|
---|
1142 | typedef RTCPUID const *PCRTCPUID;
|
---|
1143 | /** Nil CPU Id. */
|
---|
1144 | #define NIL_RTCPUID ((RTCPUID)~0)
|
---|
1145 |
|
---|
1146 | /** A CPU set.
|
---|
1147 | * Treat this as an opaque type and always use RTCpuSet* for manupulating it. */
|
---|
1148 | typedef uint64_t RTCPUSET;
|
---|
1149 | /** Pointer to a CPU set. */
|
---|
1150 | typedef RTCPUSET *PRTCPUSET;
|
---|
1151 | /** Pointer to a const CPU set. */
|
---|
1152 | typedef RTCPUSET const *PCRTCPUSET;
|
---|
1153 |
|
---|
1154 | /** A handle table handle. */
|
---|
1155 | typedef struct RTHANDLETABLEINT *RTHANDLETABLE;
|
---|
1156 | /** A pointer to a handle table handle. */
|
---|
1157 | typedef RTHANDLETABLE *PRTHANDLETABLE;
|
---|
1158 | /** @def NIL_RTHANDLETABLE
|
---|
1159 | * NIL handle table handle. */
|
---|
1160 | #define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
|
---|
1161 |
|
---|
1162 | /** A handle to a low resolution timer. */
|
---|
1163 | typedef struct RTTIMERLRINT *RTTIMERLR;
|
---|
1164 | /** A pointer to a low resolution timer handle. */
|
---|
1165 | typedef RTTIMERLR *PRTTIMERLR;
|
---|
1166 | /** @def NIL_RTTIMERLR
|
---|
1167 | * NIL low resolution timer handle value. */
|
---|
1168 | #define NIL_RTTIMERLR ((RTTIMERLR)0)
|
---|
1169 |
|
---|
1170 | /** Handle to a random number generator. */
|
---|
1171 | typedef struct RTRANDINT *RTRAND;
|
---|
1172 | /** Pointer to a random number generator handle. */
|
---|
1173 | typedef RTRAND *PRTRAND;
|
---|
1174 | /** NIL random number genrator handle value. */
|
---|
1175 | #define NIL_RTRAND ((RTRAND)0)
|
---|
1176 |
|
---|
1177 |
|
---|
1178 | /**
|
---|
1179 | * UUID data type.
|
---|
1180 | *
|
---|
1181 | * @note IPRT defines that the first three integers in the @c Gen struct
|
---|
1182 | * interpretation are in little endian representation. This is different to
|
---|
1183 | * many other UUID implementation, and requires conversion if you need to
|
---|
1184 | * achieve consistent results.
|
---|
1185 | */
|
---|
1186 | typedef union RTUUID
|
---|
1187 | {
|
---|
1188 | /** 8-bit view. */
|
---|
1189 | uint8_t au8[16];
|
---|
1190 | /** 16-bit view. */
|
---|
1191 | uint16_t au16[8];
|
---|
1192 | /** 32-bit view. */
|
---|
1193 | uint32_t au32[4];
|
---|
1194 | /** 64-bit view. */
|
---|
1195 | uint64_t au64[2];
|
---|
1196 | /** The way the UUID is declared by the DCE specification. */
|
---|
1197 | struct
|
---|
1198 | {
|
---|
1199 | uint32_t u32TimeLow;
|
---|
1200 | uint16_t u16TimeMid;
|
---|
1201 | uint16_t u16TimeHiAndVersion;
|
---|
1202 | uint8_t u8ClockSeqHiAndReserved;
|
---|
1203 | uint8_t u8ClockSeqLow;
|
---|
1204 | uint8_t au8Node[6];
|
---|
1205 | } Gen;
|
---|
1206 | } RTUUID;
|
---|
1207 | /** Pointer to UUID data. */
|
---|
1208 | typedef RTUUID *PRTUUID;
|
---|
1209 | /** Pointer to readonly UUID data. */
|
---|
1210 | typedef const RTUUID *PCRTUUID;
|
---|
1211 |
|
---|
1212 | /**
|
---|
1213 | * UUID string maximum length.
|
---|
1214 | */
|
---|
1215 | #define RTUUID_STR_LENGTH 37
|
---|
1216 |
|
---|
1217 |
|
---|
1218 | /** Compression handle. */
|
---|
1219 | typedef struct RTZIPCOMP *PRTZIPCOMP;
|
---|
1220 |
|
---|
1221 | /** Decompressor handle. */
|
---|
1222 | typedef struct RTZIPDECOMP *PRTZIPDECOMP;
|
---|
1223 |
|
---|
1224 |
|
---|
1225 | /**
|
---|
1226 | * Unicode Code Point.
|
---|
1227 | */
|
---|
1228 | typedef uint32_t RTUNICP;
|
---|
1229 | /** Pointer to an Unicode Code Point. */
|
---|
1230 | typedef RTUNICP *PRTUNICP;
|
---|
1231 | /** Pointer to an Unicode Code Point. */
|
---|
1232 | typedef const RTUNICP *PCRTUNICP;
|
---|
1233 |
|
---|
1234 |
|
---|
1235 | /**
|
---|
1236 | * UTF-16 character.
|
---|
1237 | * @remark wchar_t is not usable since it's compiler defined.
|
---|
1238 | * @remark When we use the term character we're not talking about unicode code point, but
|
---|
1239 | * the basic unit of the string encoding. Thus cwc - count of wide chars - means
|
---|
1240 | * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
|
---|
1241 | * and cch means count of the typedef 'char', which is assumed to be an octet.
|
---|
1242 | */
|
---|
1243 | typedef uint16_t RTUTF16;
|
---|
1244 | /** Pointer to a UTF-16 character. */
|
---|
1245 | typedef RTUTF16 *PRTUTF16;
|
---|
1246 | /** Pointer to a const UTF-16 character. */
|
---|
1247 | typedef const RTUTF16 *PCRTUTF16;
|
---|
1248 |
|
---|
1249 |
|
---|
1250 | /**
|
---|
1251 | * Wait for ever if we have to.
|
---|
1252 | */
|
---|
1253 | #define RT_INDEFINITE_WAIT (~0U)
|
---|
1254 |
|
---|
1255 |
|
---|
1256 | /**
|
---|
1257 | * Generic process callback.
|
---|
1258 | *
|
---|
1259 | * @returns VBox status code. Failure will cancel the operation.
|
---|
1260 | * @param uPercentage The percentage of the operation which has been completed.
|
---|
1261 | * @param pvUser The user specified argument.
|
---|
1262 | */
|
---|
1263 | typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
|
---|
1264 | /** Pointer to a generic progress callback function, FNRTPROCESS(). */
|
---|
1265 | typedef FNRTPROGRESS *PFNRTPROGRESS;
|
---|
1266 |
|
---|
1267 |
|
---|
1268 | /**
|
---|
1269 | * Rectangle data type.
|
---|
1270 | */
|
---|
1271 | typedef struct RTRECT
|
---|
1272 | {
|
---|
1273 | /** left X coordinate. */
|
---|
1274 | int32_t xLeft;
|
---|
1275 | /** top Y coordinate. */
|
---|
1276 | int32_t yTop;
|
---|
1277 | /** right X coordinate. (exclusive) */
|
---|
1278 | int32_t xRight;
|
---|
1279 | /** bottom Y coordinate. (exclusive) */
|
---|
1280 | int32_t yBottom;
|
---|
1281 | } RTRECT;
|
---|
1282 | /** Pointer to a rectangle. */
|
---|
1283 | typedef RTRECT *PRTRECT;
|
---|
1284 | /** Pointer to a const rectangle. */
|
---|
1285 | typedef const RTRECT *PCRTRECT;
|
---|
1286 |
|
---|
1287 |
|
---|
1288 | /**
|
---|
1289 | * Ethernet MAC address.
|
---|
1290 | *
|
---|
1291 | * The first 24 bits make up the Organisationally Unique Identifier (OUI),
|
---|
1292 | * where the first bit (little endian) indicates multicast (set) / unicast,
|
---|
1293 | * and the second bit indicates locally (set) / global administered. If all
|
---|
1294 | * bits are set, it's a broadcast.
|
---|
1295 | */
|
---|
1296 | typedef union RTMAC
|
---|
1297 | {
|
---|
1298 | /** @todo add a bitfield view of this stuff. */
|
---|
1299 | /** 8-bit view. */
|
---|
1300 | uint8_t au8[6];
|
---|
1301 | /** 16-bit view. */
|
---|
1302 | uint16_t au16[3];
|
---|
1303 | } RTMAC;
|
---|
1304 | /** Pointer to a MAC address. */
|
---|
1305 | typedef RTMAC *PRTMAC;
|
---|
1306 | /** Pointer to a readonly MAC address. */
|
---|
1307 | typedef const RTMAC *PCRTMAC;
|
---|
1308 |
|
---|
1309 | /** @} */
|
---|
1310 |
|
---|
1311 | #endif
|
---|
1312 |
|
---|