1 | /** @file
|
---|
2 | * VirtualBox - Common C and C++ definition.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 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 ___VBox_cdefs_h
|
---|
27 | #define ___VBox_cdefs_h
|
---|
28 |
|
---|
29 | #include <iprt/cdefs.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | /** @defgroup grp_vbox_cdefs VBox Common Defintions and Macros
|
---|
33 | * @{
|
---|
34 | */
|
---|
35 |
|
---|
36 | /** @def VBOX_WITH_STATISTICS
|
---|
37 | * When defined all statistics will be included in the build.
|
---|
38 | * This is enabled by default in all debug builds.
|
---|
39 | */
|
---|
40 | #ifndef VBOX_WITH_STATISTICS
|
---|
41 | # ifdef DEBUG
|
---|
42 | # define VBOX_WITH_STATISTICS
|
---|
43 | # endif
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /** @def VBOX_STRICT
|
---|
47 | * Alias for RT_STRICT.
|
---|
48 | */
|
---|
49 | #ifdef RT_STRICT
|
---|
50 | # ifndef VBOX_STRICT
|
---|
51 | # define VBOX_STRICT
|
---|
52 | # endif
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | /** @def VBOX_STRICT_GUEST
|
---|
56 | * Be strict on guest input. This can be overriden on the compiler command line
|
---|
57 | * or per source file by defining VBOX_NO_STRICT_GUEST.
|
---|
58 | *
|
---|
59 | * @sa VBox/assert.h and its ASSERT_GUEST_XXXX macros.
|
---|
60 | */
|
---|
61 | #ifndef VBOX_STRICT_GUEST
|
---|
62 | # ifdef VBOX_STRICT
|
---|
63 | # define VBOX_STRICT_GUEST
|
---|
64 | # endif
|
---|
65 | #endif
|
---|
66 | /** @def VBOX_NO_STRICT_GUEST
|
---|
67 | * Define to override VBOX_STRICT_GUEST, disabling asserting on guest input. */
|
---|
68 | #ifdef VBOX_NO_STRICT_GUEST
|
---|
69 | # undef VBOX_STRICT_GUEST
|
---|
70 | #endif
|
---|
71 |
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * Shut up DOXYGEN warnings and guide it properly thru the code.
|
---|
75 | */
|
---|
76 | #ifdef DOXYGEN_RUNNING
|
---|
77 | #define VBOX_WITH_STATISTICS
|
---|
78 | #define VBOX_STRICT
|
---|
79 | #define IN_DBG
|
---|
80 | #define IN_DIS
|
---|
81 | #define IN_INTNET_R0
|
---|
82 | #define IN_INTNET_R3
|
---|
83 | #define IN_PCIRAW_R0
|
---|
84 | #define IN_PCIRAW_R3
|
---|
85 | #define IN_REM_R3
|
---|
86 | #define IN_SUP_R0
|
---|
87 | #define IN_SUP_R3
|
---|
88 | #define IN_SUP_RC
|
---|
89 | #define IN_SUP_STATIC
|
---|
90 | #define IN_USBLIB
|
---|
91 | #define IN_VBOXDDU
|
---|
92 | #define IN_VMM_RC
|
---|
93 | #define IN_VMM_R0
|
---|
94 | #define IN_VMM_R3
|
---|
95 | #define IN_VMM_STATIC
|
---|
96 | #endif
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 | /** @def VBOXCALL
|
---|
102 | * The standard calling convention for VBOX interfaces.
|
---|
103 | */
|
---|
104 | #define VBOXCALL RTCALL
|
---|
105 |
|
---|
106 |
|
---|
107 |
|
---|
108 | /** @def IN_DIS
|
---|
109 | * Used to indicate whether we're inside the same link module as the
|
---|
110 | * disassembler.
|
---|
111 | */
|
---|
112 | /** @def DISDECL(type)
|
---|
113 | * Disassembly export or import declaration.
|
---|
114 | * @param type The return type of the function declaration.
|
---|
115 | */
|
---|
116 | #if defined(IN_DIS)
|
---|
117 | # ifdef IN_DIS_STATIC
|
---|
118 | # define DISDECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
119 | # else
|
---|
120 | # define DISDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
121 | # endif
|
---|
122 | #else
|
---|
123 | # define DISDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
124 | #endif
|
---|
125 |
|
---|
126 |
|
---|
127 |
|
---|
128 | /** @def IN_DBG
|
---|
129 | * Used to indicate whether we're inside the same link module as the debugger
|
---|
130 | * console, gui, and related things (ring-3).
|
---|
131 | */
|
---|
132 | /** @def DBGDECL(type)
|
---|
133 | * Debugger module export or import declaration.
|
---|
134 | * Functions declared using this exists only in R3 since the
|
---|
135 | * debugger modules is R3 only.
|
---|
136 | * @param type The return type of the function declaration.
|
---|
137 | */
|
---|
138 | #if defined(IN_DBG_R3) || defined(IN_DBG)
|
---|
139 | # define DBGDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
140 | #else
|
---|
141 | # define DBGDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
142 | #endif
|
---|
143 |
|
---|
144 |
|
---|
145 |
|
---|
146 | /** @def IN_INTNET_R3
|
---|
147 | * Used to indicate whether we're inside the same link module as the Ring-3
|
---|
148 | * Internal Networking Service.
|
---|
149 | */
|
---|
150 | /** @def INTNETR3DECL(type)
|
---|
151 | * Internal Networking Service export or import declaration.
|
---|
152 | * @param type The return type of the function declaration.
|
---|
153 | */
|
---|
154 | #ifdef IN_INTNET_R3
|
---|
155 | # define INTNETR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
156 | #else
|
---|
157 | # define INTNETR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
158 | #endif
|
---|
159 |
|
---|
160 | /** @def IN_INTNET_R0
|
---|
161 | * Used to indicate whether we're inside the same link module as the R0
|
---|
162 | * Internal Network Service.
|
---|
163 | */
|
---|
164 | /** @def INTNETR0DECL(type)
|
---|
165 | * Internal Networking Service export or import declaration.
|
---|
166 | * @param type The return type of the function declaration.
|
---|
167 | */
|
---|
168 | #ifdef IN_INTNET_R0
|
---|
169 | # define INTNETR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
170 | #else
|
---|
171 | # define INTNETR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
172 | #endif
|
---|
173 |
|
---|
174 |
|
---|
175 |
|
---|
176 | /** @def IN_PCIRAW_R3
|
---|
177 | * Used to indicate whether we're inside the same link module as the Ring-3
|
---|
178 | * PCI passthrough support.
|
---|
179 | */
|
---|
180 | /** @def PCIRAWR3DECL(type)
|
---|
181 | * PCI passthrough export or import declaration.
|
---|
182 | * @param type The return type of the function declaration.
|
---|
183 | */
|
---|
184 | #ifdef IN_PCIRAW_R3
|
---|
185 | # define PCIRAWR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
186 | #else
|
---|
187 | # define PCIRAWR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | /** @def IN_PCIRAW_R0
|
---|
191 | * Used to indicate whether we're inside the same link module as the R0
|
---|
192 | * PCI passthrough support.
|
---|
193 | */
|
---|
194 | /** @def PCIRAWR0DECL(type)
|
---|
195 | * PCI passthroug export or import declaration.
|
---|
196 | * @param type The return type of the function declaration.
|
---|
197 | */
|
---|
198 | #ifdef IN_PCIRAW_R0
|
---|
199 | # define PCIRAWR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
200 | #else
|
---|
201 | # define PCIRAWR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
202 | #endif
|
---|
203 |
|
---|
204 |
|
---|
205 |
|
---|
206 | /** @def IN_REM_R3
|
---|
207 | * Used to indicate whether we're inside the same link module as
|
---|
208 | * the HC Ring-3 Recompiled Execution Manager.
|
---|
209 | */
|
---|
210 | /** @def REMR3DECL(type)
|
---|
211 | * Recompiled Execution Manager HC Ring-3 export or import declaration.
|
---|
212 | * @param type The return type of the function declaration.
|
---|
213 | */
|
---|
214 | #ifdef IN_REM_R3
|
---|
215 | # define REMR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
216 | #else
|
---|
217 | # define REMR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
218 | #endif
|
---|
219 |
|
---|
220 |
|
---|
221 |
|
---|
222 | /** @def IN_SUP_R3
|
---|
223 | * Used to indicate whether we're inside the same link module as the Ring-3
|
---|
224 | * Support Library or not.
|
---|
225 | */
|
---|
226 | /** @def SUPR3DECL(type)
|
---|
227 | * Support library export or import declaration.
|
---|
228 | * @param type The return type of the function declaration.
|
---|
229 | */
|
---|
230 | #ifdef IN_SUP_R3
|
---|
231 | # ifdef IN_SUP_STATIC
|
---|
232 | # define SUPR3DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
233 | # else
|
---|
234 | # define SUPR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
235 | # endif
|
---|
236 | #else
|
---|
237 | # ifdef IN_SUP_STATIC
|
---|
238 | # define SUPR3DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
239 | # else
|
---|
240 | # define SUPR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
241 | # endif
|
---|
242 | #endif
|
---|
243 |
|
---|
244 | /** @def IN_SUP_R0
|
---|
245 | * Used to indicate whether we're inside the same link module as the Ring-0
|
---|
246 | * Support Library or not.
|
---|
247 | */
|
---|
248 | /** @def IN_SUP_STATIC
|
---|
249 | * Used to indicate that the Support Library is built or used as a static
|
---|
250 | * library.
|
---|
251 | */
|
---|
252 | /** @def SUPR0DECL(type)
|
---|
253 | * Support library export or import declaration.
|
---|
254 | * @param type The return type of the function declaration.
|
---|
255 | */
|
---|
256 | #ifdef IN_SUP_R0
|
---|
257 | # ifdef IN_SUP_STATIC
|
---|
258 | # define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
259 | # else
|
---|
260 | # define SUPR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
261 | # endif
|
---|
262 | #else
|
---|
263 | # ifdef IN_SUP_STATIC
|
---|
264 | # define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
265 | # else
|
---|
266 | # define SUPR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
267 | # endif
|
---|
268 | #endif
|
---|
269 |
|
---|
270 | /** @def IN_SUP_RC
|
---|
271 | * Used to indicate whether we're inside the same link module as the RC Support
|
---|
272 | * Library or not.
|
---|
273 | */
|
---|
274 | /** @def SUPRCDECL(type)
|
---|
275 | * Support library export or import declaration.
|
---|
276 | * @param type The return type of the function declaration.
|
---|
277 | */
|
---|
278 | #ifdef IN_SUP_RC
|
---|
279 | # define SUPRCDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
280 | #else
|
---|
281 | # define SUPRCDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
282 | #endif
|
---|
283 |
|
---|
284 | /** @def IN_SUP_R0
|
---|
285 | * Used to indicate whether we're inside the same link module as the Ring-0
|
---|
286 | * Support Library or not.
|
---|
287 | */
|
---|
288 | /** @def SUPR0DECL(type)
|
---|
289 | * Support library export or import declaration.
|
---|
290 | * @param type The return type of the function declaration.
|
---|
291 | */
|
---|
292 | #if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
|
---|
293 | # define SUPDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
294 | #else
|
---|
295 | # define SUPDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
296 | #endif
|
---|
297 |
|
---|
298 |
|
---|
299 |
|
---|
300 | /** @def IN_USBLIB
|
---|
301 | * Used to indicate whether we're inside the same link module as the USBLib.
|
---|
302 | */
|
---|
303 | /** @def USBLIB_DECL
|
---|
304 | * USBLIB export or import declaration.
|
---|
305 | * @param type The return type of the function declaration.
|
---|
306 | */
|
---|
307 | #ifdef IN_RING0
|
---|
308 | # define USBLIB_DECL(type) type VBOXCALL
|
---|
309 | #elif defined(IN_USBLIB)
|
---|
310 | # define USBLIB_DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
311 | #else
|
---|
312 | # define USBLIB_DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
313 | #endif
|
---|
314 |
|
---|
315 |
|
---|
316 |
|
---|
317 | /** @def IN_VMM_STATIC
|
---|
318 | * Used to indicate that the virtual machine monitor is built or used as a
|
---|
319 | * static library.
|
---|
320 | */
|
---|
321 | /** @def IN_VMM_R3
|
---|
322 | * Used to indicate whether we're inside the same link module as the ring 3 part of the
|
---|
323 | * virtual machine monitor or not.
|
---|
324 | */
|
---|
325 | /** @def VMMR3DECL
|
---|
326 | * Ring-3 VMM export or import declaration.
|
---|
327 | * @param type The return type of the function declaration.
|
---|
328 | */
|
---|
329 | #ifdef IN_VMM_R3
|
---|
330 | # ifdef IN_VMM_STATIC
|
---|
331 | # define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
332 | # else
|
---|
333 | # define VMMR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
334 | # endif
|
---|
335 | #elif defined(IN_RING3)
|
---|
336 | # ifdef IN_VMM_STATIC
|
---|
337 | # define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
338 | # else
|
---|
339 | # define VMMR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
340 | # endif
|
---|
341 | #else
|
---|
342 | # define VMMR3DECL(type) DECL_INVALID(type)
|
---|
343 | #endif
|
---|
344 |
|
---|
345 | /** @def IN_VMM_R0
|
---|
346 | * Used to indicate whether we're inside the same link module as the ring-0 part
|
---|
347 | * of the virtual machine monitor or not.
|
---|
348 | */
|
---|
349 | /** @def VMMR0DECL
|
---|
350 | * Ring-0 VMM export or import declaration.
|
---|
351 | * @param type The return type of the function declaration.
|
---|
352 | */
|
---|
353 | #ifdef IN_VMM_R0
|
---|
354 | # define VMMR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
355 | #elif defined(IN_RING0)
|
---|
356 | # define VMMR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
357 | #else
|
---|
358 | # define VMMR0DECL(type) DECL_INVALID(type)
|
---|
359 | #endif
|
---|
360 |
|
---|
361 | /** @def IN_VMM_RC
|
---|
362 | * Used to indicate whether we're inside the same link module as the raw-mode
|
---|
363 | * context part of the virtual machine monitor or not.
|
---|
364 | */
|
---|
365 | /** @def VMMRCDECL
|
---|
366 | * Raw-mode context VMM export or import declaration.
|
---|
367 | * @param type The return type of the function declaration.
|
---|
368 | */
|
---|
369 | #ifdef IN_VMM_RC
|
---|
370 | # define VMMRCDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
371 | #elif defined(IN_RC)
|
---|
372 | # define VMMRCDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
373 | #else
|
---|
374 | # define VMMRCDECL(type) DECL_INVALID(type)
|
---|
375 | #endif
|
---|
376 |
|
---|
377 | /** @def VMMRZDECL
|
---|
378 | * Ring-0 and Raw-mode context VMM export or import declaration.
|
---|
379 | * @param type The return type of the function declaration.
|
---|
380 | */
|
---|
381 | #if defined(IN_VMM_R0) || defined(IN_VMM_RC)
|
---|
382 | # define VMMRZDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
383 | #elif defined(IN_RING0) || defined(IN_RZ)
|
---|
384 | # define VMMRZDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
385 | #else
|
---|
386 | # define VMMRZDECL(type) DECL_INVALID(type)
|
---|
387 | #endif
|
---|
388 |
|
---|
389 | /** @def VMMDECL
|
---|
390 | * VMM export or import declaration.
|
---|
391 | * @param type The return type of the function declaration.
|
---|
392 | */
|
---|
393 | #ifdef IN_VMM_STATIC
|
---|
394 | # define VMMDECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
395 | #elif defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
|
---|
396 | # define VMMDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
397 | #else
|
---|
398 | # define VMMDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
399 | #endif
|
---|
400 |
|
---|
401 | /** @def VMM_INT_DECL
|
---|
402 | * VMM internal function.
|
---|
403 | * @param type The return type of the function declaration.
|
---|
404 | */
|
---|
405 | #if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
|
---|
406 | # define VMM_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
407 | #else
|
---|
408 | # define VMM_INT_DECL(type) DECL_INVALID(type)
|
---|
409 | #endif
|
---|
410 |
|
---|
411 | /** @def VMMR3_INT_DECL
|
---|
412 | * VMM internal function, ring-3.
|
---|
413 | * @param type The return type of the function declaration.
|
---|
414 | */
|
---|
415 | #ifdef IN_VMM_R3
|
---|
416 | # define VMMR3_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
417 | #else
|
---|
418 | # define VMMR3_INT_DECL(type) DECL_INVALID(type)
|
---|
419 | #endif
|
---|
420 |
|
---|
421 | /** @def VMMR0_INT_DECL
|
---|
422 | * VMM internal function, ring-0.
|
---|
423 | * @param type The return type of the function declaration.
|
---|
424 | */
|
---|
425 | #ifdef IN_VMM_R0
|
---|
426 | # define VMMR0_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
427 | #else
|
---|
428 | # define VMMR0_INT_DECL(type) DECL_INVALID(type)
|
---|
429 | #endif
|
---|
430 |
|
---|
431 | /** @def VMMRC_INT_DECL
|
---|
432 | * VMM internal function, raw-mode context.
|
---|
433 | * @param type The return type of the function declaration.
|
---|
434 | */
|
---|
435 | #ifdef IN_VMM_RC
|
---|
436 | # define VMMRC_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
437 | #else
|
---|
438 | # define VMMRC_INT_DECL(type) DECL_INVALID(type)
|
---|
439 | #endif
|
---|
440 |
|
---|
441 | /** @def VMMRZ_INT_DECL
|
---|
442 | * VMM internal function, ring-0 + raw-mode context.
|
---|
443 | * @param type The return type of the function declaration.
|
---|
444 | */
|
---|
445 | #if defined(IN_VMM_RC) || defined(IN_VMM_R0)
|
---|
446 | # define VMMRZ_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
447 | #else
|
---|
448 | # define VMMRZ_INT_DECL(type) DECL_INVALID(type)
|
---|
449 | #endif
|
---|
450 |
|
---|
451 |
|
---|
452 |
|
---|
453 | /** @def IN_VBOXDDU
|
---|
454 | * Used to indicate whether we're inside the VBoxDDU shared object.
|
---|
455 | */
|
---|
456 | /** @def VBOXDDU_DECL(type)
|
---|
457 | * VBoxDDU export or import (ring-3).
|
---|
458 | * @param type The return type of the function declaration.
|
---|
459 | */
|
---|
460 | #ifdef IN_VBOXDDU
|
---|
461 | # ifdef IN_VBOXDDU_STATIC
|
---|
462 | # define VBOXDDU_DECL(type) type
|
---|
463 | # else
|
---|
464 | # define VBOXDDU_DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
465 | # endif
|
---|
466 | #else
|
---|
467 | # define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
468 | #endif
|
---|
469 |
|
---|
470 | /** @} */
|
---|
471 |
|
---|
472 |
|
---|
473 | /** @defgroup grp_devdrv Device Emulations and Drivers
|
---|
474 | * @{ */
|
---|
475 | /** @} */
|
---|
476 |
|
---|
477 | #endif
|
---|
478 |
|
---|