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