VirtualBox

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

Last change on this file since 1223 was 888, checked in by vboxsync, 18 years ago

killed warnings.

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