1 | /** @file
|
---|
2 | * VirtualBox - Common C and C++ definition.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
27 | * additional information or have any questions.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___VBox_cdefs_h
|
---|
31 | #define ___VBox_cdefs_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
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 |
|
---|
56 | /*
|
---|
57 | * Shut up DOXYGEN warnings and guide it properly thru the code.
|
---|
58 | */
|
---|
59 | #ifdef DOXYGEN_RUNNING
|
---|
60 | #define VBOX_WITH_STATISTICS
|
---|
61 | #define VBOX_STRICT
|
---|
62 | #define IN_DBG
|
---|
63 | #define IN_DIS
|
---|
64 | #define IN_INTNET_R0
|
---|
65 | #define IN_INTNET_R3
|
---|
66 | #define IN_REM_R3
|
---|
67 | #define IN_SUP_R0
|
---|
68 | #define IN_SUP_R3
|
---|
69 | #define IN_SUP_RC
|
---|
70 | #define IN_SUP_STATIC
|
---|
71 | #define IN_USBLIB
|
---|
72 | #define IN_VBOXDDU
|
---|
73 | #define IN_VMM_RC
|
---|
74 | #define IN_VMM_R0
|
---|
75 | #define IN_VMM_R3
|
---|
76 | #define IN_VMM_STATIC
|
---|
77 | #endif
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 |
|
---|
82 | /** @def VBOXCALL
|
---|
83 | * The standard calling convention for VBOX interfaces.
|
---|
84 | */
|
---|
85 | #define VBOXCALL RTCALL
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 | /** @def IN_DIS
|
---|
90 | * Used to indicate whether we're inside the same link module as the
|
---|
91 | * disassembler.
|
---|
92 | */
|
---|
93 | /** @def DISDECL(type)
|
---|
94 | * Disassembly export or import declaration.
|
---|
95 | * @param type The return type of the function declaration.
|
---|
96 | */
|
---|
97 | #if defined(IN_DIS)
|
---|
98 | # define DISDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
99 | #else
|
---|
100 | # define DISDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
101 | #endif
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 | /** @def IN_DBG
|
---|
106 | * Used to indicate whether we're inside the same link module as the debugger
|
---|
107 | * console, gui, and related things (ring-3).
|
---|
108 | */
|
---|
109 | /** @def DBGDECL(type)
|
---|
110 | * Debugger module export or import declaration.
|
---|
111 | * Functions declared using this exists only in R3 since the
|
---|
112 | * debugger modules is R3 only.
|
---|
113 | * @param type The return type of the function declaration.
|
---|
114 | */
|
---|
115 | #if defined(IN_DBG_R3) || defined(IN_DBG)
|
---|
116 | # define DBGDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
117 | #else
|
---|
118 | # define DBGDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
119 | #endif
|
---|
120 |
|
---|
121 |
|
---|
122 |
|
---|
123 | /** @def IN_INTNET_R3
|
---|
124 | * Used to indicate whether we're inside the same link module as the Ring-3
|
---|
125 | * Internal Networking Service.
|
---|
126 | */
|
---|
127 | /** @def INTNETR3DECL(type)
|
---|
128 | * Internal Networking Service export or import declaration.
|
---|
129 | * @param type The return type of the function declaration.
|
---|
130 | */
|
---|
131 | #ifdef IN_INTNET_R3
|
---|
132 | # define INTNETR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
133 | #else
|
---|
134 | # define INTNETR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | /** @def IN_INTNET_R0
|
---|
138 | * Used to indicate whether we're inside the same link module as the R0
|
---|
139 | * Internal Network Service.
|
---|
140 | */
|
---|
141 | /** @def INTNETR0DECL(type)
|
---|
142 | * Internal Networking Service export or import declaration.
|
---|
143 | * @param type The return type of the function declaration.
|
---|
144 | */
|
---|
145 | #ifdef IN_INTNET_R0
|
---|
146 | # define INTNETR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
147 | #else
|
---|
148 | # define INTNETR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
149 | #endif
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 | /** @def IN_REM_R3
|
---|
154 | * Used to indicate whether we're inside the same link module as
|
---|
155 | * the HC Ring-3 Recompiled Execution Manager.
|
---|
156 | */
|
---|
157 | /** @def REMR3DECL(type)
|
---|
158 | * Recompiled Execution Manager HC Ring-3 export or import declaration.
|
---|
159 | * @param type The return type of the function declaration.
|
---|
160 | */
|
---|
161 | #ifdef IN_REM_R3
|
---|
162 | # define REMR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
163 | #else
|
---|
164 | # define REMR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
165 | #endif
|
---|
166 |
|
---|
167 |
|
---|
168 |
|
---|
169 | /** @def IN_SUP_R3
|
---|
170 | * Used to indicate whether we're inside the same link module as the Ring-3
|
---|
171 | * Support Library or not.
|
---|
172 | */
|
---|
173 | /** @def SUPR3DECL(type)
|
---|
174 | * Support library export or import declaration.
|
---|
175 | * @param type The return type of the function declaration.
|
---|
176 | */
|
---|
177 | #ifdef IN_SUP_R3
|
---|
178 | # define SUPR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
179 | #else
|
---|
180 | # define SUPR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
181 | #endif
|
---|
182 |
|
---|
183 | /** @def IN_SUP_R0
|
---|
184 | * Used to indicate whether we're inside the same link module as the Ring-0
|
---|
185 | * Support Library or not.
|
---|
186 | */
|
---|
187 | /** @def IN_SUP_STATIC
|
---|
188 | * Used to indicate that the Support Library is built or used as a static
|
---|
189 | * library.
|
---|
190 | */
|
---|
191 | /** @def SUPR0DECL(type)
|
---|
192 | * Support library export or import declaration.
|
---|
193 | * @param type The return type of the function declaration.
|
---|
194 | */
|
---|
195 | #ifdef IN_SUP_R0
|
---|
196 | # ifdef IN_SUP_STATIC
|
---|
197 | # define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
198 | # else
|
---|
199 | # define SUPR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
200 | # endif
|
---|
201 | #else
|
---|
202 | # ifdef IN_SUP_STATIC
|
---|
203 | # define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
204 | # else
|
---|
205 | # define SUPR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
206 | # endif
|
---|
207 | #endif
|
---|
208 |
|
---|
209 | /** @def IN_SUP_RC
|
---|
210 | * Used to indicate whether we're inside the same link module as the RC Support
|
---|
211 | * Library or not.
|
---|
212 | */
|
---|
213 | /** @def SUPRCDECL(type)
|
---|
214 | * Support library export or import declaration.
|
---|
215 | * @param type The return type of the function declaration.
|
---|
216 | */
|
---|
217 | #ifdef IN_SUP_RC
|
---|
218 | # define SUPRCDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
219 | #else
|
---|
220 | # define SUPRCDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
221 | #endif
|
---|
222 |
|
---|
223 | /** @def IN_SUP_R0
|
---|
224 | * Used to indicate whether we're inside the same link module as the Ring-0
|
---|
225 | * Support Library or not.
|
---|
226 | */
|
---|
227 | /** @def SUPR0DECL(type)
|
---|
228 | * Support library export or import declaration.
|
---|
229 | * @param type The return type of the function declaration.
|
---|
230 | */
|
---|
231 | #if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
|
---|
232 | # define SUPDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
233 | #else
|
---|
234 | # define SUPDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
235 | #endif
|
---|
236 |
|
---|
237 |
|
---|
238 |
|
---|
239 | /** @def IN_USBLIB
|
---|
240 | * Used to indicate whether we're inside the same link module as the USBLib.
|
---|
241 | */
|
---|
242 | /** @def USBLIB_DECL
|
---|
243 | * USBLIB export or import declaration.
|
---|
244 | * @param type The return type of the function declaration.
|
---|
245 | */
|
---|
246 | #ifdef IN_RING0
|
---|
247 | # define USBLIB_DECL(type) type VBOXCALL
|
---|
248 | #elif defined(IN_USBLIB)
|
---|
249 | # define USBLIB_DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
250 | #else
|
---|
251 | # define USBLIB_DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
252 | #endif
|
---|
253 |
|
---|
254 |
|
---|
255 |
|
---|
256 | /** @def IN_VMM_STATIC
|
---|
257 | * Used to indicate that the virtual machine monitor is built or used as a
|
---|
258 | * static library.
|
---|
259 | */
|
---|
260 | /** @def IN_VMM_R3
|
---|
261 | * Used to indicate whether we're inside the same link module as the ring 3 part of the
|
---|
262 | * virtual machine monitor or not.
|
---|
263 | */
|
---|
264 | /** @def VMMR3DECL
|
---|
265 | * Ring-3 VMM export or import declaration.
|
---|
266 | * @param type The return type of the function declaration.
|
---|
267 | */
|
---|
268 | #ifdef IN_VMM_R3
|
---|
269 | # ifdef IN_VMM_STATIC
|
---|
270 | # define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
271 | # else
|
---|
272 | # define VMMR3DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
273 | # endif
|
---|
274 | #elif defined(IN_RING3)
|
---|
275 | # ifdef IN_VMM_STATIC
|
---|
276 | # define VMMR3DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
277 | # else
|
---|
278 | # define VMMR3DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
279 | # endif
|
---|
280 | #else
|
---|
281 | # define VMMR3DECL(type) DECL_INVALID(type)
|
---|
282 | #endif
|
---|
283 |
|
---|
284 | /** @def IN_VMM_R0
|
---|
285 | * Used to indicate whether we're inside the same link module as the ring-0 part
|
---|
286 | * of the virtual machine monitor or not.
|
---|
287 | */
|
---|
288 | /** @def VMMR0DECL
|
---|
289 | * Ring-0 VMM export or import declaration.
|
---|
290 | * @param type The return type of the function declaration.
|
---|
291 | */
|
---|
292 | #ifdef IN_VMM_R0
|
---|
293 | # define VMMR0DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
294 | #elif defined(IN_RING0)
|
---|
295 | # define VMMR0DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
296 | #else
|
---|
297 | # define VMMR0DECL(type) DECL_INVALID(type)
|
---|
298 | #endif
|
---|
299 |
|
---|
300 | /** @def IN_VMM_RC
|
---|
301 | * Used to indicate whether we're inside the same link module as the raw-mode
|
---|
302 | * context part of the virtual machine monitor or not.
|
---|
303 | */
|
---|
304 | /** @def VMMRCDECL
|
---|
305 | * Raw-mode context VMM export or import declaration.
|
---|
306 | * @param type The return type of the function declaration.
|
---|
307 | */
|
---|
308 | #ifdef IN_VMM_RC
|
---|
309 | # define VMMRCDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
310 | #elif defined(IN_RC)
|
---|
311 | # define VMMRCDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
312 | #else
|
---|
313 | # define VMMRCDECL(type) DECL_INVALID(type)
|
---|
314 | #endif
|
---|
315 |
|
---|
316 | /** @def VMMRZDECL
|
---|
317 | * Ring-0 and Raw-mode context VMM export or import declaration.
|
---|
318 | * @param type The return type of the function declaration.
|
---|
319 | */
|
---|
320 | #if defined(IN_VMM_R0) || defined(IN_VMM_RC)
|
---|
321 | # define VMMRZDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
322 | #elif defined(IN_RING0) || defined(IN_RZ)
|
---|
323 | # define VMMRZDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
324 | #else
|
---|
325 | # define VMMRZDECL(type) DECL_INVALID(type)
|
---|
326 | #endif
|
---|
327 |
|
---|
328 | /** @def VMMDECL
|
---|
329 | * VMM export or import declaration.
|
---|
330 | * @param type The return type of the function declaration.
|
---|
331 | */
|
---|
332 | #ifdef IN_VMM_STATIC
|
---|
333 | # define VMMDECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
334 | #elif defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
|
---|
335 | # define VMMDECL(type) DECLEXPORT(type) VBOXCALL
|
---|
336 | #else
|
---|
337 | # define VMMDECL(type) DECLIMPORT(type) VBOXCALL
|
---|
338 | #endif
|
---|
339 |
|
---|
340 | /** @def VMM_INT_DECL
|
---|
341 | * VMM internal function.
|
---|
342 | * @param type The return type of the function declaration.
|
---|
343 | */
|
---|
344 | #if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
|
---|
345 | # define VMM_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
346 | #else
|
---|
347 | # define VMM_INT_DECL(type) DECL_INVALID(type)
|
---|
348 | #endif
|
---|
349 |
|
---|
350 | /** @def VMMR3_INT_DECL
|
---|
351 | * VMM internal function, ring-3.
|
---|
352 | * @param type The return type of the function declaration.
|
---|
353 | */
|
---|
354 | #ifdef IN_VMM_R3
|
---|
355 | # define VMMR3_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
356 | #else
|
---|
357 | # define VMMR3_INT_DECL(type) DECL_INVALID(type)
|
---|
358 | #endif
|
---|
359 |
|
---|
360 | /** @def VMMR0_INT_DECL
|
---|
361 | * VMM internal function, ring-0.
|
---|
362 | * @param type The return type of the function declaration.
|
---|
363 | */
|
---|
364 | #ifdef IN_VMM_R0
|
---|
365 | # define VMMR0_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
366 | #else
|
---|
367 | # define VMMR0_INT_DECL(type) DECL_INVALID(type)
|
---|
368 | #endif
|
---|
369 |
|
---|
370 | /** @def VMMRC_INT_DECL
|
---|
371 | * VMM internal function, raw-mode context.
|
---|
372 | * @param type The return type of the function declaration.
|
---|
373 | */
|
---|
374 | #ifdef IN_VMM_RC
|
---|
375 | # define VMMRC_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
376 | #else
|
---|
377 | # define VMMRC_INT_DECL(type) DECL_INVALID(type)
|
---|
378 | #endif
|
---|
379 |
|
---|
380 | /** @def VMMRZ_INT_DECL
|
---|
381 | * VMM internal function, ring-0 + raw-mode context.
|
---|
382 | * @param type The return type of the function declaration.
|
---|
383 | */
|
---|
384 | #ifdef IN_VMM_RZ
|
---|
385 | # define VMMRZ_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
|
---|
386 | #else
|
---|
387 | # define VMMRZ_INT_DECL(type) DECL_INVALID(type)
|
---|
388 | #endif
|
---|
389 |
|
---|
390 |
|
---|
391 |
|
---|
392 | /** @def IN_VBOXDDU
|
---|
393 | * Used to indicate whether we're inside the VBoxDDU shared object.
|
---|
394 | */
|
---|
395 | /** @def VBOXDDU_DECL(type)
|
---|
396 | * VBoxDDU export or import (ring-3).
|
---|
397 | * @param type The return type of the function declaration.
|
---|
398 | */
|
---|
399 | #ifdef IN_VBOXDDU
|
---|
400 | # define VBOXDDU_DECL(type) DECLEXPORT(type) VBOXCALL
|
---|
401 | #else
|
---|
402 | # define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL
|
---|
403 | #endif
|
---|
404 |
|
---|
405 |
|
---|
406 | #endif
|
---|
407 |
|
---|