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 |
|
---|
57 | AssertCompileSize(RTHCPTR, 8);
|
---|
58 | AssertCompileSize(RTHCINT, 4);
|
---|
59 | AssertCompileSize(RTHCUINT, 4);
|
---|
60 | AssertCompileSize(RTHCINTPTR, 8);
|
---|
61 | AssertCompileSize(RTHCUINTPTR, 8);
|
---|
62 | /*AssertCompileSize(RTHCINTREG, 8);*/
|
---|
63 | AssertCompileSize(RTHCUINTREG, 8);
|
---|
64 | AssertCompileSize(RTR0PTR, 8);
|
---|
65 | /*AssertCompileSize(RTR0INT, 4);*/
|
---|
66 | /*AssertCompileSize(RTR0UINT, 4);*/
|
---|
67 | AssertCompileSize(RTR0INTPTR, 8);
|
---|
68 | AssertCompileSize(RTR0UINTPTR, 8);
|
---|
69 | /*AssertCompileSize(RTR3PTR, 8);*/
|
---|
70 | /*AssertCompileSize(RTR3INT, 4);*/
|
---|
71 | /*AssertCompileSize(RTR3UINT, 4);*/
|
---|
72 | AssertCompileSize(RTR3INTPTR, 8);
|
---|
73 | AssertCompileSize(RTR3UINTPTR, 8);
|
---|
74 | AssertCompileSize(RTUINTPTR, 8);
|
---|
75 |
|
---|
76 | # if defined(IN_RING3) || defined(IN_RING0)
|
---|
77 | /*AssertCompileSize(RTCCINTREG, 8);*/
|
---|
78 | AssertCompileSize(RTCCUINTREG, 8);
|
---|
79 | # endif
|
---|
80 |
|
---|
81 | #else
|
---|
82 |
|
---|
83 | AssertCompileSize(RTHCPTR, 4);
|
---|
84 | AssertCompileSize(RTHCINT, 4);
|
---|
85 | AssertCompileSize(RTHCUINT, 4);
|
---|
86 | /*AssertCompileSize(RTHCINTPTR, 4);*/
|
---|
87 | AssertCompileSize(RTHCUINTPTR, 4);
|
---|
88 | AssertCompileSize(RTR0PTR, 4);
|
---|
89 | /*AssertCompileSize(RTR0INT, 4);*/
|
---|
90 | /*AssertCompileSize(RTR0UINT, 4);*/
|
---|
91 | AssertCompileSize(RTR0INTPTR, 4);
|
---|
92 | AssertCompileSize(RTR0UINTPTR, 4);
|
---|
93 | /*AssertCompileSize(RTR3PTR, 4);*/
|
---|
94 | /*AssertCompileSize(RTR3INT, 4);*/
|
---|
95 | /*AssertCompileSize(RTR3UINT, 4);*/
|
---|
96 | AssertCompileSize(RTR3INTPTR, 4);
|
---|
97 | AssertCompileSize(RTR3UINTPTR, 4);
|
---|
98 | # if GC_ARCH_BITS == 64
|
---|
99 | AssertCompileSize(RTUINTPTR, 8);
|
---|
100 | # else
|
---|
101 | AssertCompileSize(RTUINTPTR, 4);
|
---|
102 | # endif
|
---|
103 |
|
---|
104 | # if defined(IN_RING3) || defined(IN_RING0)
|
---|
105 | /*AssertCompileSize(RTCCINTREG, 4);*/
|
---|
106 | AssertCompileSize(RTCCUINTREG, 4);
|
---|
107 | # endif
|
---|
108 |
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | AssertCompileSize(RTHCPHYS, 8);
|
---|
112 |
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * Check basic guest context types.
|
---|
116 | */
|
---|
117 | #if GC_ARCH_BITS == 64
|
---|
118 |
|
---|
119 | AssertCompileSize(RTGCINT, 4);
|
---|
120 | AssertCompileSize(RTGCUINT, 4);
|
---|
121 | AssertCompileSize(RTGCINTPTR, 8);
|
---|
122 | AssertCompileSize(RTGCUINTPTR, 8);
|
---|
123 | /*AssertCompileSize(RTGCINTREG, 8);*/
|
---|
124 | AssertCompileSize(RTGCUINTREG, 8);
|
---|
125 |
|
---|
126 | # ifdef IN_GC
|
---|
127 | /*AssertCompileSize(RTCCINTREG, 8);*/
|
---|
128 | AssertCompileSize(RTCCUINTREG, 8);
|
---|
129 | # endif
|
---|
130 |
|
---|
131 | #else
|
---|
132 |
|
---|
133 | AssertCompileSize(RTGCINT, 4);
|
---|
134 | AssertCompileSize(RTGCUINT, 4);
|
---|
135 | AssertCompileSize(RTGCINTPTR, 4);
|
---|
136 | AssertCompileSize(RTGCUINTPTR, 4);
|
---|
137 | /*AssertCompileSize(RTGCINTREG, 4);*/
|
---|
138 | AssertCompileSize(RTGCUINTREG, 4);
|
---|
139 |
|
---|
140 | # ifdef IN_GC
|
---|
141 | /*AssertCompileSize(RTCCINTREG, 4);*/
|
---|
142 | AssertCompileSize(RTCCUINTREG, 4);
|
---|
143 | # endif
|
---|
144 |
|
---|
145 | #endif
|
---|
146 |
|
---|
147 | AssertCompileSize(RTGCPHYS, 4);
|
---|
148 |
|
---|
149 |
|
---|
150 | /*
|
---|
151 | * Check basic current context types.
|
---|
152 | */
|
---|
153 | #if ARCH_BITS == 64
|
---|
154 |
|
---|
155 | AssertCompileSize(void *, 8);
|
---|
156 |
|
---|
157 | #else
|
---|
158 |
|
---|
159 | AssertCompileSize(void *, 4);
|
---|
160 |
|
---|
161 | #endif
|
---|