VirtualBox

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

Last change on this file since 73768 was 71609, checked in by vboxsync, 6 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
RevLine 
[1]1/** @file
2 * VirtualBox - Common C and C++ definition.
3 */
4
5/*
[69107]6 * Copyright (C) 2006-2017 Oracle Corporation
[1]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
[5999]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.
[1]24 */
25
[3632]26#ifndef ___VBox_cdefs_h
27#define ___VBox_cdefs_h
[1]28
29#include <iprt/cdefs.h>
30
31
[71606]32/** @defgroup grp_vbox_cdefs VBox Common Defintions and Macros
[58111]33 * @{
34 */
35
[1]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
[71606]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
[1]71
[71606]72
[1]73/*
74 * Shut up DOXYGEN warnings and guide it properly thru the code.
75 */
[25642]76#ifdef DOXYGEN_RUNNING
[1]77#define VBOX_WITH_STATISTICS
[12653]78#define VBOX_STRICT
[71609]79#define VBOX_STRICT_GUEST
80#define VBOX_NO_STRICT_GUEST
[25647]81#define IN_DBG
[12989]82#define IN_DIS
[1]83#define IN_INTNET_R0
84#define IN_INTNET_R3
[35855]85#define IN_PCIRAW_R0
86#define IN_PCIRAW_R3
[1]87#define IN_REM_R3
88#define IN_SUP_R0
89#define IN_SUP_R3
[26227]90#define IN_SUP_RC
[25647]91#define IN_SUP_STATIC
[5562]92#define IN_USBLIB
[12653]93#define IN_VBOXDDU
[12989]94#define IN_VMM_RC
[1]95#define IN_VMM_R0
96#define IN_VMM_R3
[25647]97#define IN_VMM_STATIC
[1]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
[12989]110/** @def IN_DIS
111 * Used to indicate whether we're inside the same link module as the
112 * disassembler.
[1]113 */
[12989]114/** @def DISDECL(type)
115 * Disassembly export or import declaration.
[1]116 * @param type The return type of the function declaration.
117 */
[12989]118#if defined(IN_DIS)
[66715]119# ifdef IN_DIS_STATIC
[66714]120# define DISDECL(type) DECLHIDDEN(type) VBOXCALL
121# else
122# define DISDECL(type) DECLEXPORT(type) VBOXCALL
123# endif
[1]124#else
[12989]125# define DISDECL(type) DECLIMPORT(type) VBOXCALL
[1]126#endif
127
128
[12989]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).
[1]133 */
[12989]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.
[1]138 * @param type The return type of the function declaration.
139 */
[12989]140#if defined(IN_DBG_R3) || defined(IN_DBG)
141# define DBGDECL(type) DECLEXPORT(type) VBOXCALL
[1]142#else
[12989]143# define DBGDECL(type) DECLIMPORT(type) VBOXCALL
[1]144#endif
145
146
147
[12989]148/** @def IN_INTNET_R3
[26227]149 * Used to indicate whether we're inside the same link module as the Ring-3
[12989]150 * Internal Networking Service.
[1]151 */
[12989]152/** @def INTNETR3DECL(type)
153 * Internal Networking Service export or import declaration.
[1]154 * @param type The return type of the function declaration.
155 */
[12989]156#ifdef IN_INTNET_R3
157# define INTNETR3DECL(type) DECLEXPORT(type) VBOXCALL
[1]158#else
[12989]159# define INTNETR3DECL(type) DECLIMPORT(type) VBOXCALL
[1]160#endif
161
[12989]162/** @def IN_INTNET_R0
163 * Used to indicate whether we're inside the same link module as the R0
164 * Internal Network Service.
[1]165 */
[12989]166/** @def INTNETR0DECL(type)
167 * Internal Networking Service export or import declaration.
[1]168 * @param type The return type of the function declaration.
169 */
[12989]170#ifdef IN_INTNET_R0
171# define INTNETR0DECL(type) DECLEXPORT(type) VBOXCALL
[1]172#else
[12989]173# define INTNETR0DECL(type) DECLIMPORT(type) VBOXCALL
[1]174#endif
175
[35899]176
177
[35855]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
[1]191
[35855]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
[1]205
[35855]206
[35899]207
[12989]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.
[1]211 */
[12989]212/** @def REMR3DECL(type)
213 * Recompiled Execution Manager HC Ring-3 export or import declaration.
[1]214 * @param type The return type of the function declaration.
215 */
[12989]216#ifdef IN_REM_R3
217# define REMR3DECL(type) DECLEXPORT(type) VBOXCALL
[1]218#else
[12989]219# define REMR3DECL(type) DECLIMPORT(type) VBOXCALL
[1]220#endif
221
222
223
224/** @def IN_SUP_R3
[26227]225 * Used to indicate whether we're inside the same link module as the Ring-3
226 * Support Library or not.
[1]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
[49893]233# ifdef IN_SUP_STATIC
234# define SUPR3DECL(type) DECLHIDDEN(type) VBOXCALL
235# else
236# define SUPR3DECL(type) DECLEXPORT(type) VBOXCALL
237# endif
[1]238#else
[49893]239# ifdef IN_SUP_STATIC
240# define SUPR3DECL(type) DECLHIDDEN(type) VBOXCALL
241# else
242# define SUPR3DECL(type) DECLIMPORT(type) VBOXCALL
243# endif
[1]244#endif
245
246/** @def IN_SUP_R0
[26227]247 * Used to indicate whether we're inside the same link module as the Ring-0
[24577]248 * Support Library or not.
[1]249 */
[24577]250/** @def IN_SUP_STATIC
251 * Used to indicate that the Support Library is built or used as a static
252 * library.
253 */
[1]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
[11814]259# ifdef IN_SUP_STATIC
[12989]260# define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
[11814]261# else
[12989]262# define SUPR0DECL(type) DECLEXPORT(type) VBOXCALL
[11814]263# endif
[1]264#else
[11814]265# ifdef IN_SUP_STATIC
[12989]266# define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
[11814]267# else
[12989]268# define SUPR0DECL(type) DECLIMPORT(type) VBOXCALL
[11814]269# endif
[1]270#endif
271
[26227]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.
[1]275 */
[26227]276/** @def SUPRCDECL(type)
[1]277 * Support library export or import declaration.
278 * @param type The return type of the function declaration.
279 */
[26227]280#ifdef IN_SUP_RC
281# define SUPRCDECL(type) DECLEXPORT(type) VBOXCALL
[1]282#else
[26227]283# define SUPRCDECL(type) DECLIMPORT(type) VBOXCALL
[1]284#endif
285
286/** @def IN_SUP_R0
[26227]287 * Used to indicate whether we're inside the same link module as the Ring-0
288 * Support Library or not.
[1]289 */
290/** @def SUPR0DECL(type)
291 * Support library export or import declaration.
292 * @param type The return type of the function declaration.
293 */
[26227]294#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
[12989]295# define SUPDECL(type) DECLEXPORT(type) VBOXCALL
[1]296#else
[12989]297# define SUPDECL(type) DECLIMPORT(type) VBOXCALL
[1]298#endif
299
300
301
[5562]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
[24577]319/** @def IN_VMM_STATIC
320 * Used to indicate that the virtual machine monitor is built or used as a
321 * static library.
322 */
[12989]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.
[1]326 */
[12989]327/** @def VMMR3DECL
[26227]328 * Ring-3 VMM export or import declaration.
[1]329 * @param type The return type of the function declaration.
330 */
[12989]331#ifdef IN_VMM_R3
[24577]332# ifdef IN_VMM_STATIC
333# define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
334# else
335# define VMMR3DECL(type) DECLEXPORT(type) VBOXCALL
336# endif
[22802]337#elif defined(IN_RING3)
[24577]338# ifdef IN_VMM_STATIC
339# define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
340# else
341# define VMMR3DECL(type) DECLIMPORT(type) VBOXCALL
342# endif
[1]343#else
[22802]344# define VMMR3DECL(type) DECL_INVALID(type)
[1]345#endif
346
[12989]347/** @def IN_VMM_R0
[26227]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.
[1]350 */
[12989]351/** @def VMMR0DECL
[26227]352 * Ring-0 VMM export or import declaration.
[1]353 * @param type The return type of the function declaration.
354 */
[12989]355#ifdef IN_VMM_R0
[22802]356# define VMMR0DECL(type) DECLEXPORT(type) VBOXCALL
357#elif defined(IN_RING0)
358# define VMMR0DECL(type) DECLIMPORT(type) VBOXCALL
[1]359#else
[22802]360# define VMMR0DECL(type) DECL_INVALID(type)
[1]361#endif
362
[12989]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.
[1]366 */
[12989]367/** @def VMMRCDECL
[19287]368 * Raw-mode context VMM export or import declaration.
[1]369 * @param type The return type of the function declaration.
370 */
[12989]371#ifdef IN_VMM_RC
[22802]372# define VMMRCDECL(type) DECLEXPORT(type) VBOXCALL
373#elif defined(IN_RC)
374# define VMMRCDECL(type) DECLIMPORT(type) VBOXCALL
[1]375#else
[22802]376# define VMMRCDECL(type) DECL_INVALID(type)
[1]377#endif
378
[19287]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)
[22802]384# define VMMRZDECL(type) DECLEXPORT(type) VBOXCALL
385#elif defined(IN_RING0) || defined(IN_RZ)
386# define VMMRZDECL(type) DECLIMPORT(type) VBOXCALL
[19287]387#else
[22802]388# define VMMRZDECL(type) DECL_INVALID(type)
[19287]389#endif
390
[12989]391/** @def VMMDECL
392 * VMM export or import declaration.
[1]393 * @param type The return type of the function declaration.
394 */
[24577]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)
[22802]398# define VMMDECL(type) DECLEXPORT(type) VBOXCALL
[1]399#else
[22802]400# define VMMDECL(type) DECLIMPORT(type) VBOXCALL
[1]401#endif
402
[22802]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
[1]412
[22802]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
[1]422
[22802]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 */
[44405]447#if defined(IN_VMM_RC) || defined(IN_VMM_R0)
[22802]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
[1566]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
[31508]463# ifdef IN_VBOXDDU_STATIC
464# define VBOXDDU_DECL(type) type
465# else
466# define VBOXDDU_DECL(type) DECLEXPORT(type) VBOXCALL
467# endif
[1566]468#else
469# define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL
470#endif
[1]471
[58111]472/** @} */
[1566]473
[58111]474
475/** @defgroup grp_devdrv Device Emulations and Drivers
476 * @{ */
477/** @} */
478
[6475]479#endif
[1]480
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use