VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

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