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