VirtualBox

source: vbox/trunk/include/VBox/cdefs.h@ 74189

Last change on this file since 74189 was 71609, checked in by vboxsync, 7 years ago

Introducing VBox/AssertGuest.h and a family of ASSERT_GUEST_XXXX macros that parallels iprt/assert.h. bugref:9094 [build fix]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.9 KB
Line 
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 VBOX_STRICT_GUEST
80#define VBOX_NO_STRICT_GUEST
81#define IN_DBG
82#define IN_DIS
83#define IN_INTNET_R0
84#define IN_INTNET_R3
85#define IN_PCIRAW_R0
86#define IN_PCIRAW_R3
87#define IN_REM_R3
88#define IN_SUP_R0
89#define IN_SUP_R3
90#define IN_SUP_RC
91#define IN_SUP_STATIC
92#define IN_USBLIB
93#define IN_VBOXDDU
94#define IN_VMM_RC
95#define IN_VMM_R0
96#define IN_VMM_R3
97#define IN_VMM_STATIC
98#endif
99
100
101
102
103/** @def VBOXCALL
104 * The standard calling convention for VBOX interfaces.
105 */
106#define VBOXCALL RTCALL
107
108
109
110/** @def IN_DIS
111 * Used to indicate whether we're inside the same link module as the
112 * disassembler.
113 */
114/** @def DISDECL(type)
115 * Disassembly export or import declaration.
116 * @param type The return type of the function declaration.
117 */
118#if defined(IN_DIS)
119# ifdef IN_DIS_STATIC
120# define DISDECL(type) DECLHIDDEN(type) VBOXCALL
121# else
122# define DISDECL(type) DECLEXPORT(type) VBOXCALL
123# endif
124#else
125# define DISDECL(type) DECLIMPORT(type) VBOXCALL
126#endif
127
128
129
130/** @def IN_DBG
131 * Used to indicate whether we're inside the same link module as the debugger
132 * console, gui, and related things (ring-3).
133 */
134/** @def DBGDECL(type)
135 * Debugger module export or import declaration.
136 * Functions declared using this exists only in R3 since the
137 * debugger modules is R3 only.
138 * @param type The return type of the function declaration.
139 */
140#if defined(IN_DBG_R3) || defined(IN_DBG)
141# define DBGDECL(type) DECLEXPORT(type) VBOXCALL
142#else
143# define DBGDECL(type) DECLIMPORT(type) VBOXCALL
144#endif
145
146
147
148/** @def IN_INTNET_R3
149 * Used to indicate whether we're inside the same link module as the Ring-3
150 * Internal Networking Service.
151 */
152/** @def INTNETR3DECL(type)
153 * Internal Networking Service export or import declaration.
154 * @param type The return type of the function declaration.
155 */
156#ifdef IN_INTNET_R3
157# define INTNETR3DECL(type) DECLEXPORT(type) VBOXCALL
158#else
159# define INTNETR3DECL(type) DECLIMPORT(type) VBOXCALL
160#endif
161
162/** @def IN_INTNET_R0
163 * Used to indicate whether we're inside the same link module as the R0
164 * Internal Network Service.
165 */
166/** @def INTNETR0DECL(type)
167 * Internal Networking Service export or import declaration.
168 * @param type The return type of the function declaration.
169 */
170#ifdef IN_INTNET_R0
171# define INTNETR0DECL(type) DECLEXPORT(type) VBOXCALL
172#else
173# define INTNETR0DECL(type) DECLIMPORT(type) VBOXCALL
174#endif
175
176
177
178/** @def IN_PCIRAW_R3
179 * Used to indicate whether we're inside the same link module as the Ring-3
180 * PCI passthrough support.
181 */
182/** @def PCIRAWR3DECL(type)
183 * PCI passthrough export or import declaration.
184 * @param type The return type of the function declaration.
185 */
186#ifdef IN_PCIRAW_R3
187# define PCIRAWR3DECL(type) DECLEXPORT(type) VBOXCALL
188#else
189# define PCIRAWR3DECL(type) DECLIMPORT(type) VBOXCALL
190#endif
191
192/** @def IN_PCIRAW_R0
193 * Used to indicate whether we're inside the same link module as the R0
194 * PCI passthrough support.
195 */
196/** @def PCIRAWR0DECL(type)
197 * PCI passthroug export or import declaration.
198 * @param type The return type of the function declaration.
199 */
200#ifdef IN_PCIRAW_R0
201# define PCIRAWR0DECL(type) DECLEXPORT(type) VBOXCALL
202#else
203# define PCIRAWR0DECL(type) DECLIMPORT(type) VBOXCALL
204#endif
205
206
207
208/** @def IN_REM_R3
209 * Used to indicate whether we're inside the same link module as
210 * the HC Ring-3 Recompiled Execution Manager.
211 */
212/** @def REMR3DECL(type)
213 * Recompiled Execution Manager HC Ring-3 export or import declaration.
214 * @param type The return type of the function declaration.
215 */
216#ifdef IN_REM_R3
217# define REMR3DECL(type) DECLEXPORT(type) VBOXCALL
218#else
219# define REMR3DECL(type) DECLIMPORT(type) VBOXCALL
220#endif
221
222
223
224/** @def IN_SUP_R3
225 * Used to indicate whether we're inside the same link module as the Ring-3
226 * Support Library or not.
227 */
228/** @def SUPR3DECL(type)
229 * Support library export or import declaration.
230 * @param type The return type of the function declaration.
231 */
232#ifdef IN_SUP_R3
233# ifdef IN_SUP_STATIC
234# define SUPR3DECL(type) DECLHIDDEN(type) VBOXCALL
235# else
236# define SUPR3DECL(type) DECLEXPORT(type) VBOXCALL
237# endif
238#else
239# ifdef IN_SUP_STATIC
240# define SUPR3DECL(type) DECLHIDDEN(type) VBOXCALL
241# else
242# define SUPR3DECL(type) DECLIMPORT(type) VBOXCALL
243# endif
244#endif
245
246/** @def IN_SUP_R0
247 * Used to indicate whether we're inside the same link module as the Ring-0
248 * Support Library or not.
249 */
250/** @def IN_SUP_STATIC
251 * Used to indicate that the Support Library is built or used as a static
252 * library.
253 */
254/** @def SUPR0DECL(type)
255 * Support library export or import declaration.
256 * @param type The return type of the function declaration.
257 */
258#ifdef IN_SUP_R0
259# ifdef IN_SUP_STATIC
260# define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
261# else
262# define SUPR0DECL(type) DECLEXPORT(type) VBOXCALL
263# endif
264#else
265# ifdef IN_SUP_STATIC
266# define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
267# else
268# define SUPR0DECL(type) DECLIMPORT(type) VBOXCALL
269# endif
270#endif
271
272/** @def IN_SUP_RC
273 * Used to indicate whether we're inside the same link module as the RC Support
274 * Library or not.
275 */
276/** @def SUPRCDECL(type)
277 * Support library export or import declaration.
278 * @param type The return type of the function declaration.
279 */
280#ifdef IN_SUP_RC
281# define SUPRCDECL(type) DECLEXPORT(type) VBOXCALL
282#else
283# define SUPRCDECL(type) DECLIMPORT(type) VBOXCALL
284#endif
285
286/** @def IN_SUP_R0
287 * Used to indicate whether we're inside the same link module as the Ring-0
288 * Support Library or not.
289 */
290/** @def SUPR0DECL(type)
291 * Support library export or import declaration.
292 * @param type The return type of the function declaration.
293 */
294#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
295# define SUPDECL(type) DECLEXPORT(type) VBOXCALL
296#else
297# define SUPDECL(type) DECLIMPORT(type) VBOXCALL
298#endif
299
300
301
302/** @def IN_USBLIB
303 * Used to indicate whether we're inside the same link module as the USBLib.
304 */
305/** @def USBLIB_DECL
306 * USBLIB export or import declaration.
307 * @param type The return type of the function declaration.
308 */
309#ifdef IN_RING0
310# define USBLIB_DECL(type) type VBOXCALL
311#elif defined(IN_USBLIB)
312# define USBLIB_DECL(type) DECLEXPORT(type) VBOXCALL
313#else
314# define USBLIB_DECL(type) DECLIMPORT(type) VBOXCALL
315#endif
316
317
318
319/** @def IN_VMM_STATIC
320 * Used to indicate that the virtual machine monitor is built or used as a
321 * static library.
322 */
323/** @def IN_VMM_R3
324 * Used to indicate whether we're inside the same link module as the ring 3 part of the
325 * virtual machine monitor or not.
326 */
327/** @def VMMR3DECL
328 * Ring-3 VMM export or import declaration.
329 * @param type The return type of the function declaration.
330 */
331#ifdef IN_VMM_R3
332# ifdef IN_VMM_STATIC
333# define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
334# else
335# define VMMR3DECL(type) DECLEXPORT(type) VBOXCALL
336# endif
337#elif defined(IN_RING3)
338# ifdef IN_VMM_STATIC
339# define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
340# else
341# define VMMR3DECL(type) DECLIMPORT(type) VBOXCALL
342# endif
343#else
344# define VMMR3DECL(type) DECL_INVALID(type)
345#endif
346
347/** @def IN_VMM_R0
348 * Used to indicate whether we're inside the same link module as the ring-0 part
349 * of the virtual machine monitor or not.
350 */
351/** @def VMMR0DECL
352 * Ring-0 VMM export or import declaration.
353 * @param type The return type of the function declaration.
354 */
355#ifdef IN_VMM_R0
356# define VMMR0DECL(type) DECLEXPORT(type) VBOXCALL
357#elif defined(IN_RING0)
358# define VMMR0DECL(type) DECLIMPORT(type) VBOXCALL
359#else
360# define VMMR0DECL(type) DECL_INVALID(type)
361#endif
362
363/** @def IN_VMM_RC
364 * Used to indicate whether we're inside the same link module as the raw-mode
365 * context part of the virtual machine monitor or not.
366 */
367/** @def VMMRCDECL
368 * Raw-mode context VMM export or import declaration.
369 * @param type The return type of the function declaration.
370 */
371#ifdef IN_VMM_RC
372# define VMMRCDECL(type) DECLEXPORT(type) VBOXCALL
373#elif defined(IN_RC)
374# define VMMRCDECL(type) DECLIMPORT(type) VBOXCALL
375#else
376# define VMMRCDECL(type) DECL_INVALID(type)
377#endif
378
379/** @def VMMRZDECL
380 * Ring-0 and Raw-mode context VMM export or import declaration.
381 * @param type The return type of the function declaration.
382 */
383#if defined(IN_VMM_R0) || defined(IN_VMM_RC)
384# define VMMRZDECL(type) DECLEXPORT(type) VBOXCALL
385#elif defined(IN_RING0) || defined(IN_RZ)
386# define VMMRZDECL(type) DECLIMPORT(type) VBOXCALL
387#else
388# define VMMRZDECL(type) DECL_INVALID(type)
389#endif
390
391/** @def VMMDECL
392 * VMM export or import declaration.
393 * @param type The return type of the function declaration.
394 */
395#ifdef IN_VMM_STATIC
396# define VMMDECL(type) DECLHIDDEN(type) VBOXCALL
397#elif defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
398# define VMMDECL(type) DECLEXPORT(type) VBOXCALL
399#else
400# define VMMDECL(type) DECLIMPORT(type) VBOXCALL
401#endif
402
403/** @def VMM_INT_DECL
404 * VMM internal function.
405 * @param type The return type of the function declaration.
406 */
407#if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
408# define VMM_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
409#else
410# define VMM_INT_DECL(type) DECL_INVALID(type)
411#endif
412
413/** @def VMMR3_INT_DECL
414 * VMM internal function, ring-3.
415 * @param type The return type of the function declaration.
416 */
417#ifdef IN_VMM_R3
418# define VMMR3_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
419#else
420# define VMMR3_INT_DECL(type) DECL_INVALID(type)
421#endif
422
423/** @def VMMR0_INT_DECL
424 * VMM internal function, ring-0.
425 * @param type The return type of the function declaration.
426 */
427#ifdef IN_VMM_R0
428# define VMMR0_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
429#else
430# define VMMR0_INT_DECL(type) DECL_INVALID(type)
431#endif
432
433/** @def VMMRC_INT_DECL
434 * VMM internal function, raw-mode context.
435 * @param type The return type of the function declaration.
436 */
437#ifdef IN_VMM_RC
438# define VMMRC_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
439#else
440# define VMMRC_INT_DECL(type) DECL_INVALID(type)
441#endif
442
443/** @def VMMRZ_INT_DECL
444 * VMM internal function, ring-0 + raw-mode context.
445 * @param type The return type of the function declaration.
446 */
447#if defined(IN_VMM_RC) || defined(IN_VMM_R0)
448# define VMMRZ_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
449#else
450# define VMMRZ_INT_DECL(type) DECL_INVALID(type)
451#endif
452
453
454
455/** @def IN_VBOXDDU
456 * Used to indicate whether we're inside the VBoxDDU shared object.
457 */
458/** @def VBOXDDU_DECL(type)
459 * VBoxDDU export or import (ring-3).
460 * @param type The return type of the function declaration.
461 */
462#ifdef IN_VBOXDDU
463# ifdef IN_VBOXDDU_STATIC
464# define VBOXDDU_DECL(type) type
465# else
466# define VBOXDDU_DECL(type) DECLEXPORT(type) VBOXCALL
467# endif
468#else
469# define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL
470#endif
471
472/** @} */
473
474
475/** @defgroup grp_devdrv Device Emulations and Drivers
476 * @{ */
477/** @} */
478
479#endif
480
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette