1 | /** @file
|
---|
2 | * IPRT - Types.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2012 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(IN_XF86_MODULE) && !defined(NO_ANSIC)
|
---|
38 | /*
|
---|
39 | * Kludge for xfree86 modules: size_t and other types are redefined.
|
---|
40 | */
|
---|
41 | RT_C_DECLS_BEGIN
|
---|
42 | # include "xf86_ansic.h"
|
---|
43 | # undef NULL
|
---|
44 | RT_C_DECLS_END
|
---|
45 |
|
---|
46 | # elif defined(RT_OS_DARWIN) && defined(KERNEL)
|
---|
47 | /*
|
---|
48 | * Kludge for the darwin kernel:
|
---|
49 | * stddef.h is missing IIRC.
|
---|
50 | */
|
---|
51 | # ifndef _PTRDIFF_T
|
---|
52 | # define _PTRDIFF_T
|
---|
53 | typedef __darwin_ptrdiff_t ptrdiff_t;
|
---|
54 | # endif
|
---|
55 | # include <sys/types.h>
|
---|
56 |
|
---|
57 | # elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
|
---|
58 | /*
|
---|
59 | * Kludge for the FreeBSD kernel:
|
---|
60 | * stddef.h and sys/types.h have slightly different offsetof definitions
|
---|
61 | * when compiling in kernel mode. This is just to make GCC shut up.
|
---|
62 | */
|
---|
63 | # ifndef _STDDEF_H_
|
---|
64 | # undef offsetof
|
---|
65 | # endif
|
---|
66 | # include <sys/stddef.h>
|
---|
67 | # ifndef _SYS_TYPES_H_
|
---|
68 | # undef offsetof
|
---|
69 | # endif
|
---|
70 | # include <sys/types.h>
|
---|
71 | # ifndef offsetof
|
---|
72 | # error "offsetof is not defined..."
|
---|
73 | # endif
|
---|
74 |
|
---|
75 | # elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
|
---|
76 | /*
|
---|
77 | * Kludge for compiling 32-bit code on a 64-bit FreeBSD:
|
---|
78 | * FreeBSD declares uint64_t and int64_t wrong (long unsigned and long int
|
---|
79 | * though they need to be long long unsigned and long long int). These
|
---|
80 | * defines conflict with our decleration in stdint.h. Adding the defines
|
---|
81 | * below omits the definitions in the system header.
|
---|
82 | */
|
---|
83 | # include <stddef.h>
|
---|
84 | # define _UINT64_T_DECLARED
|
---|
85 | # define _INT64_T_DECLARED
|
---|
86 | # define _UINTPTR_T_DECLARED
|
---|
87 | # define _INTPTR_T_DECLARED
|
---|
88 | # include <sys/types.h>
|
---|
89 |
|
---|
90 | # elif defined(RT_OS_LINUX) && defined(__KERNEL__)
|
---|
91 | /*
|
---|
92 | * Kludge for the linux kernel:
|
---|
93 | * 1. sys/types.h doesn't mix with the kernel.
|
---|
94 | * 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
|
---|
95 | * declares false and true as enum values.
|
---|
96 | * 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
|
---|
97 | * We work around these issues here and nowhere else.
|
---|
98 | */
|
---|
99 | # include <stddef.h>
|
---|
100 | # if defined(__cplusplus)
|
---|
101 | typedef bool _Bool;
|
---|
102 | # endif
|
---|
103 | # define bool linux_bool
|
---|
104 | # define true linux_true
|
---|
105 | # define false linux_false
|
---|
106 | # define uintptr_t linux_uintptr_t
|
---|
107 | # include <linux/version.h>
|
---|
108 | # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
|
---|
109 | # include <generated/autoconf.h>
|
---|
110 | # else
|
---|
111 | # ifndef AUTOCONF_INCLUDED
|
---|
112 | # include <linux/autoconf.h>
|
---|
113 | # endif
|
---|
114 | # endif
|
---|
115 | # include <linux/compiler.h>
|
---|
116 | # if defined(__cplusplus)
|
---|
117 | /*
|
---|
118 | * Starting with 3.3, <linux/compiler-gcc.h> appends 'notrace' (which
|
---|
119 | * expands to __attribute__((no_instrument_function))) to inline,
|
---|
120 | * __inline and __inline__. Revert that.
|
---|
121 | */
|
---|
122 | # undef inline
|
---|
123 | # define inline inline
|
---|
124 | # undef __inline__
|
---|
125 | # define __inline__ __inline__
|
---|
126 | # undef __inline
|
---|
127 | # define __inline __inline
|
---|
128 | # endif
|
---|
129 | # include <linux/types.h>
|
---|
130 | # include <linux/stddef.h>
|
---|
131 | /*
|
---|
132 | * Starting with 3.4, <linux/stddef.h> defines NULL as '((void*)0)' which
|
---|
133 | * does not work for C++ code.
|
---|
134 | */
|
---|
135 | # undef NULL
|
---|
136 | # undef uintptr_t
|
---|
137 | # ifdef __GNUC__
|
---|
138 | # if (__GNUC__ * 100 + __GNUC_MINOR__) <= 400
|
---|
139 | /*
|
---|
140 | * <linux/compiler-gcc{3,4}.h> does
|
---|
141 | * #define __inline__ __inline__ __attribute__((always_inline))
|
---|
142 | * in some older Linux kernels. Forcing inlining will fail for some RTStrA*
|
---|
143 | * functions with gcc <= 4.0 due to passing variable argument lists.
|
---|
144 | */
|
---|
145 | # undef __inline__
|
---|
146 | # define __inline__ __inline__
|
---|
147 | # endif
|
---|
148 | # endif
|
---|
149 | # undef false
|
---|
150 | # undef true
|
---|
151 | # undef bool
|
---|
152 | # else
|
---|
153 | # include <stddef.h>
|
---|
154 | # include <sys/types.h>
|
---|
155 | # endif
|
---|
156 |
|
---|
157 |
|
---|
158 | /* Define any types missing from sys/types.h on windows. */
|
---|
159 | # ifdef _MSC_VER
|
---|
160 | # undef ssize_t
|
---|
161 | typedef intptr_t ssize_t;
|
---|
162 | # endif
|
---|
163 |
|
---|
164 | #else /* no crt */
|
---|
165 | # include <iprt/nocrt/compiler/compiler.h>
|
---|
166 | #endif /* no crt */
|
---|
167 |
|
---|
168 |
|
---|
169 |
|
---|
170 | /** @def NULL
|
---|
171 | * NULL pointer.
|
---|
172 | */
|
---|
173 | #ifndef NULL
|
---|
174 | # ifdef __cplusplus
|
---|
175 | # define NULL 0
|
---|
176 | # else
|
---|
177 | # define NULL ((void*)0)
|
---|
178 | # endif
|
---|
179 | #endif
|
---|
180 |
|
---|
181 |
|
---|
182 |
|
---|
183 | /** @defgroup grp_rt_types IPRT Base Types
|
---|
184 | * @{
|
---|
185 | */
|
---|
186 |
|
---|
187 | /* define wchar_t, we don't wanna include all the wcsstuff to get this. */
|
---|
188 | #ifdef _MSC_VER
|
---|
189 | # ifndef _WCHAR_T_DEFINED
|
---|
190 | typedef unsigned short wchar_t;
|
---|
191 | # define _WCHAR_T_DEFINED
|
---|
192 | # endif
|
---|
193 | #endif
|
---|
194 | #ifdef __GNUC__
|
---|
195 | /** @todo wchar_t on GNUC */
|
---|
196 | #endif
|
---|
197 |
|
---|
198 | /*
|
---|
199 | * C doesn't have bool, nor does VisualAge for C++ v3.08.
|
---|
200 | */
|
---|
201 | #if !defined(__cplusplus) || (defined(__IBMCPP__) && defined(RT_OS_OS2))
|
---|
202 | # if defined(__GNUC__)
|
---|
203 | # if defined(RT_OS_LINUX) && __GNUC__ < 3
|
---|
204 | typedef uint8_t bool;
|
---|
205 | # elif defined(RT_OS_FREEBSD)
|
---|
206 | # ifndef __bool_true_false_are_defined
|
---|
207 | typedef _Bool bool;
|
---|
208 | # endif
|
---|
209 | # else
|
---|
210 | # if (defined(RT_OS_DARWIN) || defined(RT_OS_HAIKU)) && defined(_STDBOOL_H)
|
---|
211 | # undef bool
|
---|
212 | # endif
|
---|
213 | typedef _Bool bool;
|
---|
214 | # endif
|
---|
215 | # else
|
---|
216 | typedef unsigned char bool;
|
---|
217 | # endif
|
---|
218 | # ifndef true
|
---|
219 | # define true (1)
|
---|
220 | # endif
|
---|
221 | # ifndef false
|
---|
222 | # define false (0)
|
---|
223 | # endif
|
---|
224 | #endif
|
---|
225 |
|
---|
226 | /**
|
---|
227 | * 128-bit unsigned integer.
|
---|
228 | */
|
---|
229 | #if defined(__GNUC__) && defined(RT_ARCH_AMD64)
|
---|
230 | typedef __uint128_t uint128_t;
|
---|
231 | #else
|
---|
232 | typedef struct uint128_s
|
---|
233 | {
|
---|
234 | # ifdef RT_BIG_ENDIAN
|
---|
235 | uint64_t Hi;
|
---|
236 | uint64_t Lo;
|
---|
237 | # else
|
---|
238 | uint64_t Lo;
|
---|
239 | uint64_t Hi;
|
---|
240 | # endif
|
---|
241 | } uint128_t;
|
---|
242 | #endif
|
---|
243 |
|
---|
244 |
|
---|
245 | /**
|
---|
246 | * 128-bit signed integer.
|
---|
247 | */
|
---|
248 | #if defined(__GNUC__) && defined(RT_ARCH_AMD64)
|
---|
249 | typedef __int128_t int128_t;
|
---|
250 | #else
|
---|
251 | typedef struct int128_s
|
---|
252 | {
|
---|
253 | # ifdef RT_BIG_ENDIAN
|
---|
254 | int64_t Hi;
|
---|
255 | uint64_t Lo;
|
---|
256 | # else
|
---|
257 | uint64_t Lo;
|
---|
258 | int64_t Hi;
|
---|
259 | # endif
|
---|
260 | } int128_t;
|
---|
261 | #endif
|
---|
262 |
|
---|
263 |
|
---|
264 | /**
|
---|
265 | * 16-bit unsigned integer union.
|
---|
266 | */
|
---|
267 | typedef union RTUINT16U
|
---|
268 | {
|
---|
269 | /** natural view. */
|
---|
270 | uint16_t u;
|
---|
271 |
|
---|
272 | /** 16-bit view. */
|
---|
273 | uint16_t au16[1];
|
---|
274 | /** 8-bit view. */
|
---|
275 | uint8_t au8[2];
|
---|
276 | /** 16-bit hi/lo view. */
|
---|
277 | struct
|
---|
278 | {
|
---|
279 | #ifdef RT_BIG_ENDIAN
|
---|
280 | uint8_t Hi;
|
---|
281 | uint8_t Lo;
|
---|
282 | #else
|
---|
283 | uint8_t Lo;
|
---|
284 | uint8_t Hi;
|
---|
285 | #endif
|
---|
286 | } s;
|
---|
287 | } RTUINT16U;
|
---|
288 | /** Pointer to a 16-bit unsigned integer union. */
|
---|
289 | typedef RTUINT16U *PRTUINT16U;
|
---|
290 | /** Pointer to a const 32-bit unsigned integer union. */
|
---|
291 | typedef const RTUINT16U *PCRTUINT16U;
|
---|
292 |
|
---|
293 |
|
---|
294 | /**
|
---|
295 | * 32-bit unsigned integer union.
|
---|
296 | */
|
---|
297 | typedef union RTUINT32U
|
---|
298 | {
|
---|
299 | /** natural view. */
|
---|
300 | uint32_t u;
|
---|
301 | /** Hi/Low view. */
|
---|
302 | struct
|
---|
303 | {
|
---|
304 | #ifdef RT_BIG_ENDIAN
|
---|
305 | uint16_t Hi;
|
---|
306 | uint16_t Lo;
|
---|
307 | #else
|
---|
308 | uint16_t Lo;
|
---|
309 | uint16_t Hi;
|
---|
310 | #endif
|
---|
311 | } s;
|
---|
312 | /** Word view. */
|
---|
313 | struct
|
---|
314 | {
|
---|
315 | #ifdef RT_BIG_ENDIAN
|
---|
316 | uint16_t w1;
|
---|
317 | uint16_t w0;
|
---|
318 | #else
|
---|
319 | uint16_t w0;
|
---|
320 | uint16_t w1;
|
---|
321 | #endif
|
---|
322 | } Words;
|
---|
323 |
|
---|
324 | /** 32-bit view. */
|
---|
325 | uint32_t au32[1];
|
---|
326 | /** 16-bit view. */
|
---|
327 | uint16_t au16[2];
|
---|
328 | /** 8-bit view. */
|
---|
329 | uint8_t au8[4];
|
---|
330 | } RTUINT32U;
|
---|
331 | /** Pointer to a 32-bit unsigned integer union. */
|
---|
332 | typedef RTUINT32U *PRTUINT32U;
|
---|
333 | /** Pointer to a const 32-bit unsigned integer union. */
|
---|
334 | typedef const RTUINT32U *PCRTUINT32U;
|
---|
335 |
|
---|
336 |
|
---|
337 | /**
|
---|
338 | * 64-bit unsigned integer union.
|
---|
339 | */
|
---|
340 | typedef union RTUINT64U
|
---|
341 | {
|
---|
342 | /** Natural view. */
|
---|
343 | uint64_t u;
|
---|
344 | /** Hi/Low view. */
|
---|
345 | struct
|
---|
346 | {
|
---|
347 | #ifdef RT_BIG_ENDIAN
|
---|
348 | uint32_t Hi;
|
---|
349 | uint32_t Lo;
|
---|
350 | #else
|
---|
351 | uint32_t Lo;
|
---|
352 | uint32_t Hi;
|
---|
353 | #endif
|
---|
354 | } s;
|
---|
355 | /** Double-Word view. */
|
---|
356 | struct
|
---|
357 | {
|
---|
358 | #ifdef RT_BIG_ENDIAN
|
---|
359 | uint32_t dw1;
|
---|
360 | uint32_t dw0;
|
---|
361 | #else
|
---|
362 | uint32_t dw0;
|
---|
363 | uint32_t dw1;
|
---|
364 | #endif
|
---|
365 | } DWords;
|
---|
366 | /** Word view. */
|
---|
367 | struct
|
---|
368 | {
|
---|
369 | #ifdef RT_BIG_ENDIAN
|
---|
370 | uint16_t w3;
|
---|
371 | uint16_t w2;
|
---|
372 | uint16_t w1;
|
---|
373 | uint16_t w0;
|
---|
374 | #else
|
---|
375 | uint16_t w0;
|
---|
376 | uint16_t w1;
|
---|
377 | uint16_t w2;
|
---|
378 | uint16_t w3;
|
---|
379 | #endif
|
---|
380 | } Words;
|
---|
381 |
|
---|
382 | /** 64-bit view. */
|
---|
383 | uint64_t au64[1];
|
---|
384 | /** 32-bit view. */
|
---|
385 | uint32_t au32[2];
|
---|
386 | /** 16-bit view. */
|
---|
387 | uint16_t au16[4];
|
---|
388 | /** 8-bit view. */
|
---|
389 | uint8_t au8[8];
|
---|
390 | } RTUINT64U;
|
---|
391 | /** Pointer to a 64-bit unsigned integer union. */
|
---|
392 | typedef RTUINT64U *PRTUINT64U;
|
---|
393 | /** Pointer to a const 64-bit unsigned integer union. */
|
---|
394 | typedef const RTUINT64U *PCRTUINT64U;
|
---|
395 |
|
---|
396 |
|
---|
397 | /**
|
---|
398 | * 128-bit unsigned integer union.
|
---|
399 | */
|
---|
400 | #pragma pack(1)
|
---|
401 | typedef union RTUINT128U
|
---|
402 | {
|
---|
403 | /** Natural view.
|
---|
404 | * WARNING! This member depends on the compiler supporting 128-bit stuff. */
|
---|
405 | uint128_t u;
|
---|
406 | /** Hi/Low view. */
|
---|
407 | struct
|
---|
408 | {
|
---|
409 | #ifdef RT_BIG_ENDIAN
|
---|
410 | uint64_t Hi;
|
---|
411 | uint64_t Lo;
|
---|
412 | #else
|
---|
413 | uint64_t Lo;
|
---|
414 | uint64_t Hi;
|
---|
415 | #endif
|
---|
416 | } s;
|
---|
417 | /** Quad-Word view. */
|
---|
418 | struct
|
---|
419 | {
|
---|
420 | #ifdef RT_BIG_ENDIAN
|
---|
421 | uint64_t qw1;
|
---|
422 | uint64_t qw0;
|
---|
423 | #else
|
---|
424 | uint64_t qw0;
|
---|
425 | uint64_t qw1;
|
---|
426 | #endif
|
---|
427 | } QWords;
|
---|
428 | /** Double-Word view. */
|
---|
429 | struct
|
---|
430 | {
|
---|
431 | #ifdef RT_BIG_ENDIAN
|
---|
432 | uint32_t dw3;
|
---|
433 | uint32_t dw2;
|
---|
434 | uint32_t dw1;
|
---|
435 | uint32_t dw0;
|
---|
436 | #else
|
---|
437 | uint32_t dw0;
|
---|
438 | uint32_t dw1;
|
---|
439 | uint32_t dw2;
|
---|
440 | uint32_t dw3;
|
---|
441 | #endif
|
---|
442 | } DWords;
|
---|
443 | /** Word view. */
|
---|
444 | struct
|
---|
445 | {
|
---|
446 | #ifdef RT_BIG_ENDIAN
|
---|
447 | uint16_t w7;
|
---|
448 | uint16_t w6;
|
---|
449 | uint16_t w5;
|
---|
450 | uint16_t w4;
|
---|
451 | uint16_t w3;
|
---|
452 | uint16_t w2;
|
---|
453 | uint16_t w1;
|
---|
454 | uint16_t w0;
|
---|
455 | #else
|
---|
456 | uint16_t w0;
|
---|
457 | uint16_t w1;
|
---|
458 | uint16_t w2;
|
---|
459 | uint16_t w3;
|
---|
460 | uint16_t w4;
|
---|
461 | uint16_t w5;
|
---|
462 | uint16_t w6;
|
---|
463 | uint16_t w7;
|
---|
464 | #endif
|
---|
465 | } Words;
|
---|
466 |
|
---|
467 | /** 64-bit view. */
|
---|
468 | uint64_t au64[2];
|
---|
469 | /** 32-bit view. */
|
---|
470 | uint32_t au32[4];
|
---|
471 | /** 16-bit view. */
|
---|
472 | uint16_t au16[8];
|
---|
473 | /** 8-bit view. */
|
---|
474 | uint8_t au8[16];
|
---|
475 | } RTUINT128U;
|
---|
476 | #pragma pack()
|
---|
477 | /** Pointer to a 64-bit unsigned integer union. */
|
---|
478 | typedef RTUINT128U *PRTUINT128U;
|
---|
479 | /** Pointer to a const 64-bit unsigned integer union. */
|
---|
480 | typedef const RTUINT128U *PCRTUINT128U;
|
---|
481 |
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * Double precision floating point format (64-bit).
|
---|
485 | */
|
---|
486 | typedef union RTFLOAT64U
|
---|
487 | {
|
---|
488 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
489 | /** Double view. */
|
---|
490 | double rd;
|
---|
491 | #endif
|
---|
492 | /** Format using regular bitfields. */
|
---|
493 | struct
|
---|
494 | {
|
---|
495 | # ifdef RT_BIG_ENDIAN
|
---|
496 | /** The sign indicator. */
|
---|
497 | uint32_t fSign : 1;
|
---|
498 | /** The exponent (offseted by 1023). */
|
---|
499 | uint32_t uExponent : 11;
|
---|
500 | /** The fraction, bits 32 thru 51. */
|
---|
501 | uint32_t u20FractionHigh : 20;
|
---|
502 | /** The fraction, bits 0 thru 31. */
|
---|
503 | uint32_t u32FractionLow;
|
---|
504 | # else
|
---|
505 | /** The fraction, bits 0 thru 31. */
|
---|
506 | uint32_t u32FractionLow;
|
---|
507 | /** The fraction, bits 32 thru 51. */
|
---|
508 | uint32_t u20FractionHigh : 20;
|
---|
509 | /** The exponent (offseted by 1023). */
|
---|
510 | uint32_t uExponent : 11;
|
---|
511 | /** The sign indicator. */
|
---|
512 | uint32_t fSign : 1;
|
---|
513 | # endif
|
---|
514 | } s;
|
---|
515 |
|
---|
516 | #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
517 | /** Format using 64-bit bitfields. */
|
---|
518 | RT_GCC_EXTENSION struct
|
---|
519 | {
|
---|
520 | # ifdef RT_BIG_ENDIAN
|
---|
521 | /** The sign indicator. */
|
---|
522 | RT_GCC_EXTENSION uint64_t fSign : 1;
|
---|
523 | /** The exponent (offseted by 1023). */
|
---|
524 | RT_GCC_EXTENSION uint64_t uExponent : 11;
|
---|
525 | /** The fraction. */
|
---|
526 | RT_GCC_EXTENSION uint64_t uFraction : 52;
|
---|
527 | # else
|
---|
528 | /** The fraction. */
|
---|
529 | RT_GCC_EXTENSION uint64_t uFraction : 52;
|
---|
530 | /** The exponent (offseted by 1023). */
|
---|
531 | RT_GCC_EXTENSION uint64_t uExponent : 11;
|
---|
532 | /** The sign indicator. */
|
---|
533 | RT_GCC_EXTENSION uint64_t fSign : 1;
|
---|
534 | # endif
|
---|
535 | } s64;
|
---|
536 | #endif
|
---|
537 |
|
---|
538 | /** 64-bit view. */
|
---|
539 | uint64_t au64[1];
|
---|
540 | /** 32-bit view. */
|
---|
541 | uint32_t au32[2];
|
---|
542 | /** 16-bit view. */
|
---|
543 | uint16_t au16[4];
|
---|
544 | /** 8-bit view. */
|
---|
545 | uint8_t au8[8];
|
---|
546 | } RTFLOAT64U;
|
---|
547 | /** Pointer to a double precision floating point format union. */
|
---|
548 | typedef RTFLOAT64U *PRTFLOAT64U;
|
---|
549 | /** Pointer to a const double precision floating point format union. */
|
---|
550 | typedef const RTFLOAT64U *PCRTFLOAT64U;
|
---|
551 |
|
---|
552 |
|
---|
553 | #if !defined(__IBMCPP__) && !defined(__IBMC__)
|
---|
554 |
|
---|
555 | /**
|
---|
556 | * Extended Double precision floating point format (80-bit).
|
---|
557 | */
|
---|
558 | #pragma pack(1)
|
---|
559 | typedef union RTFLOAT80U
|
---|
560 | {
|
---|
561 | /** Format using bitfields. */
|
---|
562 | RT_GCC_EXTENSION struct
|
---|
563 | {
|
---|
564 | # ifdef RT_BIG_ENDIAN
|
---|
565 | /** The sign indicator. */
|
---|
566 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
567 | /** The exponent (offseted by 16383). */
|
---|
568 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
569 | /** The mantissa. */
|
---|
570 | uint64_t u64Mantissa;
|
---|
571 | # else
|
---|
572 | /** The mantissa. */
|
---|
573 | uint64_t u64Mantissa;
|
---|
574 | /** The exponent (offseted by 16383). */
|
---|
575 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
576 | /** The sign indicator. */
|
---|
577 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
578 | # endif
|
---|
579 | } s;
|
---|
580 |
|
---|
581 | /** 64-bit view. */
|
---|
582 | uint64_t au64[1];
|
---|
583 | /** 32-bit view. */
|
---|
584 | uint32_t au32[2];
|
---|
585 | /** 16-bit view. */
|
---|
586 | uint16_t au16[5];
|
---|
587 | /** 8-bit view. */
|
---|
588 | uint8_t au8[10];
|
---|
589 | } RTFLOAT80U;
|
---|
590 | #pragma pack()
|
---|
591 | /** Pointer to a extended precision floating point format union. */
|
---|
592 | typedef RTFLOAT80U *PRTFLOAT80U;
|
---|
593 | /** Pointer to a const extended precision floating point format union. */
|
---|
594 | typedef const RTFLOAT80U *PCRTFLOAT80U;
|
---|
595 |
|
---|
596 |
|
---|
597 | /**
|
---|
598 | * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
|
---|
599 | * compiler implements long double.
|
---|
600 | */
|
---|
601 | #pragma pack(1)
|
---|
602 | typedef union RTFLOAT80U2
|
---|
603 | {
|
---|
604 | #ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
|
---|
605 | /** Long double view. */
|
---|
606 | long double lrd;
|
---|
607 | #endif
|
---|
608 | /** Format using bitfields. */
|
---|
609 | RT_GCC_EXTENSION struct
|
---|
610 | {
|
---|
611 | #ifdef RT_BIG_ENDIAN
|
---|
612 | /** The sign indicator. */
|
---|
613 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
614 | /** The exponent (offseted by 16383). */
|
---|
615 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
616 | /** The mantissa. */
|
---|
617 | uint64_t u64Mantissa;
|
---|
618 | #else
|
---|
619 | /** The mantissa. */
|
---|
620 | uint64_t u64Mantissa;
|
---|
621 | /** The exponent (offseted by 16383). */
|
---|
622 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
623 | /** The sign indicator. */
|
---|
624 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
625 | #endif
|
---|
626 | } s;
|
---|
627 |
|
---|
628 | /** Bitfield exposing the J bit and the fraction. */
|
---|
629 | RT_GCC_EXTENSION struct
|
---|
630 | {
|
---|
631 | #ifdef RT_BIG_ENDIAN
|
---|
632 | /** The sign indicator. */
|
---|
633 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
634 | /** The exponent (offseted by 16383). */
|
---|
635 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
636 | /** The J bit, aka the integer bit. */
|
---|
637 | uint32_t fInteger;
|
---|
638 | /** The fraction, bits 32 thru 62. */
|
---|
639 | uint32_t u31FractionHigh : 31;
|
---|
640 | /** The fraction, bits 0 thru 31. */
|
---|
641 | uint32_t u32FractionLow : 32;
|
---|
642 | #else
|
---|
643 | /** The fraction, bits 0 thru 31. */
|
---|
644 | uint32_t u32FractionLow : 32;
|
---|
645 | /** The fraction, bits 32 thru 62. */
|
---|
646 | uint32_t u31FractionHigh : 31;
|
---|
647 | /** The J bit, aka the integer bit. */
|
---|
648 | uint32_t fInteger;
|
---|
649 | /** The exponent (offseted by 16383). */
|
---|
650 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
651 | /** The sign indicator. */
|
---|
652 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
653 | #endif
|
---|
654 | } sj;
|
---|
655 |
|
---|
656 | #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
657 | /** 64-bit bitfields exposing the J bit and the fraction. */
|
---|
658 | RT_GCC_EXTENSION struct
|
---|
659 | {
|
---|
660 | # ifdef RT_BIG_ENDIAN
|
---|
661 | /** The sign indicator. */
|
---|
662 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
663 | /** The exponent (offseted by 16383). */
|
---|
664 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
665 | /** The J bit, aka the integer bit. */
|
---|
666 | RT_GCC_EXTENSION uint64_t fInteger : 1;
|
---|
667 | /** The fraction. */
|
---|
668 | RT_GCC_EXTENSION uint64_t u63Fraction : 63;
|
---|
669 | # else
|
---|
670 | /** The fraction. */
|
---|
671 | RT_GCC_EXTENSION uint64_t u63Fraction : 63;
|
---|
672 | /** The J bit, aka the integer bit. */
|
---|
673 | RT_GCC_EXTENSION uint64_t fInteger : 1;
|
---|
674 | /** The exponent (offseted by 16383). */
|
---|
675 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
676 | /** The sign indicator. */
|
---|
677 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
678 | # endif
|
---|
679 | } sj64;
|
---|
680 | #endif
|
---|
681 |
|
---|
682 | /** 64-bit view. */
|
---|
683 | uint64_t au64[1];
|
---|
684 | /** 32-bit view. */
|
---|
685 | uint32_t au32[2];
|
---|
686 | /** 16-bit view. */
|
---|
687 | uint16_t au16[5];
|
---|
688 | /** 8-bit view. */
|
---|
689 | uint8_t au8[10];
|
---|
690 | } RTFLOAT80U2;
|
---|
691 | #pragma pack()
|
---|
692 | /** Pointer to a extended precision floating point format union, 2nd
|
---|
693 | * variant. */
|
---|
694 | typedef RTFLOAT80U2 *PRTFLOAT80U2;
|
---|
695 | /** Pointer to a const extended precision floating point format union, 2nd
|
---|
696 | * variant. */
|
---|
697 | typedef const RTFLOAT80U2 *PCRTFLOAT80U2;
|
---|
698 |
|
---|
699 | #endif /* uint16_t bitfields doesn't work */
|
---|
700 |
|
---|
701 |
|
---|
702 | /** Generic function type.
|
---|
703 | * @see PFNRT
|
---|
704 | */
|
---|
705 | typedef DECLCALLBACK(void) FNRT(void);
|
---|
706 |
|
---|
707 | /** Generic function pointer.
|
---|
708 | * With -pedantic, gcc-4 complains when casting a function to a data object, for
|
---|
709 | * example:
|
---|
710 | *
|
---|
711 | * @code
|
---|
712 | * void foo(void)
|
---|
713 | * {
|
---|
714 | * }
|
---|
715 | *
|
---|
716 | * void *bar = (void *)foo;
|
---|
717 | * @endcode
|
---|
718 | *
|
---|
719 | * The compiler would warn with "ISO C++ forbids casting between
|
---|
720 | * pointer-to-function and pointer-to-object". The purpose of this warning is
|
---|
721 | * not to bother the programmer but to point out that he is probably doing
|
---|
722 | * something dangerous, assigning a pointer to executable code to a data object.
|
---|
723 | */
|
---|
724 | typedef FNRT *PFNRT;
|
---|
725 |
|
---|
726 | /** Millisecond interval. */
|
---|
727 | typedef uint32_t RTMSINTERVAL;
|
---|
728 | /** Pointer to a millisecond interval. */
|
---|
729 | typedef RTMSINTERVAL *PRTMSINTERVAL;
|
---|
730 | /** Pointer to a const millisecond interval. */
|
---|
731 | typedef const RTMSINTERVAL *PCRTMSINTERVAL;
|
---|
732 |
|
---|
733 | /** Pointer to a time spec structure. */
|
---|
734 | typedef struct RTTIMESPEC *PRTTIMESPEC;
|
---|
735 | /** Pointer to a const time spec structure. */
|
---|
736 | typedef const struct RTTIMESPEC *PCRTTIMESPEC;
|
---|
737 |
|
---|
738 | /**
|
---|
739 | * Generic pointer union.
|
---|
740 | */
|
---|
741 | typedef union RTPTRUNION
|
---|
742 | {
|
---|
743 | /** Pointer into the void... */
|
---|
744 | void *pv;
|
---|
745 | /** Pointer to char value. */
|
---|
746 | char *pch;
|
---|
747 | /** Pointer to char value. */
|
---|
748 | unsigned char *puch;
|
---|
749 | /** Pointer to a int value. */
|
---|
750 | int *pi;
|
---|
751 | /** Pointer to a unsigned int value. */
|
---|
752 | unsigned int *pu;
|
---|
753 | /** Pointer to a long value. */
|
---|
754 | long *pl;
|
---|
755 | /** Pointer to a long value. */
|
---|
756 | unsigned long *pul;
|
---|
757 | /** Pointer to a 8-bit unsigned value. */
|
---|
758 | uint8_t *pu8;
|
---|
759 | /** Pointer to a 16-bit unsigned value. */
|
---|
760 | uint16_t *pu16;
|
---|
761 | /** Pointer to a 32-bit unsigned value. */
|
---|
762 | uint32_t *pu32;
|
---|
763 | /** Pointer to a 64-bit unsigned value. */
|
---|
764 | uint64_t *pu64;
|
---|
765 | } RTPTRUNION;
|
---|
766 | /** Pointer to a pointer union. */
|
---|
767 | typedef RTPTRUNION *PRTPTRUNION;
|
---|
768 |
|
---|
769 | /**
|
---|
770 | * Generic const pointer union.
|
---|
771 | */
|
---|
772 | typedef union RTCPTRUNION
|
---|
773 | {
|
---|
774 | /** Pointer into the void... */
|
---|
775 | void const *pv;
|
---|
776 | /** Pointer to char value. */
|
---|
777 | char const *pch;
|
---|
778 | /** Pointer to char value. */
|
---|
779 | unsigned char const *puch;
|
---|
780 | /** Pointer to a int value. */
|
---|
781 | int const *pi;
|
---|
782 | /** Pointer to a unsigned int value. */
|
---|
783 | unsigned int const *pu;
|
---|
784 | /** Pointer to a long value. */
|
---|
785 | long const *pl;
|
---|
786 | /** Pointer to a long value. */
|
---|
787 | unsigned long const *pul;
|
---|
788 | /** Pointer to a 8-bit unsigned value. */
|
---|
789 | uint8_t const *pu8;
|
---|
790 | /** Pointer to a 16-bit unsigned value. */
|
---|
791 | uint16_t const *pu16;
|
---|
792 | /** Pointer to a 32-bit unsigned value. */
|
---|
793 | uint32_t const *pu32;
|
---|
794 | /** Pointer to a 64-bit unsigned value. */
|
---|
795 | uint64_t const *pu64;
|
---|
796 | } RTCPTRUNION;
|
---|
797 | /** Pointer to a const pointer union. */
|
---|
798 | typedef RTCPTRUNION *PRTCPTRUNION;
|
---|
799 |
|
---|
800 | /**
|
---|
801 | * Generic volatile pointer union.
|
---|
802 | */
|
---|
803 | typedef union RTVPTRUNION
|
---|
804 | {
|
---|
805 | /** Pointer into the void... */
|
---|
806 | void volatile *pv;
|
---|
807 | /** Pointer to char value. */
|
---|
808 | char volatile *pch;
|
---|
809 | /** Pointer to char value. */
|
---|
810 | unsigned char volatile *puch;
|
---|
811 | /** Pointer to a int value. */
|
---|
812 | int volatile *pi;
|
---|
813 | /** Pointer to a unsigned int value. */
|
---|
814 | unsigned int volatile *pu;
|
---|
815 | /** Pointer to a long value. */
|
---|
816 | long volatile *pl;
|
---|
817 | /** Pointer to a long value. */
|
---|
818 | unsigned long volatile *pul;
|
---|
819 | /** Pointer to a 8-bit unsigned value. */
|
---|
820 | uint8_t volatile *pu8;
|
---|
821 | /** Pointer to a 16-bit unsigned value. */
|
---|
822 | uint16_t volatile *pu16;
|
---|
823 | /** Pointer to a 32-bit unsigned value. */
|
---|
824 | uint32_t volatile *pu32;
|
---|
825 | /** Pointer to a 64-bit unsigned value. */
|
---|
826 | uint64_t volatile *pu64;
|
---|
827 | } RTVPTRUNION;
|
---|
828 | /** Pointer to a const pointer union. */
|
---|
829 | typedef RTVPTRUNION *PRTVPTRUNION;
|
---|
830 |
|
---|
831 | /**
|
---|
832 | * Generic const volatile pointer union.
|
---|
833 | */
|
---|
834 | typedef union RTCVPTRUNION
|
---|
835 | {
|
---|
836 | /** Pointer into the void... */
|
---|
837 | void const volatile *pv;
|
---|
838 | /** Pointer to char value. */
|
---|
839 | char const volatile *pch;
|
---|
840 | /** Pointer to char value. */
|
---|
841 | unsigned char const volatile *puch;
|
---|
842 | /** Pointer to a int value. */
|
---|
843 | int const volatile *pi;
|
---|
844 | /** Pointer to a unsigned int value. */
|
---|
845 | unsigned int const volatile *pu;
|
---|
846 | /** Pointer to a long value. */
|
---|
847 | long const volatile *pl;
|
---|
848 | /** Pointer to a long value. */
|
---|
849 | unsigned long const volatile *pul;
|
---|
850 | /** Pointer to a 8-bit unsigned value. */
|
---|
851 | uint8_t const volatile *pu8;
|
---|
852 | /** Pointer to a 16-bit unsigned value. */
|
---|
853 | uint16_t const volatile *pu16;
|
---|
854 | /** Pointer to a 32-bit unsigned value. */
|
---|
855 | uint32_t const volatile *pu32;
|
---|
856 | /** Pointer to a 64-bit unsigned value. */
|
---|
857 | uint64_t const volatile *pu64;
|
---|
858 | } RTCVPTRUNION;
|
---|
859 | /** Pointer to a const pointer union. */
|
---|
860 | typedef RTCVPTRUNION *PRTCVPTRUNION;
|
---|
861 |
|
---|
862 |
|
---|
863 | /** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
|
---|
864 | * @ingroup grp_rt_types
|
---|
865 | * @{
|
---|
866 | */
|
---|
867 |
|
---|
868 | /** Signed integer which can contain both GC and HC pointers. */
|
---|
869 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
|
---|
870 | typedef int32_t RTINTPTR;
|
---|
871 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
872 | typedef int64_t RTINTPTR;
|
---|
873 | #else
|
---|
874 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
875 | #endif
|
---|
876 | /** Pointer to signed integer which can contain both GC and HC pointers. */
|
---|
877 | typedef RTINTPTR *PRTINTPTR;
|
---|
878 | /** Pointer const to signed integer which can contain both GC and HC pointers. */
|
---|
879 | typedef const RTINTPTR *PCRTINTPTR;
|
---|
880 | /** The maximum value the RTINTPTR type can hold. */
|
---|
881 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
|
---|
882 | # define RTINTPTR_MAX INT32_MAX
|
---|
883 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
884 | # define RTINTPTR_MAX INT64_MAX
|
---|
885 | #else
|
---|
886 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
887 | #endif
|
---|
888 | /** The minimum value the RTINTPTR type can hold. */
|
---|
889 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
|
---|
890 | # define RTINTPTR_MIN INT32_MIN
|
---|
891 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
892 | # define RTINTPTR_MIN INT64_MIN
|
---|
893 | #else
|
---|
894 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
895 | #endif
|
---|
896 |
|
---|
897 | /** Unsigned integer which can contain both GC and HC pointers. */
|
---|
898 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
|
---|
899 | typedef uint32_t RTUINTPTR;
|
---|
900 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
901 | typedef uint64_t RTUINTPTR;
|
---|
902 | #else
|
---|
903 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
904 | #endif
|
---|
905 | /** Pointer to unsigned integer which can contain both GC and HC pointers. */
|
---|
906 | typedef RTUINTPTR *PRTUINTPTR;
|
---|
907 | /** Pointer const to unsigned integer which can contain both GC and HC pointers. */
|
---|
908 | typedef const RTUINTPTR *PCRTUINTPTR;
|
---|
909 | /** The maximum value the RTUINTPTR type can hold. */
|
---|
910 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
|
---|
911 | # define RTUINTPTR_MAX UINT32_MAX
|
---|
912 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
913 | # define RTUINTPTR_MAX UINT64_MAX
|
---|
914 | #else
|
---|
915 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
916 | #endif
|
---|
917 |
|
---|
918 | /** Signed integer. */
|
---|
919 | typedef int32_t RTINT;
|
---|
920 | /** Pointer to signed integer. */
|
---|
921 | typedef RTINT *PRTINT;
|
---|
922 | /** Pointer to const signed integer. */
|
---|
923 | typedef const RTINT *PCRTINT;
|
---|
924 |
|
---|
925 | /** Unsigned integer. */
|
---|
926 | typedef uint32_t RTUINT;
|
---|
927 | /** Pointer to unsigned integer. */
|
---|
928 | typedef RTUINT *PRTUINT;
|
---|
929 | /** Pointer to const unsigned integer. */
|
---|
930 | typedef const RTUINT *PCRTUINT;
|
---|
931 |
|
---|
932 | /** A file offset / size (off_t). */
|
---|
933 | typedef int64_t RTFOFF;
|
---|
934 | /** Pointer to a file offset / size. */
|
---|
935 | typedef RTFOFF *PRTFOFF;
|
---|
936 | /** The max value for RTFOFF. */
|
---|
937 | #define RTFOFF_MAX INT64_MAX
|
---|
938 | /** The min value for RTFOFF. */
|
---|
939 | #define RTFOFF_MIN INT64_MIN
|
---|
940 |
|
---|
941 | /** File mode (see iprt/fs.h). */
|
---|
942 | typedef uint32_t RTFMODE;
|
---|
943 | /** Pointer to file mode. */
|
---|
944 | typedef RTFMODE *PRTFMODE;
|
---|
945 |
|
---|
946 | /** Device unix number. */
|
---|
947 | typedef uint32_t RTDEV;
|
---|
948 | /** Pointer to a device unix number. */
|
---|
949 | typedef RTDEV *PRTDEV;
|
---|
950 |
|
---|
951 | /** @name RTDEV Macros
|
---|
952 | * @{ */
|
---|
953 | /**
|
---|
954 | * Our makedev macro.
|
---|
955 | * @returns RTDEV
|
---|
956 | * @param uMajor The major device number.
|
---|
957 | * @param uMinor The minor device number.
|
---|
958 | */
|
---|
959 | #define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
|
---|
960 | /**
|
---|
961 | * Get the major device node number from an RTDEV type.
|
---|
962 | * @returns The major device number of @a uDev
|
---|
963 | * @param uDev The device number.
|
---|
964 | */
|
---|
965 | #define RTDEV_MAJOR(uDev) ((uDev) >> 24)
|
---|
966 | /**
|
---|
967 | * Get the minor device node number from an RTDEV type.
|
---|
968 | * @returns The minor device number of @a uDev
|
---|
969 | * @param uDev The device number.
|
---|
970 | */
|
---|
971 | #define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
|
---|
972 | /** @} */
|
---|
973 |
|
---|
974 | /** i-node number. */
|
---|
975 | typedef uint64_t RTINODE;
|
---|
976 | /** Pointer to a i-node number. */
|
---|
977 | typedef RTINODE *PRTINODE;
|
---|
978 |
|
---|
979 | /** User id. */
|
---|
980 | typedef uint32_t RTUID;
|
---|
981 | /** Pointer to a user id. */
|
---|
982 | typedef RTUID *PRTUID;
|
---|
983 | /** NIL user id.
|
---|
984 | * @todo check this for portability! */
|
---|
985 | #define NIL_RTUID (~(RTUID)0)
|
---|
986 |
|
---|
987 | /** Group id. */
|
---|
988 | typedef uint32_t RTGID;
|
---|
989 | /** Pointer to a group id. */
|
---|
990 | typedef RTGID *PRTGID;
|
---|
991 | /** NIL group id.
|
---|
992 | * @todo check this for portability! */
|
---|
993 | #define NIL_RTGID (~(RTGID)0)
|
---|
994 |
|
---|
995 | /** I/O Port. */
|
---|
996 | typedef uint16_t RTIOPORT;
|
---|
997 | /** Pointer to I/O Port. */
|
---|
998 | typedef RTIOPORT *PRTIOPORT;
|
---|
999 | /** Pointer to const I/O Port. */
|
---|
1000 | typedef const RTIOPORT *PCRTIOPORT;
|
---|
1001 |
|
---|
1002 | /** Selector. */
|
---|
1003 | typedef uint16_t RTSEL;
|
---|
1004 | /** Pointer to selector. */
|
---|
1005 | typedef RTSEL *PRTSEL;
|
---|
1006 | /** Pointer to const selector. */
|
---|
1007 | typedef const RTSEL *PCRTSEL;
|
---|
1008 | /** Max selector value. */
|
---|
1009 | #define RTSEL_MAX UINT16_MAX
|
---|
1010 |
|
---|
1011 | /** Far 16-bit pointer. */
|
---|
1012 | #pragma pack(1)
|
---|
1013 | typedef struct RTFAR16
|
---|
1014 | {
|
---|
1015 | uint16_t off;
|
---|
1016 | RTSEL sel;
|
---|
1017 | } RTFAR16;
|
---|
1018 | #pragma pack()
|
---|
1019 | /** Pointer to Far 16-bit pointer. */
|
---|
1020 | typedef RTFAR16 *PRTFAR16;
|
---|
1021 | /** Pointer to const Far 16-bit pointer. */
|
---|
1022 | typedef const RTFAR16 *PCRTFAR16;
|
---|
1023 |
|
---|
1024 | /** Far 32-bit pointer. */
|
---|
1025 | #pragma pack(1)
|
---|
1026 | typedef struct RTFAR32
|
---|
1027 | {
|
---|
1028 | uint32_t off;
|
---|
1029 | RTSEL sel;
|
---|
1030 | } RTFAR32;
|
---|
1031 | #pragma pack()
|
---|
1032 | /** Pointer to Far 32-bit pointer. */
|
---|
1033 | typedef RTFAR32 *PRTFAR32;
|
---|
1034 | /** Pointer to const Far 32-bit pointer. */
|
---|
1035 | typedef const RTFAR32 *PCRTFAR32;
|
---|
1036 |
|
---|
1037 | /** Far 64-bit pointer. */
|
---|
1038 | #pragma pack(1)
|
---|
1039 | typedef struct RTFAR64
|
---|
1040 | {
|
---|
1041 | uint64_t off;
|
---|
1042 | RTSEL sel;
|
---|
1043 | } RTFAR64;
|
---|
1044 | #pragma pack()
|
---|
1045 | /** Pointer to Far 64-bit pointer. */
|
---|
1046 | typedef RTFAR64 *PRTFAR64;
|
---|
1047 | /** Pointer to const Far 64-bit pointer. */
|
---|
1048 | typedef const RTFAR64 *PCRTFAR64;
|
---|
1049 |
|
---|
1050 | /** @} */
|
---|
1051 |
|
---|
1052 |
|
---|
1053 | /** @defgroup grp_rt_types_hc Host Context Basic Types
|
---|
1054 | * @ingroup grp_rt_types
|
---|
1055 | * @{
|
---|
1056 | */
|
---|
1057 |
|
---|
1058 | /** HC Natural signed integer.
|
---|
1059 | * @deprecated silly type. */
|
---|
1060 | typedef int32_t RTHCINT;
|
---|
1061 | /** Pointer to HC Natural signed integer.
|
---|
1062 | * @deprecated silly type. */
|
---|
1063 | typedef RTHCINT *PRTHCINT;
|
---|
1064 | /** Pointer to const HC Natural signed integer.
|
---|
1065 | * @deprecated silly type. */
|
---|
1066 | typedef const RTHCINT *PCRTHCINT;
|
---|
1067 |
|
---|
1068 | /** HC Natural unsigned integer.
|
---|
1069 | * @deprecated silly type. */
|
---|
1070 | typedef uint32_t RTHCUINT;
|
---|
1071 | /** Pointer to HC Natural unsigned integer.
|
---|
1072 | * @deprecated silly type. */
|
---|
1073 | typedef RTHCUINT *PRTHCUINT;
|
---|
1074 | /** Pointer to const HC Natural unsigned integer.
|
---|
1075 | * @deprecated silly type. */
|
---|
1076 | typedef const RTHCUINT *PCRTHCUINT;
|
---|
1077 |
|
---|
1078 |
|
---|
1079 | /** Signed integer which can contain a HC pointer. */
|
---|
1080 | #if HC_ARCH_BITS == 32
|
---|
1081 | typedef int32_t RTHCINTPTR;
|
---|
1082 | #elif HC_ARCH_BITS == 64
|
---|
1083 | typedef int64_t RTHCINTPTR;
|
---|
1084 | #else
|
---|
1085 | # error Unsupported HC_ARCH_BITS value.
|
---|
1086 | #endif
|
---|
1087 | /** Pointer to signed integer which can contain a HC pointer. */
|
---|
1088 | typedef RTHCINTPTR *PRTHCINTPTR;
|
---|
1089 | /** Pointer to const signed integer which can contain a HC pointer. */
|
---|
1090 | typedef const RTHCINTPTR *PCRTHCINTPTR;
|
---|
1091 | /** Max RTHCINTPTR value. */
|
---|
1092 | #if HC_ARCH_BITS == 32
|
---|
1093 | # define RTHCINTPTR_MAX INT32_MAX
|
---|
1094 | #else
|
---|
1095 | # define RTHCINTPTR_MAX INT64_MAX
|
---|
1096 | #endif
|
---|
1097 | /** Min RTHCINTPTR value. */
|
---|
1098 | #if HC_ARCH_BITS == 32
|
---|
1099 | # define RTHCINTPTR_MIN INT32_MIN
|
---|
1100 | #else
|
---|
1101 | # define RTHCINTPTR_MIN INT64_MIN
|
---|
1102 | #endif
|
---|
1103 |
|
---|
1104 | /** Signed integer which can contain a HC ring-3 pointer. */
|
---|
1105 | #if R3_ARCH_BITS == 32
|
---|
1106 | typedef int32_t RTR3INTPTR;
|
---|
1107 | #elif R3_ARCH_BITS == 64
|
---|
1108 | typedef int64_t RTR3INTPTR;
|
---|
1109 | #else
|
---|
1110 | # error Unsupported R3_ARCH_BITS value.
|
---|
1111 | #endif
|
---|
1112 | /** Pointer to signed integer which can contain a HC ring-3 pointer. */
|
---|
1113 | typedef RTR3INTPTR *PRTR3INTPTR;
|
---|
1114 | /** Pointer to const signed integer which can contain a HC ring-3 pointer. */
|
---|
1115 | typedef const RTR3INTPTR *PCRTR3INTPTR;
|
---|
1116 | /** Max RTR3INTPTR value. */
|
---|
1117 | #if R3_ARCH_BITS == 32
|
---|
1118 | # define RTR3INTPTR_MAX INT32_MAX
|
---|
1119 | #else
|
---|
1120 | # define RTR3INTPTR_MAX INT64_MAX
|
---|
1121 | #endif
|
---|
1122 | /** Min RTR3INTPTR value. */
|
---|
1123 | #if R3_ARCH_BITS == 32
|
---|
1124 | # define RTR3INTPTR_MIN INT32_MIN
|
---|
1125 | #else
|
---|
1126 | # define RTR3INTPTR_MIN INT64_MIN
|
---|
1127 | #endif
|
---|
1128 |
|
---|
1129 | /** Signed integer which can contain a HC ring-0 pointer. */
|
---|
1130 | #if R0_ARCH_BITS == 32
|
---|
1131 | typedef int32_t RTR0INTPTR;
|
---|
1132 | #elif R0_ARCH_BITS == 64
|
---|
1133 | typedef int64_t RTR0INTPTR;
|
---|
1134 | #else
|
---|
1135 | # error Unsupported R0_ARCH_BITS value.
|
---|
1136 | #endif
|
---|
1137 | /** Pointer to signed integer which can contain a HC ring-0 pointer. */
|
---|
1138 | typedef RTR0INTPTR *PRTR0INTPTR;
|
---|
1139 | /** Pointer to const signed integer which can contain a HC ring-0 pointer. */
|
---|
1140 | typedef const RTR0INTPTR *PCRTR0INTPTR;
|
---|
1141 | /** Max RTR0INTPTR value. */
|
---|
1142 | #if R0_ARCH_BITS == 32
|
---|
1143 | # define RTR0INTPTR_MAX INT32_MAX
|
---|
1144 | #else
|
---|
1145 | # define RTR0INTPTR_MAX INT64_MAX
|
---|
1146 | #endif
|
---|
1147 | /** Min RTHCINTPTR value. */
|
---|
1148 | #if R0_ARCH_BITS == 32
|
---|
1149 | # define RTR0INTPTR_MIN INT32_MIN
|
---|
1150 | #else
|
---|
1151 | # define RTR0INTPTR_MIN INT64_MIN
|
---|
1152 | #endif
|
---|
1153 |
|
---|
1154 |
|
---|
1155 | /** Unsigned integer which can contain a HC pointer. */
|
---|
1156 | #if HC_ARCH_BITS == 32
|
---|
1157 | typedef uint32_t RTHCUINTPTR;
|
---|
1158 | #elif HC_ARCH_BITS == 64
|
---|
1159 | typedef uint64_t RTHCUINTPTR;
|
---|
1160 | #else
|
---|
1161 | # error Unsupported HC_ARCH_BITS value.
|
---|
1162 | #endif
|
---|
1163 | /** Pointer to unsigned integer which can contain a HC pointer. */
|
---|
1164 | typedef RTHCUINTPTR *PRTHCUINTPTR;
|
---|
1165 | /** Pointer to unsigned integer which can contain a HC pointer. */
|
---|
1166 | typedef const RTHCUINTPTR *PCRTHCUINTPTR;
|
---|
1167 | /** Max RTHCUINTTPR value. */
|
---|
1168 | #if HC_ARCH_BITS == 32
|
---|
1169 | # define RTHCUINTPTR_MAX UINT32_MAX
|
---|
1170 | #else
|
---|
1171 | # define RTHCUINTPTR_MAX UINT64_MAX
|
---|
1172 | #endif
|
---|
1173 |
|
---|
1174 | /** Unsigned integer which can contain a HC ring-3 pointer. */
|
---|
1175 | #if R3_ARCH_BITS == 32
|
---|
1176 | typedef uint32_t RTR3UINTPTR;
|
---|
1177 | #elif R3_ARCH_BITS == 64
|
---|
1178 | typedef uint64_t RTR3UINTPTR;
|
---|
1179 | #else
|
---|
1180 | # error Unsupported R3_ARCH_BITS value.
|
---|
1181 | #endif
|
---|
1182 | /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
|
---|
1183 | typedef RTR3UINTPTR *PRTR3UINTPTR;
|
---|
1184 | /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
|
---|
1185 | typedef const RTR3UINTPTR *PCRTR3UINTPTR;
|
---|
1186 | /** Max RTHCUINTTPR value. */
|
---|
1187 | #if R3_ARCH_BITS == 32
|
---|
1188 | # define RTR3UINTPTR_MAX UINT32_MAX
|
---|
1189 | #else
|
---|
1190 | # define RTR3UINTPTR_MAX UINT64_MAX
|
---|
1191 | #endif
|
---|
1192 |
|
---|
1193 | /** Unsigned integer which can contain a HC ring-0 pointer. */
|
---|
1194 | #if R0_ARCH_BITS == 32
|
---|
1195 | typedef uint32_t RTR0UINTPTR;
|
---|
1196 | #elif R0_ARCH_BITS == 64
|
---|
1197 | typedef uint64_t RTR0UINTPTR;
|
---|
1198 | #else
|
---|
1199 | # error Unsupported R0_ARCH_BITS value.
|
---|
1200 | #endif
|
---|
1201 | /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
|
---|
1202 | typedef RTR0UINTPTR *PRTR0UINTPTR;
|
---|
1203 | /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
|
---|
1204 | typedef const RTR0UINTPTR *PCRTR0UINTPTR;
|
---|
1205 | /** Max RTR0UINTTPR value. */
|
---|
1206 | #if HC_ARCH_BITS == 32
|
---|
1207 | # define RTR0UINTPTR_MAX UINT32_MAX
|
---|
1208 | #else
|
---|
1209 | # define RTR0UINTPTR_MAX UINT64_MAX
|
---|
1210 | #endif
|
---|
1211 |
|
---|
1212 |
|
---|
1213 | /** Host Physical Memory Address. */
|
---|
1214 | typedef uint64_t RTHCPHYS;
|
---|
1215 | /** Pointer to Host Physical Memory Address. */
|
---|
1216 | typedef RTHCPHYS *PRTHCPHYS;
|
---|
1217 | /** Pointer to const Host Physical Memory Address. */
|
---|
1218 | typedef const RTHCPHYS *PCRTHCPHYS;
|
---|
1219 | /** @def NIL_RTHCPHYS
|
---|
1220 | * NIL HC Physical Address.
|
---|
1221 | * NIL_RTHCPHYS is used to signal an invalid physical address, similar
|
---|
1222 | * to the NULL pointer.
|
---|
1223 | */
|
---|
1224 | #define NIL_RTHCPHYS (~(RTHCPHYS)0)
|
---|
1225 | /** Max RTHCPHYS value. */
|
---|
1226 | #define RTHCPHYS_MAX UINT64_MAX
|
---|
1227 |
|
---|
1228 |
|
---|
1229 | /** HC pointer. */
|
---|
1230 | #ifndef IN_RC
|
---|
1231 | typedef void * RTHCPTR;
|
---|
1232 | #else
|
---|
1233 | typedef RTHCUINTPTR RTHCPTR;
|
---|
1234 | #endif
|
---|
1235 | /** Pointer to HC pointer. */
|
---|
1236 | typedef RTHCPTR *PRTHCPTR;
|
---|
1237 | /** Pointer to const HC pointer. */
|
---|
1238 | typedef const RTHCPTR *PCRTHCPTR;
|
---|
1239 | /** @def NIL_RTHCPTR
|
---|
1240 | * NIL HC pointer.
|
---|
1241 | */
|
---|
1242 | #define NIL_RTHCPTR ((RTHCPTR)0)
|
---|
1243 | /** Max RTHCPTR value. */
|
---|
1244 | #define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
|
---|
1245 |
|
---|
1246 |
|
---|
1247 | /** HC ring-3 pointer. */
|
---|
1248 | #ifdef IN_RING3
|
---|
1249 | typedef void * RTR3PTR;
|
---|
1250 | #else
|
---|
1251 | typedef RTR3UINTPTR RTR3PTR;
|
---|
1252 | #endif
|
---|
1253 | /** Pointer to HC ring-3 pointer. */
|
---|
1254 | typedef RTR3PTR *PRTR3PTR;
|
---|
1255 | /** Pointer to const HC ring-3 pointer. */
|
---|
1256 | typedef const RTR3PTR *PCRTR3PTR;
|
---|
1257 | /** @def NIL_RTR3PTR
|
---|
1258 | * NIL HC ring-3 pointer.
|
---|
1259 | */
|
---|
1260 | #ifndef IN_RING3
|
---|
1261 | # define NIL_RTR3PTR ((RTR3PTR)0)
|
---|
1262 | #else
|
---|
1263 | # define NIL_RTR3PTR (NULL)
|
---|
1264 | #endif
|
---|
1265 | /** Max RTR3PTR value. */
|
---|
1266 | #define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
|
---|
1267 |
|
---|
1268 | /** HC ring-0 pointer. */
|
---|
1269 | #ifdef IN_RING0
|
---|
1270 | typedef void * RTR0PTR;
|
---|
1271 | #else
|
---|
1272 | typedef RTR0UINTPTR RTR0PTR;
|
---|
1273 | #endif
|
---|
1274 | /** Pointer to HC ring-0 pointer. */
|
---|
1275 | typedef RTR0PTR *PRTR0PTR;
|
---|
1276 | /** Pointer to const HC ring-0 pointer. */
|
---|
1277 | typedef const RTR0PTR *PCRTR0PTR;
|
---|
1278 | /** @def NIL_RTR0PTR
|
---|
1279 | * NIL HC ring-0 pointer.
|
---|
1280 | */
|
---|
1281 | #ifndef IN_RING0
|
---|
1282 | # define NIL_RTR0PTR ((RTR0PTR)0)
|
---|
1283 | #else
|
---|
1284 | # define NIL_RTR0PTR (NULL)
|
---|
1285 | #endif
|
---|
1286 | /** Max RTR3PTR value. */
|
---|
1287 | #define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
|
---|
1288 |
|
---|
1289 |
|
---|
1290 | /** Unsigned integer register in the host context. */
|
---|
1291 | #if HC_ARCH_BITS == 32
|
---|
1292 | typedef uint32_t RTHCUINTREG;
|
---|
1293 | #elif HC_ARCH_BITS == 64
|
---|
1294 | typedef uint64_t RTHCUINTREG;
|
---|
1295 | #else
|
---|
1296 | # error "Unsupported HC_ARCH_BITS!"
|
---|
1297 | #endif
|
---|
1298 | /** Pointer to an unsigned integer register in the host context. */
|
---|
1299 | typedef RTHCUINTREG *PRTHCUINTREG;
|
---|
1300 | /** Pointer to a const unsigned integer register in the host context. */
|
---|
1301 | typedef const RTHCUINTREG *PCRTHCUINTREG;
|
---|
1302 |
|
---|
1303 | /** Unsigned integer register in the host ring-3 context. */
|
---|
1304 | #if R3_ARCH_BITS == 32
|
---|
1305 | typedef uint32_t RTR3UINTREG;
|
---|
1306 | #elif R3_ARCH_BITS == 64
|
---|
1307 | typedef uint64_t RTR3UINTREG;
|
---|
1308 | #else
|
---|
1309 | # error "Unsupported R3_ARCH_BITS!"
|
---|
1310 | #endif
|
---|
1311 | /** Pointer to an unsigned integer register in the host ring-3 context. */
|
---|
1312 | typedef RTR3UINTREG *PRTR3UINTREG;
|
---|
1313 | /** Pointer to a const unsigned integer register in the host ring-3 context. */
|
---|
1314 | typedef const RTR3UINTREG *PCRTR3UINTREG;
|
---|
1315 |
|
---|
1316 | /** Unsigned integer register in the host ring-3 context. */
|
---|
1317 | #if R0_ARCH_BITS == 32
|
---|
1318 | typedef uint32_t RTR0UINTREG;
|
---|
1319 | #elif R0_ARCH_BITS == 64
|
---|
1320 | typedef uint64_t RTR0UINTREG;
|
---|
1321 | #else
|
---|
1322 | # error "Unsupported R3_ARCH_BITS!"
|
---|
1323 | #endif
|
---|
1324 | /** Pointer to an unsigned integer register in the host ring-3 context. */
|
---|
1325 | typedef RTR0UINTREG *PRTR0UINTREG;
|
---|
1326 | /** Pointer to a const unsigned integer register in the host ring-3 context. */
|
---|
1327 | typedef const RTR0UINTREG *PCRTR0UINTREG;
|
---|
1328 |
|
---|
1329 | /** @} */
|
---|
1330 |
|
---|
1331 |
|
---|
1332 | /** @defgroup grp_rt_types_gc Guest Context Basic Types
|
---|
1333 | * @ingroup grp_rt_types
|
---|
1334 | * @{
|
---|
1335 | */
|
---|
1336 |
|
---|
1337 | /** Natural signed integer in the GC.
|
---|
1338 | * @deprecated silly type. */
|
---|
1339 | #if GC_ARCH_BITS == 32
|
---|
1340 | typedef int32_t RTGCINT;
|
---|
1341 | #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
|
---|
1342 | typedef int64_t RTGCINT;
|
---|
1343 | #endif
|
---|
1344 | /** Pointer to natural signed integer in GC.
|
---|
1345 | * @deprecated silly type. */
|
---|
1346 | typedef RTGCINT *PRTGCINT;
|
---|
1347 | /** Pointer to const natural signed integer in GC.
|
---|
1348 | * @deprecated silly type. */
|
---|
1349 | typedef const RTGCINT *PCRTGCINT;
|
---|
1350 |
|
---|
1351 | /** Natural unsigned integer in the GC.
|
---|
1352 | * @deprecated silly type. */
|
---|
1353 | #if GC_ARCH_BITS == 32
|
---|
1354 | typedef uint32_t RTGCUINT;
|
---|
1355 | #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
|
---|
1356 | typedef uint64_t RTGCUINT;
|
---|
1357 | #endif
|
---|
1358 | /** Pointer to natural unsigned integer in GC.
|
---|
1359 | * @deprecated silly type. */
|
---|
1360 | typedef RTGCUINT *PRTGCUINT;
|
---|
1361 | /** Pointer to const natural unsigned integer in GC.
|
---|
1362 | * @deprecated silly type. */
|
---|
1363 | typedef const RTGCUINT *PCRTGCUINT;
|
---|
1364 |
|
---|
1365 | /** Signed integer which can contain a GC pointer. */
|
---|
1366 | #if GC_ARCH_BITS == 32
|
---|
1367 | typedef int32_t RTGCINTPTR;
|
---|
1368 | #elif GC_ARCH_BITS == 64
|
---|
1369 | typedef int64_t RTGCINTPTR;
|
---|
1370 | #endif
|
---|
1371 | /** Pointer to signed integer which can contain a GC pointer. */
|
---|
1372 | typedef RTGCINTPTR *PRTGCINTPTR;
|
---|
1373 | /** Pointer to const signed integer which can contain a GC pointer. */
|
---|
1374 | typedef const RTGCINTPTR *PCRTGCINTPTR;
|
---|
1375 |
|
---|
1376 | /** Unsigned integer which can contain a GC pointer. */
|
---|
1377 | #if GC_ARCH_BITS == 32
|
---|
1378 | typedef uint32_t RTGCUINTPTR;
|
---|
1379 | #elif GC_ARCH_BITS == 64
|
---|
1380 | typedef uint64_t RTGCUINTPTR;
|
---|
1381 | #else
|
---|
1382 | # error Unsupported GC_ARCH_BITS value.
|
---|
1383 | #endif
|
---|
1384 | /** Pointer to unsigned integer which can contain a GC pointer. */
|
---|
1385 | typedef RTGCUINTPTR *PRTGCUINTPTR;
|
---|
1386 | /** Pointer to unsigned integer which can contain a GC pointer. */
|
---|
1387 | typedef const RTGCUINTPTR *PCRTGCUINTPTR;
|
---|
1388 |
|
---|
1389 | /** Unsigned integer which can contain a 32 bits GC pointer. */
|
---|
1390 | typedef uint32_t RTGCUINTPTR32;
|
---|
1391 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
1392 | typedef RTGCUINTPTR32 *PRTGCUINTPTR32;
|
---|
1393 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
1394 | typedef const RTGCUINTPTR32 *PCRTGCUINTPTR32;
|
---|
1395 |
|
---|
1396 | /** Unsigned integer which can contain a 64 bits GC pointer. */
|
---|
1397 | typedef uint64_t RTGCUINTPTR64;
|
---|
1398 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
1399 | typedef RTGCUINTPTR64 *PRTGCUINTPTR64;
|
---|
1400 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
1401 | typedef const RTGCUINTPTR64 *PCRTGCUINTPTR64;
|
---|
1402 |
|
---|
1403 | /** Guest Physical Memory Address.*/
|
---|
1404 | typedef uint64_t RTGCPHYS;
|
---|
1405 | /** Pointer to Guest Physical Memory Address. */
|
---|
1406 | typedef RTGCPHYS *PRTGCPHYS;
|
---|
1407 | /** Pointer to const Guest Physical Memory Address. */
|
---|
1408 | typedef const RTGCPHYS *PCRTGCPHYS;
|
---|
1409 | /** @def NIL_RTGCPHYS
|
---|
1410 | * NIL GC Physical Address.
|
---|
1411 | * NIL_RTGCPHYS is used to signal an invalid physical address, similar
|
---|
1412 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
1413 | * some contexts.
|
---|
1414 | */
|
---|
1415 | #define NIL_RTGCPHYS (~(RTGCPHYS)0U)
|
---|
1416 | /** Max guest physical memory address value. */
|
---|
1417 | #define RTGCPHYS_MAX UINT64_MAX
|
---|
1418 |
|
---|
1419 |
|
---|
1420 | /** Guest Physical Memory Address; limited to 32 bits.*/
|
---|
1421 | typedef uint32_t RTGCPHYS32;
|
---|
1422 | /** Pointer to Guest Physical Memory Address. */
|
---|
1423 | typedef RTGCPHYS32 *PRTGCPHYS32;
|
---|
1424 | /** Pointer to const Guest Physical Memory Address. */
|
---|
1425 | typedef const RTGCPHYS32 *PCRTGCPHYS32;
|
---|
1426 | /** @def NIL_RTGCPHYS32
|
---|
1427 | * NIL GC Physical Address.
|
---|
1428 | * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
|
---|
1429 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
1430 | * some contexts.
|
---|
1431 | */
|
---|
1432 | #define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
|
---|
1433 |
|
---|
1434 |
|
---|
1435 | /** Guest Physical Memory Address; limited to 64 bits.*/
|
---|
1436 | typedef uint64_t RTGCPHYS64;
|
---|
1437 | /** Pointer to Guest Physical Memory Address. */
|
---|
1438 | typedef RTGCPHYS64 *PRTGCPHYS64;
|
---|
1439 | /** Pointer to const Guest Physical Memory Address. */
|
---|
1440 | typedef const RTGCPHYS64 *PCRTGCPHYS64;
|
---|
1441 | /** @def NIL_RTGCPHYS64
|
---|
1442 | * NIL GC Physical Address.
|
---|
1443 | * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
|
---|
1444 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
1445 | * some contexts.
|
---|
1446 | */
|
---|
1447 | #define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
|
---|
1448 |
|
---|
1449 | /** Guest context pointer, 32 bits.
|
---|
1450 | * Keep in mind that this type is an unsigned integer in
|
---|
1451 | * HC and void pointer in GC.
|
---|
1452 | */
|
---|
1453 | typedef RTGCUINTPTR32 RTGCPTR32;
|
---|
1454 | /** Pointer to a guest context pointer. */
|
---|
1455 | typedef RTGCPTR32 *PRTGCPTR32;
|
---|
1456 | /** Pointer to a const guest context pointer. */
|
---|
1457 | typedef const RTGCPTR32 *PCRTGCPTR32;
|
---|
1458 | /** @def NIL_RTGCPTR32
|
---|
1459 | * NIL GC pointer.
|
---|
1460 | */
|
---|
1461 | #define NIL_RTGCPTR32 ((RTGCPTR32)0)
|
---|
1462 |
|
---|
1463 | /** Guest context pointer, 64 bits.
|
---|
1464 | */
|
---|
1465 | typedef RTGCUINTPTR64 RTGCPTR64;
|
---|
1466 | /** Pointer to a guest context pointer. */
|
---|
1467 | typedef RTGCPTR64 *PRTGCPTR64;
|
---|
1468 | /** Pointer to a const guest context pointer. */
|
---|
1469 | typedef const RTGCPTR64 *PCRTGCPTR64;
|
---|
1470 | /** @def NIL_RTGCPTR64
|
---|
1471 | * NIL GC pointer.
|
---|
1472 | */
|
---|
1473 | #define NIL_RTGCPTR64 ((RTGCPTR64)0)
|
---|
1474 |
|
---|
1475 | /** Guest context pointer.
|
---|
1476 | * Keep in mind that this type is an unsigned integer in
|
---|
1477 | * HC and void pointer in GC.
|
---|
1478 | */
|
---|
1479 | #if GC_ARCH_BITS == 64
|
---|
1480 | typedef RTGCPTR64 RTGCPTR;
|
---|
1481 | /** Pointer to a guest context pointer. */
|
---|
1482 | typedef PRTGCPTR64 PRTGCPTR;
|
---|
1483 | /** Pointer to a const guest context pointer. */
|
---|
1484 | typedef PCRTGCPTR64 PCRTGCPTR;
|
---|
1485 | /** @def NIL_RTGCPTR
|
---|
1486 | * NIL GC pointer.
|
---|
1487 | */
|
---|
1488 | # define NIL_RTGCPTR NIL_RTGCPTR64
|
---|
1489 | /** Max RTGCPTR value. */
|
---|
1490 | # define RTGCPTR_MAX UINT64_MAX
|
---|
1491 | #elif GC_ARCH_BITS == 32
|
---|
1492 | typedef RTGCPTR32 RTGCPTR;
|
---|
1493 | /** Pointer to a guest context pointer. */
|
---|
1494 | typedef PRTGCPTR32 PRTGCPTR;
|
---|
1495 | /** Pointer to a const guest context pointer. */
|
---|
1496 | typedef PCRTGCPTR32 PCRTGCPTR;
|
---|
1497 | /** @def NIL_RTGCPTR
|
---|
1498 | * NIL GC pointer.
|
---|
1499 | */
|
---|
1500 | # define NIL_RTGCPTR NIL_RTGCPTR32
|
---|
1501 | /** Max RTGCPTR value. */
|
---|
1502 | # define RTGCPTR_MAX UINT32_MAX
|
---|
1503 | #else
|
---|
1504 | # error "Unsupported GC_ARCH_BITS!"
|
---|
1505 | #endif
|
---|
1506 |
|
---|
1507 | /** Unsigned integer register in the guest context. */
|
---|
1508 | typedef uint32_t RTGCUINTREG32;
|
---|
1509 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
1510 | typedef RTGCUINTREG32 *PRTGCUINTREG32;
|
---|
1511 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
1512 | typedef const RTGCUINTREG32 *PCRTGCUINTREG32;
|
---|
1513 |
|
---|
1514 | typedef uint64_t RTGCUINTREG64;
|
---|
1515 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
1516 | typedef RTGCUINTREG64 *PRTGCUINTREG64;
|
---|
1517 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
1518 | typedef const RTGCUINTREG64 *PCRTGCUINTREG64;
|
---|
1519 |
|
---|
1520 | #if GC_ARCH_BITS == 64
|
---|
1521 | typedef RTGCUINTREG64 RTGCUINTREG;
|
---|
1522 | #elif GC_ARCH_BITS == 32
|
---|
1523 | typedef RTGCUINTREG32 RTGCUINTREG;
|
---|
1524 | #else
|
---|
1525 | # error "Unsupported GC_ARCH_BITS!"
|
---|
1526 | #endif
|
---|
1527 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
1528 | typedef RTGCUINTREG *PRTGCUINTREG;
|
---|
1529 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
1530 | typedef const RTGCUINTREG *PCRTGCUINTREG;
|
---|
1531 |
|
---|
1532 | /** @} */
|
---|
1533 |
|
---|
1534 | /** @defgroup grp_rt_types_rc Raw mode Context Basic Types
|
---|
1535 | * @ingroup grp_rt_types
|
---|
1536 | * @{
|
---|
1537 | */
|
---|
1538 |
|
---|
1539 | /** Raw mode context pointer; a 32 bits guest context pointer.
|
---|
1540 | * Keep in mind that this type is an unsigned integer in
|
---|
1541 | * HC and void pointer in RC.
|
---|
1542 | */
|
---|
1543 | #ifdef IN_RC
|
---|
1544 | typedef void * RTRCPTR;
|
---|
1545 | #else
|
---|
1546 | typedef uint32_t RTRCPTR;
|
---|
1547 | #endif
|
---|
1548 | /** Pointer to a raw mode context pointer. */
|
---|
1549 | typedef RTRCPTR *PRTRCPTR;
|
---|
1550 | /** Pointer to a const raw mode context pointer. */
|
---|
1551 | typedef const RTRCPTR *PCRTRCPTR;
|
---|
1552 | /** @def NIL_RTGCPTR
|
---|
1553 | * NIL RC pointer.
|
---|
1554 | */
|
---|
1555 | #ifndef IN_RC
|
---|
1556 | # define NIL_RTRCPTR ((RTRCPTR)0)
|
---|
1557 | #else
|
---|
1558 | # define NIL_RTRCPTR (NULL)
|
---|
1559 | #endif
|
---|
1560 | /** @def RTRCPTR_MAX
|
---|
1561 | * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
|
---|
1562 | */
|
---|
1563 | #define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
|
---|
1564 |
|
---|
1565 | /** Raw mode context pointer, unsigned integer variant. */
|
---|
1566 | typedef int32_t RTRCINTPTR;
|
---|
1567 | /** @def RTRCUINTPTR_MAX
|
---|
1568 | * The maximum value a RTRCUINPTR can have.
|
---|
1569 | */
|
---|
1570 | #define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
|
---|
1571 |
|
---|
1572 | /** Raw mode context pointer, signed integer variant. */
|
---|
1573 | typedef uint32_t RTRCUINTPTR;
|
---|
1574 | /** @def RTRCINTPTR_MIN
|
---|
1575 | * The minimum value a RTRCINPTR can have.
|
---|
1576 | */
|
---|
1577 | #define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
|
---|
1578 | /** @def RTRCINTPTR_MAX
|
---|
1579 | * The maximum value a RTRCINPTR can have.
|
---|
1580 | */
|
---|
1581 | #define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
|
---|
1582 |
|
---|
1583 | /** @} */
|
---|
1584 |
|
---|
1585 |
|
---|
1586 | /** @defgroup grp_rt_types_cc Current Context Basic Types
|
---|
1587 | * @ingroup grp_rt_types
|
---|
1588 | * @{
|
---|
1589 | */
|
---|
1590 |
|
---|
1591 | /** Current Context Physical Memory Address.*/
|
---|
1592 | #ifdef IN_RC
|
---|
1593 | typedef RTGCPHYS RTCCPHYS;
|
---|
1594 | #else
|
---|
1595 | typedef RTHCPHYS RTCCPHYS;
|
---|
1596 | #endif
|
---|
1597 | /** Pointer to Current Context Physical Memory Address. */
|
---|
1598 | typedef RTCCPHYS *PRTCCPHYS;
|
---|
1599 | /** Pointer to const Current Context Physical Memory Address. */
|
---|
1600 | typedef const RTCCPHYS *PCRTCCPHYS;
|
---|
1601 | /** @def NIL_RTCCPHYS
|
---|
1602 | * NIL CC Physical Address.
|
---|
1603 | * NIL_RTCCPHYS is used to signal an invalid physical address, similar
|
---|
1604 | * to the NULL pointer.
|
---|
1605 | */
|
---|
1606 | #ifdef IN_RC
|
---|
1607 | # define NIL_RTCCPHYS NIL_RTGCPHYS
|
---|
1608 | #else
|
---|
1609 | # define NIL_RTCCPHYS NIL_RTHCPHYS
|
---|
1610 | #endif
|
---|
1611 |
|
---|
1612 | /** Unsigned integer register in the current context. */
|
---|
1613 | #if ARCH_BITS == 32
|
---|
1614 | typedef uint32_t RTCCUINTREG;
|
---|
1615 | #elif ARCH_BITS == 64
|
---|
1616 | typedef uint64_t RTCCUINTREG;
|
---|
1617 | #else
|
---|
1618 | # error "Unsupported ARCH_BITS!"
|
---|
1619 | #endif
|
---|
1620 | /** Pointer to an unsigned integer register in the current context. */
|
---|
1621 | typedef RTCCUINTREG *PRTCCUINTREG;
|
---|
1622 | /** Pointer to a const unsigned integer register in the current context. */
|
---|
1623 | typedef RTCCUINTREG const *PCRTCCUINTREG;
|
---|
1624 |
|
---|
1625 | /** Signed integer register in the current context. */
|
---|
1626 | #if ARCH_BITS == 32
|
---|
1627 | typedef int32_t RTCCINTREG;
|
---|
1628 | #elif ARCH_BITS == 64
|
---|
1629 | typedef int64_t RTCCINTREG;
|
---|
1630 | #endif
|
---|
1631 | /** Pointer to a signed integer register in the current context. */
|
---|
1632 | typedef RTCCINTREG *PRTCCINTREG;
|
---|
1633 | /** Pointer to a const signed integer register in the current context. */
|
---|
1634 | typedef RTCCINTREG const *PCRTCCINTREG;
|
---|
1635 |
|
---|
1636 | /** @} */
|
---|
1637 |
|
---|
1638 |
|
---|
1639 | /** Pointer to a critical section. */
|
---|
1640 | typedef struct RTCRITSECT *PRTCRITSECT;
|
---|
1641 | /** Pointer to a const critical section. */
|
---|
1642 | typedef const struct RTCRITSECT *PCRTCRITSECT;
|
---|
1643 |
|
---|
1644 | /** Pointer to a read/write critical section. */
|
---|
1645 | typedef struct RTCRITSECTRW *PRTCRITSECTRW;
|
---|
1646 | /** Pointer to a const read/write critical section. */
|
---|
1647 | typedef const struct RTCRITSECTRW *PCRTCRITSECTRW;
|
---|
1648 |
|
---|
1649 |
|
---|
1650 | /** Condition variable handle. */
|
---|
1651 | typedef R3PTRTYPE(struct RTCONDVARINTERNAL *) RTCONDVAR;
|
---|
1652 | /** Pointer to a condition variable handle. */
|
---|
1653 | typedef RTCONDVAR *PRTCONDVAR;
|
---|
1654 | /** Nil condition variable handle. */
|
---|
1655 | #define NIL_RTCONDVAR 0
|
---|
1656 |
|
---|
1657 | /** File handle. */
|
---|
1658 | typedef R3R0PTRTYPE(struct RTFILEINT *) RTFILE;
|
---|
1659 | /** Pointer to file handle. */
|
---|
1660 | typedef RTFILE *PRTFILE;
|
---|
1661 | /** Nil file handle. */
|
---|
1662 | #define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
|
---|
1663 |
|
---|
1664 | /** Async I/O request handle. */
|
---|
1665 | typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL *) RTFILEAIOREQ;
|
---|
1666 | /** Pointer to an async I/O request handle. */
|
---|
1667 | typedef RTFILEAIOREQ *PRTFILEAIOREQ;
|
---|
1668 | /** Nil request handle. */
|
---|
1669 | #define NIL_RTFILEAIOREQ 0
|
---|
1670 |
|
---|
1671 | /** Async I/O completion context handle. */
|
---|
1672 | typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL *) RTFILEAIOCTX;
|
---|
1673 | /** Pointer to an async I/O completion context handle. */
|
---|
1674 | typedef RTFILEAIOCTX *PRTFILEAIOCTX;
|
---|
1675 | /** Nil context handle. */
|
---|
1676 | #define NIL_RTFILEAIOCTX 0
|
---|
1677 |
|
---|
1678 | /** Loader module handle. */
|
---|
1679 | typedef R3PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
|
---|
1680 | /** Pointer to a loader module handle. */
|
---|
1681 | typedef RTLDRMOD *PRTLDRMOD;
|
---|
1682 | /** Nil loader module handle. */
|
---|
1683 | #define NIL_RTLDRMOD 0
|
---|
1684 |
|
---|
1685 | /** Lock validator class handle. */
|
---|
1686 | typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT *) RTLOCKVALCLASS;
|
---|
1687 | /** Pointer to a lock validator class handle. */
|
---|
1688 | typedef RTLOCKVALCLASS *PRTLOCKVALCLASS;
|
---|
1689 | /** Nil lock validator class handle. */
|
---|
1690 | #define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
|
---|
1691 |
|
---|
1692 | /** Ring-0 memory object handle. */
|
---|
1693 | typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL *) RTR0MEMOBJ;
|
---|
1694 | /** Pointer to a Ring-0 memory object handle. */
|
---|
1695 | typedef RTR0MEMOBJ *PRTR0MEMOBJ;
|
---|
1696 | /** Nil ring-0 memory object handle. */
|
---|
1697 | #define NIL_RTR0MEMOBJ 0
|
---|
1698 |
|
---|
1699 | /** Native thread handle. */
|
---|
1700 | typedef RTHCUINTPTR RTNATIVETHREAD;
|
---|
1701 | /** Pointer to an native thread handle. */
|
---|
1702 | typedef RTNATIVETHREAD *PRTNATIVETHREAD;
|
---|
1703 | /** Nil native thread handle. */
|
---|
1704 | #define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
|
---|
1705 |
|
---|
1706 | /** Pipe handle. */
|
---|
1707 | typedef R3R0PTRTYPE(struct RTPIPEINTERNAL *) RTPIPE;
|
---|
1708 | /** Pointer to a pipe handle. */
|
---|
1709 | typedef RTPIPE *PRTPIPE;
|
---|
1710 | /** Nil pipe handle.
|
---|
1711 | * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
|
---|
1712 | #define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
|
---|
1713 |
|
---|
1714 | /** @typedef RTPOLLSET
|
---|
1715 | * Poll set handle. */
|
---|
1716 | typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL *) RTPOLLSET;
|
---|
1717 | /** Pointer to a poll set handle. */
|
---|
1718 | typedef RTPOLLSET *PRTPOLLSET;
|
---|
1719 | /** Nil poll set handle handle. */
|
---|
1720 | #define NIL_RTPOLLSET ((RTPOLLSET)0)
|
---|
1721 |
|
---|
1722 | /** Process identifier. */
|
---|
1723 | typedef uint32_t RTPROCESS;
|
---|
1724 | /** Pointer to a process identifier. */
|
---|
1725 | typedef RTPROCESS *PRTPROCESS;
|
---|
1726 | /** Nil process identifier. */
|
---|
1727 | #define NIL_RTPROCESS (~(RTPROCESS)0)
|
---|
1728 |
|
---|
1729 | /** Process ring-0 handle. */
|
---|
1730 | typedef RTR0UINTPTR RTR0PROCESS;
|
---|
1731 | /** Pointer to a ring-0 process handle. */
|
---|
1732 | typedef RTR0PROCESS *PRTR0PROCESS;
|
---|
1733 | /** Nil ring-0 process handle. */
|
---|
1734 | #define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
|
---|
1735 |
|
---|
1736 | /** @typedef RTSEMEVENT
|
---|
1737 | * Event Semaphore handle. */
|
---|
1738 | typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL *) RTSEMEVENT;
|
---|
1739 | /** Pointer to an event semaphore handle. */
|
---|
1740 | typedef RTSEMEVENT *PRTSEMEVENT;
|
---|
1741 | /** Nil event semaphore handle. */
|
---|
1742 | #define NIL_RTSEMEVENT 0
|
---|
1743 |
|
---|
1744 | /** @typedef RTSEMEVENTMULTI
|
---|
1745 | * Event Multiple Release Semaphore handle. */
|
---|
1746 | typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL *) RTSEMEVENTMULTI;
|
---|
1747 | /** Pointer to an event multiple release semaphore handle. */
|
---|
1748 | typedef RTSEMEVENTMULTI *PRTSEMEVENTMULTI;
|
---|
1749 | /** Nil multiple release event semaphore handle. */
|
---|
1750 | #define NIL_RTSEMEVENTMULTI 0
|
---|
1751 |
|
---|
1752 | /** @typedef RTSEMFASTMUTEX
|
---|
1753 | * Fast mutex Semaphore handle. */
|
---|
1754 | typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL *) RTSEMFASTMUTEX;
|
---|
1755 | /** Pointer to a fast mutex semaphore handle. */
|
---|
1756 | typedef RTSEMFASTMUTEX *PRTSEMFASTMUTEX;
|
---|
1757 | /** Nil fast mutex semaphore handle. */
|
---|
1758 | #define NIL_RTSEMFASTMUTEX 0
|
---|
1759 |
|
---|
1760 | /** @typedef RTSEMMUTEX
|
---|
1761 | * Mutex Semaphore handle. */
|
---|
1762 | typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL *) RTSEMMUTEX;
|
---|
1763 | /** Pointer to a mutex semaphore handle. */
|
---|
1764 | typedef RTSEMMUTEX *PRTSEMMUTEX;
|
---|
1765 | /** Nil mutex semaphore handle. */
|
---|
1766 | #define NIL_RTSEMMUTEX 0
|
---|
1767 |
|
---|
1768 | /** @typedef RTSEMSPINMUTEX
|
---|
1769 | * Spinning mutex Semaphore handle. */
|
---|
1770 | typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL *) RTSEMSPINMUTEX;
|
---|
1771 | /** Pointer to a spinning mutex semaphore handle. */
|
---|
1772 | typedef RTSEMSPINMUTEX *PRTSEMSPINMUTEX;
|
---|
1773 | /** Nil spinning mutex semaphore handle. */
|
---|
1774 | #define NIL_RTSEMSPINMUTEX 0
|
---|
1775 |
|
---|
1776 | /** @typedef RTSEMRW
|
---|
1777 | * Read/Write Semaphore handle. */
|
---|
1778 | typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL *) RTSEMRW;
|
---|
1779 | /** Pointer to a read/write semaphore handle. */
|
---|
1780 | typedef RTSEMRW *PRTSEMRW;
|
---|
1781 | /** Nil read/write semaphore handle. */
|
---|
1782 | #define NIL_RTSEMRW 0
|
---|
1783 |
|
---|
1784 | /** @typedef RTSEMXROADS
|
---|
1785 | * Crossroads semaphore handle. */
|
---|
1786 | typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL *) RTSEMXROADS;
|
---|
1787 | /** Pointer to a crossroads semaphore handle. */
|
---|
1788 | typedef RTSEMXROADS *PRTSEMXROADS;
|
---|
1789 | /** Nil crossroads semaphore handle. */
|
---|
1790 | #define NIL_RTSEMXROADS ((RTSEMXROADS)0)
|
---|
1791 |
|
---|
1792 | /** Spinlock handle. */
|
---|
1793 | typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL *) RTSPINLOCK;
|
---|
1794 | /** Pointer to a spinlock handle. */
|
---|
1795 | typedef RTSPINLOCK *PRTSPINLOCK;
|
---|
1796 | /** Nil spinlock handle. */
|
---|
1797 | #define NIL_RTSPINLOCK 0
|
---|
1798 |
|
---|
1799 | /** Socket handle. */
|
---|
1800 | typedef R3R0PTRTYPE(struct RTSOCKETINT *) RTSOCKET;
|
---|
1801 | /** Pointer to socket handle. */
|
---|
1802 | typedef RTSOCKET *PRTSOCKET;
|
---|
1803 | /** Nil socket handle. */
|
---|
1804 | #define NIL_RTSOCKET ((RTSOCKET)0)
|
---|
1805 |
|
---|
1806 | /** Pointer to a RTTCPSERVER handle. */
|
---|
1807 | typedef struct RTTCPSERVER *PRTTCPSERVER;
|
---|
1808 | /** Pointer to a RTTCPSERVER handle. */
|
---|
1809 | typedef PRTTCPSERVER *PPRTTCPSERVER;
|
---|
1810 | /** Nil RTTCPSERVER handle. */
|
---|
1811 | #define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
|
---|
1812 |
|
---|
1813 | /** Pointer to a RTUDPSERVER handle. */
|
---|
1814 | typedef struct RTUDPSERVER *PRTUDPSERVER;
|
---|
1815 | /** Pointer to a RTUDPSERVER handle. */
|
---|
1816 | typedef PRTUDPSERVER *PPRTUDPSERVER;
|
---|
1817 | /** Nil RTUDPSERVER handle. */
|
---|
1818 | #define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
|
---|
1819 |
|
---|
1820 | /** Thread handle.*/
|
---|
1821 | typedef R3R0PTRTYPE(struct RTTHREADINT *) RTTHREAD;
|
---|
1822 | /** Pointer to thread handle. */
|
---|
1823 | typedef RTTHREAD *PRTTHREAD;
|
---|
1824 | /** Nil thread handle. */
|
---|
1825 | #define NIL_RTTHREAD 0
|
---|
1826 |
|
---|
1827 | /** Thread-context handle.*/
|
---|
1828 | typedef R0PTRTYPE(struct RTTHREADCTXINT *) RTTHREADCTX;
|
---|
1829 | /** Pointer to thread handle. */
|
---|
1830 | typedef RTTHREADCTX *PRTTHREADCTX;
|
---|
1831 | /** Nil thread-context handle. */
|
---|
1832 | #define NIL_RTTHREADCTX 0
|
---|
1833 |
|
---|
1834 | /** A TLS index. */
|
---|
1835 | typedef RTHCINTPTR RTTLS;
|
---|
1836 | /** Pointer to a TLS index. */
|
---|
1837 | typedef RTTLS *PRTTLS;
|
---|
1838 | /** Pointer to a const TLS index. */
|
---|
1839 | typedef RTTLS const *PCRTTLS;
|
---|
1840 | /** NIL TLS index value. */
|
---|
1841 | #define NIL_RTTLS ((RTTLS)-1)
|
---|
1842 |
|
---|
1843 | /** Trace buffer handle.
|
---|
1844 | * @remarks This is not a R3/R0 type like most other handles!
|
---|
1845 | */
|
---|
1846 | typedef struct RTTRACEBUFINT *RTTRACEBUF;
|
---|
1847 | /** Poiner to a trace buffer handle. */
|
---|
1848 | typedef RTTRACEBUF *PRTTRACEBUF;
|
---|
1849 | /** Nil trace buffer handle. */
|
---|
1850 | #define NIL_RTTRACEBUF ((RTTRACEBUF)0)
|
---|
1851 | /** The handle of the default trace buffer.
|
---|
1852 | * This can be used with any of the RTTraceBufAdd APIs. */
|
---|
1853 | #define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
|
---|
1854 |
|
---|
1855 | /** Handle to a simple heap. */
|
---|
1856 | typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL *) RTHEAPSIMPLE;
|
---|
1857 | /** Pointer to a handle to a simple heap. */
|
---|
1858 | typedef RTHEAPSIMPLE *PRTHEAPSIMPLE;
|
---|
1859 | /** NIL simple heap handle. */
|
---|
1860 | #define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
|
---|
1861 |
|
---|
1862 | /** Handle to an offset based heap. */
|
---|
1863 | typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL *) RTHEAPOFFSET;
|
---|
1864 | /** Pointer to a handle to an offset based heap. */
|
---|
1865 | typedef RTHEAPOFFSET *PRTHEAPOFFSET;
|
---|
1866 | /** NIL offset based heap handle. */
|
---|
1867 | #define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
|
---|
1868 |
|
---|
1869 | /** Handle to an environment block. */
|
---|
1870 | typedef R3PTRTYPE(struct RTENVINTERNAL *) RTENV;
|
---|
1871 | /** Pointer to a handle to an environment block. */
|
---|
1872 | typedef RTENV *PRTENV;
|
---|
1873 | /** NIL simple heap handle. */
|
---|
1874 | #define NIL_RTENV ((RTENV)0)
|
---|
1875 |
|
---|
1876 | /** A CPU identifier.
|
---|
1877 | * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
|
---|
1878 | * does it have to correspond to the bits in the affinity mask, at
|
---|
1879 | * least not until we've sorted out Windows NT. */
|
---|
1880 | typedef uint32_t RTCPUID;
|
---|
1881 | /** Pointer to a CPU identifier. */
|
---|
1882 | typedef RTCPUID *PRTCPUID;
|
---|
1883 | /** Pointer to a const CPU identifier. */
|
---|
1884 | typedef RTCPUID const *PCRTCPUID;
|
---|
1885 | /** Nil CPU Id. */
|
---|
1886 | #define NIL_RTCPUID ((RTCPUID)~0)
|
---|
1887 |
|
---|
1888 | /** The maximum number of CPUs a set can contain and IPRT is able
|
---|
1889 | * to reference. (Should be max of support arch/platforms.)
|
---|
1890 | * @remarks Must be a multiple of 64 (see RTCPUSET). */
|
---|
1891 | #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
|
---|
1892 | # define RTCPUSET_MAX_CPUS 256
|
---|
1893 | #elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
|
---|
1894 | # define RTCPUSET_MAX_CPUS 1024
|
---|
1895 | #else
|
---|
1896 | # define RTCPUSET_MAX_CPUS 64
|
---|
1897 | #endif
|
---|
1898 | /** A CPU set.
|
---|
1899 | * @note Treat this as an opaque type and always use RTCpuSet* for
|
---|
1900 | * manupulating it. */
|
---|
1901 | typedef struct RTCPUSET
|
---|
1902 | {
|
---|
1903 | /** The bitmap. */
|
---|
1904 | uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
|
---|
1905 | } RTCPUSET;
|
---|
1906 | /** Pointer to a CPU set. */
|
---|
1907 | typedef RTCPUSET *PRTCPUSET;
|
---|
1908 | /** Pointer to a const CPU set. */
|
---|
1909 | typedef RTCPUSET const *PCRTCPUSET;
|
---|
1910 |
|
---|
1911 | /** A handle table handle. */
|
---|
1912 | typedef R3R0PTRTYPE(struct RTHANDLETABLEINT *) RTHANDLETABLE;
|
---|
1913 | /** A pointer to a handle table handle. */
|
---|
1914 | typedef RTHANDLETABLE *PRTHANDLETABLE;
|
---|
1915 | /** @def NIL_RTHANDLETABLE
|
---|
1916 | * NIL handle table handle. */
|
---|
1917 | #define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
|
---|
1918 |
|
---|
1919 | /** A handle to a low resolution timer. */
|
---|
1920 | typedef R3R0PTRTYPE(struct RTTIMERLRINT *) RTTIMERLR;
|
---|
1921 | /** A pointer to a low resolution timer handle. */
|
---|
1922 | typedef RTTIMERLR *PRTTIMERLR;
|
---|
1923 | /** @def NIL_RTTIMERLR
|
---|
1924 | * NIL low resolution timer handle value. */
|
---|
1925 | #define NIL_RTTIMERLR ((RTTIMERLR)0)
|
---|
1926 |
|
---|
1927 | /** Handle to a random number generator. */
|
---|
1928 | typedef R3R0PTRTYPE(struct RTRANDINT *) RTRAND;
|
---|
1929 | /** Pointer to a random number generator handle. */
|
---|
1930 | typedef RTRAND *PRTRAND;
|
---|
1931 | /** NIL random number genrator handle value. */
|
---|
1932 | #define NIL_RTRAND ((RTRAND)0)
|
---|
1933 |
|
---|
1934 | /** Debug address space handle. */
|
---|
1935 | typedef R3R0PTRTYPE(struct RTDBGASINT *) RTDBGAS;
|
---|
1936 | /** Pointer to a debug address space handle. */
|
---|
1937 | typedef RTDBGAS *PRTDBGAS;
|
---|
1938 | /** NIL debug address space handle. */
|
---|
1939 | #define NIL_RTDBGAS ((RTDBGAS)0)
|
---|
1940 |
|
---|
1941 | /** Debug module handle. */
|
---|
1942 | typedef R3R0PTRTYPE(struct RTDBGMODINT *) RTDBGMOD;
|
---|
1943 | /** Pointer to a debug module handle. */
|
---|
1944 | typedef RTDBGMOD *PRTDBGMOD;
|
---|
1945 | /** NIL debug module handle. */
|
---|
1946 | #define NIL_RTDBGMOD ((RTDBGMOD)0)
|
---|
1947 |
|
---|
1948 | /** Manifest handle. */
|
---|
1949 | typedef struct RTMANIFESTINT *RTMANIFEST;
|
---|
1950 | /** Pointer to a manifest handle. */
|
---|
1951 | typedef RTMANIFEST *PRTMANIFEST;
|
---|
1952 | /** NIL manifest handle. */
|
---|
1953 | #define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
|
---|
1954 |
|
---|
1955 | /** Memory pool handle. */
|
---|
1956 | typedef R3R0PTRTYPE(struct RTMEMPOOLINT *) RTMEMPOOL;
|
---|
1957 | /** Pointer to a memory pool handle. */
|
---|
1958 | typedef RTMEMPOOL *PRTMEMPOOL;
|
---|
1959 | /** NIL memory pool handle. */
|
---|
1960 | #define NIL_RTMEMPOOL ((RTMEMPOOL)0)
|
---|
1961 | /** The default memory pool handle. */
|
---|
1962 | #define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
|
---|
1963 |
|
---|
1964 | /** String cache handle. */
|
---|
1965 | typedef R3R0PTRTYPE(struct RTSTRCACHEINT *) RTSTRCACHE;
|
---|
1966 | /** Pointer to a string cache handle. */
|
---|
1967 | typedef RTSTRCACHE *PRTSTRCACHE;
|
---|
1968 | /** NIL string cache handle. */
|
---|
1969 | #define NIL_RTSTRCACHE ((RTSTRCACHE)0)
|
---|
1970 | /** The default string cache handle. */
|
---|
1971 | #define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
|
---|
1972 |
|
---|
1973 |
|
---|
1974 | /** Virtual Filesystem handle. */
|
---|
1975 | typedef struct RTVFSINTERNAL *RTVFS;
|
---|
1976 | /** Pointer to a VFS handle. */
|
---|
1977 | typedef RTVFS *PRTVFS;
|
---|
1978 | /** A NIL VFS handle. */
|
---|
1979 | #define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
|
---|
1980 |
|
---|
1981 | /** Virtual Filesystem base object handle. */
|
---|
1982 | typedef struct RTVFSOBJINTERNAL *RTVFSOBJ;
|
---|
1983 | /** Pointer to a VFS base object handle. */
|
---|
1984 | typedef RTVFSOBJ *PRTVFSOBJ;
|
---|
1985 | /** A NIL VFS base object handle. */
|
---|
1986 | #define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
|
---|
1987 |
|
---|
1988 | /** Virtual Filesystem directory handle. */
|
---|
1989 | typedef struct RTVFSDIRINTERNAL *RTVFSDIR;
|
---|
1990 | /** Pointer to a VFS directory handle. */
|
---|
1991 | typedef RTVFSDIR *PRTVFSDIR;
|
---|
1992 | /** A NIL VFS directory handle. */
|
---|
1993 | #define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
|
---|
1994 |
|
---|
1995 | /** Virtual Filesystem filesystem stream handle. */
|
---|
1996 | typedef struct RTVFSFSSTREAMINTERNAL *RTVFSFSSTREAM;
|
---|
1997 | /** Pointer to a VFS filesystem stream handle. */
|
---|
1998 | typedef RTVFSFSSTREAM *PRTVFSFSSTREAM;
|
---|
1999 | /** A NIL VFS filesystem stream handle. */
|
---|
2000 | #define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
|
---|
2001 |
|
---|
2002 | /** Virtual Filesystem I/O stream handle. */
|
---|
2003 | typedef struct RTVFSIOSTREAMINTERNAL *RTVFSIOSTREAM;
|
---|
2004 | /** Pointer to a VFS I/O stream handle. */
|
---|
2005 | typedef RTVFSIOSTREAM *PRTVFSIOSTREAM;
|
---|
2006 | /** A NIL VFS I/O stream handle. */
|
---|
2007 | #define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
|
---|
2008 |
|
---|
2009 | /** Virtual Filesystem file handle. */
|
---|
2010 | typedef struct RTVFSFILEINTERNAL *RTVFSFILE;
|
---|
2011 | /** Pointer to a VFS file handle. */
|
---|
2012 | typedef RTVFSFILE *PRTVFSFILE;
|
---|
2013 | /** A NIL VFS file handle. */
|
---|
2014 | #define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
|
---|
2015 |
|
---|
2016 | /** Virtual Filesystem symbolic link handle. */
|
---|
2017 | typedef struct RTVFSSYMLINKINTERNAL *RTVFSSYMLINK;
|
---|
2018 | /** Pointer to a VFS symbolic link handle. */
|
---|
2019 | typedef RTVFSSYMLINK *PRTVFSSYMLINK;
|
---|
2020 | /** A NIL VFS symbolic link handle. */
|
---|
2021 | #define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
|
---|
2022 |
|
---|
2023 | /** Async I/O manager handle. */
|
---|
2024 | typedef struct RTAIOMGRINT *RTAIOMGR;
|
---|
2025 | /** Pointer to a async I/O manager handle. */
|
---|
2026 | typedef RTAIOMGR *PRTAIOMGR;
|
---|
2027 | /** A NIL async I/O manager handle. */
|
---|
2028 | #define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
|
---|
2029 |
|
---|
2030 | /** Async I/O manager file handle. */
|
---|
2031 | typedef struct RTAIOMGRFILEINT *RTAIOMGRFILE;
|
---|
2032 | /** Pointer to a async I/O manager file handle. */
|
---|
2033 | typedef RTAIOMGRFILE *PRTAIOMGRFILE;
|
---|
2034 | /** A NIL async I/O manager file handle. */
|
---|
2035 | #define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
|
---|
2036 |
|
---|
2037 | /**
|
---|
2038 | * Handle type.
|
---|
2039 | *
|
---|
2040 | * This is usually used together with RTHANDLEUNION.
|
---|
2041 | */
|
---|
2042 | typedef enum RTHANDLETYPE
|
---|
2043 | {
|
---|
2044 | /** The invalid zero value. */
|
---|
2045 | RTHANDLETYPE_INVALID = 0,
|
---|
2046 | /** File handle. */
|
---|
2047 | RTHANDLETYPE_FILE,
|
---|
2048 | /** Pipe handle */
|
---|
2049 | RTHANDLETYPE_PIPE,
|
---|
2050 | /** Socket handle. */
|
---|
2051 | RTHANDLETYPE_SOCKET,
|
---|
2052 | /** Thread handle. */
|
---|
2053 | RTHANDLETYPE_THREAD,
|
---|
2054 | /** The end of the valid values. */
|
---|
2055 | RTHANDLETYPE_END,
|
---|
2056 | /** The 32-bit type blow up. */
|
---|
2057 | RTHANDLETYPE_32BIT_HACK = 0x7fffffff
|
---|
2058 | } RTHANDLETYPE;
|
---|
2059 | /** Pointer to a handle type. */
|
---|
2060 | typedef RTHANDLETYPE *PRTHANDLETYPE;
|
---|
2061 |
|
---|
2062 | /**
|
---|
2063 | * Handle union.
|
---|
2064 | *
|
---|
2065 | * This is usually used together with RTHANDLETYPE or as RTHANDLE.
|
---|
2066 | */
|
---|
2067 | typedef union RTHANDLEUNION
|
---|
2068 | {
|
---|
2069 | RTFILE hFile; /**< File handle. */
|
---|
2070 | RTPIPE hPipe; /**< Pipe handle. */
|
---|
2071 | RTSOCKET hSocket; /**< Socket handle. */
|
---|
2072 | RTTHREAD hThread; /**< Thread handle. */
|
---|
2073 | /** Generic integer handle value.
|
---|
2074 | * Note that RTFILE is not yet pointer sized, so accessing it via this member
|
---|
2075 | * isn't necessarily safe or fully portable. */
|
---|
2076 | RTHCUINTPTR uInt;
|
---|
2077 | } RTHANDLEUNION;
|
---|
2078 | /** Pointer to a handle union. */
|
---|
2079 | typedef RTHANDLEUNION *PRTHANDLEUNION;
|
---|
2080 | /** Pointer to a const handle union. */
|
---|
2081 | typedef RTHANDLEUNION const *PCRTHANDLEUNION;
|
---|
2082 |
|
---|
2083 | /**
|
---|
2084 | * Generic handle.
|
---|
2085 | */
|
---|
2086 | typedef struct RTHANDLE
|
---|
2087 | {
|
---|
2088 | /** The handle type. */
|
---|
2089 | RTHANDLETYPE enmType;
|
---|
2090 | /** The handle value. */
|
---|
2091 | RTHANDLEUNION u;
|
---|
2092 | } RTHANDLE;
|
---|
2093 | /** Pointer to a generic handle. */
|
---|
2094 | typedef RTHANDLE *PRTHANDLE;
|
---|
2095 | /** Pointer to a const generic handle. */
|
---|
2096 | typedef RTHANDLE const *PCRTHANDLE;
|
---|
2097 |
|
---|
2098 |
|
---|
2099 | /**
|
---|
2100 | * Standard handles.
|
---|
2101 | *
|
---|
2102 | * @remarks These have the correct file descriptor values for unixy systems and
|
---|
2103 | * can be used directly in code specific to those platforms.
|
---|
2104 | */
|
---|
2105 | typedef enum RTHANDLESTD
|
---|
2106 | {
|
---|
2107 | /** Invalid standard handle. */
|
---|
2108 | RTHANDLESTD_INVALID = -1,
|
---|
2109 | /** The standard input handle. */
|
---|
2110 | RTHANDLESTD_INPUT = 0,
|
---|
2111 | /** The standard output handle. */
|
---|
2112 | RTHANDLESTD_OUTPUT,
|
---|
2113 | /** The standard error handle. */
|
---|
2114 | RTHANDLESTD_ERROR,
|
---|
2115 | /** The typical 32-bit type hack. */
|
---|
2116 | RTHANDLESTD_32BIT_HACK = 0x7fffffff
|
---|
2117 | } RTHANDLESTD;
|
---|
2118 |
|
---|
2119 |
|
---|
2120 | /**
|
---|
2121 | * Error info.
|
---|
2122 | *
|
---|
2123 | * See RTErrInfo*.
|
---|
2124 | */
|
---|
2125 | typedef struct RTERRINFO
|
---|
2126 | {
|
---|
2127 | /** Flags, see RTERRINFO_FLAGS_XXX. */
|
---|
2128 | uint32_t fFlags;
|
---|
2129 | /** The status code. */
|
---|
2130 | int32_t rc;
|
---|
2131 | /** The size of the message */
|
---|
2132 | size_t cbMsg;
|
---|
2133 | /** The error buffer. */
|
---|
2134 | char *pszMsg;
|
---|
2135 | /** Reserved for future use. */
|
---|
2136 | void *apvReserved[2];
|
---|
2137 | } RTERRINFO;
|
---|
2138 | /** Pointer to an error info structure. */
|
---|
2139 | typedef RTERRINFO *PRTERRINFO;
|
---|
2140 | /** Pointer to a const error info structure. */
|
---|
2141 | typedef RTERRINFO const *PCRTERRINFO;
|
---|
2142 |
|
---|
2143 | /**
|
---|
2144 | * Static error info structure, see RTErrInfoInitStatic.
|
---|
2145 | */
|
---|
2146 | typedef struct RTERRINFOSTATIC
|
---|
2147 | {
|
---|
2148 | /** The core error info. */
|
---|
2149 | RTERRINFO Core;
|
---|
2150 | /** The static message buffer. */
|
---|
2151 | char szMsg[3072];
|
---|
2152 | } RTERRINFOSTATIC;
|
---|
2153 | /** Pointer to a error info buffer. */
|
---|
2154 | typedef RTERRINFOSTATIC *PRTERRINFOSTATIC;
|
---|
2155 | /** Pointer to a const static error info buffer. */
|
---|
2156 | typedef RTERRINFOSTATIC const *PCRTERRINFOSTATIC;
|
---|
2157 |
|
---|
2158 |
|
---|
2159 | /**
|
---|
2160 | * UUID data type.
|
---|
2161 | *
|
---|
2162 | * See RTUuid*.
|
---|
2163 | *
|
---|
2164 | * @remarks IPRT defines that the first three integers in the @c Gen struct
|
---|
2165 | * interpretation are in little endian representation. This is
|
---|
2166 | * different to many other UUID implementation, and requires
|
---|
2167 | * conversion if you need to achieve consistent results.
|
---|
2168 | */
|
---|
2169 | typedef union RTUUID
|
---|
2170 | {
|
---|
2171 | /** 8-bit view. */
|
---|
2172 | uint8_t au8[16];
|
---|
2173 | /** 16-bit view. */
|
---|
2174 | uint16_t au16[8];
|
---|
2175 | /** 32-bit view. */
|
---|
2176 | uint32_t au32[4];
|
---|
2177 | /** 64-bit view. */
|
---|
2178 | uint64_t au64[2];
|
---|
2179 | /** The way the UUID is declared by the DCE specification. */
|
---|
2180 | struct
|
---|
2181 | {
|
---|
2182 | uint32_t u32TimeLow;
|
---|
2183 | uint16_t u16TimeMid;
|
---|
2184 | uint16_t u16TimeHiAndVersion;
|
---|
2185 | uint8_t u8ClockSeqHiAndReserved;
|
---|
2186 | uint8_t u8ClockSeqLow;
|
---|
2187 | uint8_t au8Node[6];
|
---|
2188 | } Gen;
|
---|
2189 | } RTUUID;
|
---|
2190 | /** Pointer to UUID data. */
|
---|
2191 | typedef RTUUID *PRTUUID;
|
---|
2192 | /** Pointer to readonly UUID data. */
|
---|
2193 | typedef const RTUUID *PCRTUUID;
|
---|
2194 |
|
---|
2195 | /** UUID string maximum length. */
|
---|
2196 | #define RTUUID_STR_LENGTH 37
|
---|
2197 |
|
---|
2198 |
|
---|
2199 | /** Compression handle. */
|
---|
2200 | typedef struct RTZIPCOMP *PRTZIPCOMP;
|
---|
2201 | /** Decompressor handle. */
|
---|
2202 | typedef struct RTZIPDECOMP *PRTZIPDECOMP;
|
---|
2203 |
|
---|
2204 |
|
---|
2205 | /**
|
---|
2206 | * Unicode Code Point.
|
---|
2207 | */
|
---|
2208 | typedef uint32_t RTUNICP;
|
---|
2209 | /** Pointer to an Unicode Code Point. */
|
---|
2210 | typedef RTUNICP *PRTUNICP;
|
---|
2211 | /** Pointer to an Unicode Code Point. */
|
---|
2212 | typedef const RTUNICP *PCRTUNICP;
|
---|
2213 | /** Max value a RTUNICP type can hold. */
|
---|
2214 | #define RTUNICP_MAX ( ~(RTUNICP)0 )
|
---|
2215 | /** Invalid code point.
|
---|
2216 | * This is returned when encountered invalid encodings or invalid
|
---|
2217 | * unicode code points. */
|
---|
2218 | #define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
|
---|
2219 |
|
---|
2220 |
|
---|
2221 | /**
|
---|
2222 | * UTF-16 character.
|
---|
2223 | * @remark wchar_t is not usable since it's compiler defined.
|
---|
2224 | * @remark When we use the term character we're not talking about unicode code point, but
|
---|
2225 | * the basic unit of the string encoding. Thus cwc - count of wide chars - means
|
---|
2226 | * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
|
---|
2227 | * and cch means count of the typedef 'char', which is assumed to be an octet.
|
---|
2228 | */
|
---|
2229 | typedef uint16_t RTUTF16;
|
---|
2230 | /** Pointer to a UTF-16 character. */
|
---|
2231 | typedef RTUTF16 *PRTUTF16;
|
---|
2232 | /** Pointer to a const UTF-16 character. */
|
---|
2233 | typedef const RTUTF16 *PCRTUTF16;
|
---|
2234 |
|
---|
2235 |
|
---|
2236 | /**
|
---|
2237 | * Wait for ever if we have to.
|
---|
2238 | */
|
---|
2239 | #define RT_INDEFINITE_WAIT (~0U)
|
---|
2240 |
|
---|
2241 |
|
---|
2242 | /**
|
---|
2243 | * Generic process callback.
|
---|
2244 | *
|
---|
2245 | * @returns VBox status code. Failure will cancel the operation.
|
---|
2246 | * @param uPercentage The percentage of the operation which has been completed.
|
---|
2247 | * @param pvUser The user specified argument.
|
---|
2248 | */
|
---|
2249 | typedef DECLCALLBACK(int) FNRTPROGRESS(unsigned uPrecentage, void *pvUser);
|
---|
2250 | /** Pointer to a generic progress callback function, FNRTPROCESS(). */
|
---|
2251 | typedef FNRTPROGRESS *PFNRTPROGRESS;
|
---|
2252 |
|
---|
2253 |
|
---|
2254 | /**
|
---|
2255 | * A point in a two dimentional coordinate system.
|
---|
2256 | */
|
---|
2257 | typedef struct RTPOINT
|
---|
2258 | {
|
---|
2259 | /** X coordinate. */
|
---|
2260 | int32_t x;
|
---|
2261 | /** Y coordinate. */
|
---|
2262 | int32_t y;
|
---|
2263 | } RTPOINT;
|
---|
2264 | /** Pointer to a point. */
|
---|
2265 | typedef RTPOINT *PRTPOINT;
|
---|
2266 | /** Pointer to a const point. */
|
---|
2267 | typedef const RTPOINT *PCRTPOINT;
|
---|
2268 |
|
---|
2269 |
|
---|
2270 | /**
|
---|
2271 | * Rectangle data type, double point.
|
---|
2272 | */
|
---|
2273 | typedef struct RTRECT
|
---|
2274 | {
|
---|
2275 | /** left X coordinate. */
|
---|
2276 | int32_t xLeft;
|
---|
2277 | /** top Y coordinate. */
|
---|
2278 | int32_t yTop;
|
---|
2279 | /** right X coordinate. (exclusive) */
|
---|
2280 | int32_t xRight;
|
---|
2281 | /** bottom Y coordinate. (exclusive) */
|
---|
2282 | int32_t yBottom;
|
---|
2283 | } RTRECT;
|
---|
2284 | /** Pointer to a double point rectangle. */
|
---|
2285 | typedef RTRECT *PRTRECT;
|
---|
2286 | /** Pointer to a const double point rectangle. */
|
---|
2287 | typedef const RTRECT *PCRTRECT;
|
---|
2288 |
|
---|
2289 |
|
---|
2290 | /**
|
---|
2291 | * Rectangle data type, point + size.
|
---|
2292 | */
|
---|
2293 | typedef struct RTRECT2
|
---|
2294 | {
|
---|
2295 | /** X coordinate.
|
---|
2296 | * Unless stated otherwise, this is the top left corner. */
|
---|
2297 | int32_t x;
|
---|
2298 | /** Y coordinate.
|
---|
2299 | * Unless stated otherwise, this is the top left corner. */
|
---|
2300 | int32_t y;
|
---|
2301 | /** The width.
|
---|
2302 | * Unless stated otherwise, this is to the right of (x,y) and will not
|
---|
2303 | * be a negative number. */
|
---|
2304 | int32_t cx;
|
---|
2305 | /** The height.
|
---|
2306 | * Unless stated otherwise, this is down from (x,y) and will not be a
|
---|
2307 | * negative number. */
|
---|
2308 | int32_t cy;
|
---|
2309 | } RTRECT2;
|
---|
2310 | /** Pointer to a point + size rectangle. */
|
---|
2311 | typedef RTRECT2 *PRTRECT2;
|
---|
2312 | /** Pointer to a const point + size rectangle. */
|
---|
2313 | typedef const RTRECT2 *PCRTRECT2;
|
---|
2314 |
|
---|
2315 |
|
---|
2316 | /**
|
---|
2317 | * The size of a rectangle.
|
---|
2318 | */
|
---|
2319 | typedef struct RTRECTSIZE
|
---|
2320 | {
|
---|
2321 | /** The width (along the x-axis). */
|
---|
2322 | uint32_t cx;
|
---|
2323 | /** The height (along the y-axis). */
|
---|
2324 | uint32_t cy;
|
---|
2325 | } RTRECTSIZE;
|
---|
2326 | /** Pointer to a rectangle size. */
|
---|
2327 | typedef RTRECTSIZE *PRTRECTSIZE;
|
---|
2328 | /** Pointer to a const rectangle size. */
|
---|
2329 | typedef const RTRECTSIZE *PCRTRECTSIZE;
|
---|
2330 |
|
---|
2331 |
|
---|
2332 | /**
|
---|
2333 | * Ethernet MAC address.
|
---|
2334 | *
|
---|
2335 | * The first 24 bits make up the Organisationally Unique Identifier (OUI),
|
---|
2336 | * where the first bit (little endian) indicates multicast (set) / unicast,
|
---|
2337 | * and the second bit indicates locally (set) / global administered. If all
|
---|
2338 | * bits are set, it's a broadcast.
|
---|
2339 | */
|
---|
2340 | typedef union RTMAC
|
---|
2341 | {
|
---|
2342 | /** @todo add a bitfield view of this stuff. */
|
---|
2343 | /** 8-bit view. */
|
---|
2344 | uint8_t au8[6];
|
---|
2345 | /** 16-bit view. */
|
---|
2346 | uint16_t au16[3];
|
---|
2347 | } RTMAC;
|
---|
2348 | /** Pointer to a MAC address. */
|
---|
2349 | typedef RTMAC *PRTMAC;
|
---|
2350 | /** Pointer to a readonly MAC address. */
|
---|
2351 | typedef const RTMAC *PCRTMAC;
|
---|
2352 |
|
---|
2353 |
|
---|
2354 | /** Pointer to a lock validator record.
|
---|
2355 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
2356 | typedef struct RTLOCKVALRECEXCL *PRTLOCKVALRECEXCL;
|
---|
2357 | /** Pointer to a record of one ownership share.
|
---|
2358 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
2359 | typedef struct RTLOCKVALRECSHRD *PRTLOCKVALRECSHRD;
|
---|
2360 | /** Pointer to a lock validator source poisition.
|
---|
2361 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
2362 | typedef struct RTLOCKVALSRCPOS *PRTLOCKVALSRCPOS;
|
---|
2363 | /** Pointer to a const lock validator source poisition.
|
---|
2364 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
2365 | typedef struct RTLOCKVALSRCPOS const *PCRTLOCKVALSRCPOS;
|
---|
2366 |
|
---|
2367 | /** @name Special sub-class values.
|
---|
2368 | * The range 16..UINT32_MAX is available to the user, the range 0..15 is
|
---|
2369 | * reserved for the lock validator. In the user range the locks can only be
|
---|
2370 | * taking in ascending order.
|
---|
2371 | * @{ */
|
---|
2372 | /** Invalid value. */
|
---|
2373 | #define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
|
---|
2374 | /** Not allowed to be taken with any other locks in the same class.
|
---|
2375 | * This is the recommended value. */
|
---|
2376 | #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
|
---|
2377 | /** Any order is allowed within the class. */
|
---|
2378 | #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
|
---|
2379 | /** The first user value. */
|
---|
2380 | #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
|
---|
2381 | /** @} */
|
---|
2382 |
|
---|
2383 |
|
---|
2384 | /**
|
---|
2385 | * Process exit codes.
|
---|
2386 | */
|
---|
2387 | typedef enum RTEXITCODE
|
---|
2388 | {
|
---|
2389 | /** Success. */
|
---|
2390 | RTEXITCODE_SUCCESS = 0,
|
---|
2391 | /** General failure. */
|
---|
2392 | RTEXITCODE_FAILURE = 1,
|
---|
2393 | /** Invalid arguments. */
|
---|
2394 | RTEXITCODE_SYNTAX = 2,
|
---|
2395 | /** Initialization failure (usually IPRT, but could be used for other
|
---|
2396 | * components as well). */
|
---|
2397 | RTEXITCODE_INIT = 3,
|
---|
2398 | /** Test skipped. */
|
---|
2399 | RTEXITCODE_SKIPPED = 4,
|
---|
2400 | /** The end of valid exit codes. */
|
---|
2401 | RTEXITCODE_END,
|
---|
2402 | /** The usual 32-bit type hack. */
|
---|
2403 | RTEXITCODE_32BIT_HACK = 0x7fffffff
|
---|
2404 | } RTEXITCODE;
|
---|
2405 |
|
---|
2406 | /**
|
---|
2407 | * Range descriptor.
|
---|
2408 | */
|
---|
2409 | typedef struct RTRANGE
|
---|
2410 | {
|
---|
2411 | /** Start offset. */
|
---|
2412 | uint64_t offStart;
|
---|
2413 | /** Range size. */
|
---|
2414 | size_t cbRange;
|
---|
2415 | } RTRANGE;
|
---|
2416 | /** Pointer to a range descriptor. */
|
---|
2417 | typedef RTRANGE *PRTRANGE;
|
---|
2418 | /** Pointer to a readonly range descriptor. */
|
---|
2419 | typedef const RTRANGE *PCRTRANGE;
|
---|
2420 |
|
---|
2421 | #ifdef __cplusplus
|
---|
2422 | /**
|
---|
2423 | * Strict type validation helper class.
|
---|
2424 | *
|
---|
2425 | * See RTErrStrictType and RT_SUCCESS_NP.
|
---|
2426 | */
|
---|
2427 | class RTErrStrictType2
|
---|
2428 | {
|
---|
2429 | protected:
|
---|
2430 | /** The status code. */
|
---|
2431 | int32_t m_rc;
|
---|
2432 |
|
---|
2433 | public:
|
---|
2434 | /**
|
---|
2435 | * Constructor.
|
---|
2436 | * @param rc IPRT style status code.
|
---|
2437 | */
|
---|
2438 | RTErrStrictType2(int32_t rc) : m_rc(rc)
|
---|
2439 | {
|
---|
2440 | }
|
---|
2441 |
|
---|
2442 | /**
|
---|
2443 | * Get the status code.
|
---|
2444 | * @returns IPRT style status code.
|
---|
2445 | */
|
---|
2446 | int32_t getValue() const
|
---|
2447 | {
|
---|
2448 | return m_rc;
|
---|
2449 | }
|
---|
2450 | };
|
---|
2451 | #endif /* __cplusplus */
|
---|
2452 | /** @} */
|
---|
2453 |
|
---|
2454 | #endif
|
---|
2455 |
|
---|