VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/misc/sanity.h@ 8170

Last change on this file since 8170 was 8170, checked in by vboxsync, 17 years ago

Rebranding: replacing more innotek strings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1/* $Id: sanity.h 8170 2008-04-18 17:52:25Z vboxsync $ */
2/** @file
3 * Incredibly Portable Runtime - Setup Sanity Checks, C and C++.
4 */
5
6/*
7 * Copyright (C) 2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 *
26 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#include <iprt/cdefs.h>
32#include <iprt/types.h>
33#include <iprt/assert.h>
34
35/*
36 * Check that the IN_[RING3|RING0|GC] and [|R3_|R0_|GC_]ARCH_BITS
37 * match up correctly.
38 *
39 * IPRT assumes r0 and r3 to has the same bit count.
40 */
41
42#if defined(IN_RING3) && ARCH_BITS != R3_ARCH_BITS
43# error "defined(IN_RING3) && ARCH_BITS != R3_ARCH_BITS"
44#endif
45#if defined(IN_RING0) && ARCH_BITS != R0_ARCH_BITS
46# error "defined(IN_RING0) && ARCH_BITS != R0_ARCH_BITS"
47#endif
48#if defined(IN_GC) && ARCH_BITS != GC_ARCH_BITS
49# error "defined(IN_GC) && ARCH_BITS != GC_ARCH_BITS"
50#endif
51#if (defined(IN_RING0) || defined(IN_RING3)) && HC_ARCH_BITS != ARCH_BITS
52# error "(defined(IN_RING0) || defined(IN_RING3)) && HC_ARCH_BITS != ARCH_BITS"
53#endif
54#if defined(IN_GC) && GC_ARCH_BITS != ARCH_BITS
55# error "defined(IN_GC) && GC_ARCH_BITS != ARCH_BITS"
56#endif
57
58
59/*
60 * Check basic host (hc/r0/r3) types.
61 */
62#if HC_ARCH_BITS == 64
63
64AssertCompileSize(RTHCPTR, 8);
65AssertCompileSize(RTHCINT, 4);
66AssertCompileSize(RTHCUINT, 4);
67AssertCompileSize(RTHCINTPTR, 8);
68AssertCompileSize(RTHCUINTPTR, 8);
69/*AssertCompileSize(RTHCINTREG, 8);*/
70AssertCompileSize(RTHCUINTREG, 8);
71AssertCompileSize(RTR0PTR, 8);
72/*AssertCompileSize(RTR0INT, 4);*/
73/*AssertCompileSize(RTR0UINT, 4);*/
74AssertCompileSize(RTR0INTPTR, 8);
75AssertCompileSize(RTR0UINTPTR, 8);
76/*AssertCompileSize(RTR3PTR, 8);*/
77/*AssertCompileSize(RTR3INT, 4);*/
78/*AssertCompileSize(RTR3UINT, 4);*/
79AssertCompileSize(RTR3INTPTR, 8);
80AssertCompileSize(RTR3UINTPTR, 8);
81AssertCompileSize(RTUINTPTR, 8);
82
83# if defined(IN_RING3) || defined(IN_RING0)
84/*AssertCompileSize(RTCCINTREG, 8);*/
85AssertCompileSize(RTCCUINTREG, 8);
86# endif
87
88#else
89
90AssertCompileSize(RTHCPTR, 4);
91AssertCompileSize(RTHCINT, 4);
92AssertCompileSize(RTHCUINT, 4);
93/*AssertCompileSize(RTHCINTPTR, 4);*/
94AssertCompileSize(RTHCUINTPTR, 4);
95AssertCompileSize(RTR0PTR, 4);
96/*AssertCompileSize(RTR0INT, 4);*/
97/*AssertCompileSize(RTR0UINT, 4);*/
98AssertCompileSize(RTR0INTPTR, 4);
99AssertCompileSize(RTR0UINTPTR, 4);
100/*AssertCompileSize(RTR3PTR, 4);*/
101/*AssertCompileSize(RTR3INT, 4);*/
102/*AssertCompileSize(RTR3UINT, 4);*/
103AssertCompileSize(RTR3INTPTR, 4);
104AssertCompileSize(RTR3UINTPTR, 4);
105# if GC_ARCH_BITS == 64
106AssertCompileSize(RTUINTPTR, 8);
107# else
108AssertCompileSize(RTUINTPTR, 4);
109# endif
110
111# if defined(IN_RING3) || defined(IN_RING0)
112/*AssertCompileSize(RTCCINTREG, 4);*/
113AssertCompileSize(RTCCUINTREG, 4);
114# endif
115
116#endif
117
118AssertCompileSize(RTHCPHYS, 8);
119
120
121/*
122 * Check basic guest context types.
123 */
124#if GC_ARCH_BITS == 64
125
126AssertCompileSize(RTGCINT, 4);
127AssertCompileSize(RTGCUINT, 4);
128AssertCompileSize(RTGCINTPTR, 8);
129AssertCompileSize(RTGCUINTPTR, 8);
130/*AssertCompileSize(RTGCINTREG, 8);*/
131AssertCompileSize(RTGCUINTREG, 8);
132
133# ifdef IN_GC
134/*AssertCompileSize(RTCCINTREG, 8);*/
135AssertCompileSize(RTCCUINTREG, 8);
136# endif
137
138#else
139
140AssertCompileSize(RTGCINT, 4);
141AssertCompileSize(RTGCUINT, 4);
142AssertCompileSize(RTGCINTPTR, 4);
143AssertCompileSize(RTGCUINTPTR, 4);
144/*AssertCompileSize(RTGCINTREG, 4);*/
145AssertCompileSize(RTGCUINTREG, 4);
146
147# ifdef IN_GC
148/*AssertCompileSize(RTCCINTREG, 4);*/
149AssertCompileSize(RTCCUINTREG, 4);
150# endif
151
152#endif
153
154AssertCompileSize(RTGCPHYS64, 8);
155AssertCompileSize(RTGCPHYS32, 4);
156AssertCompileSize(RTGCPHYS, 8);
157
158
159/*
160 * Check basic current context types.
161 */
162#if ARCH_BITS == 64
163
164AssertCompileSize(void *, 8);
165
166#else
167
168AssertCompileSize(void *, 4);
169
170#endif
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