VirtualBox

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

Last change on this file since 52664 was 49893, checked in by vboxsync, 11 years ago

MSR rewrite: initial hacking - half disabled.

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

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use