sanity.h revision 25dfdfe9b04080a0c85a6f6aadf0d4efc903e122
/* $Id$ */
/** @file
* IPRT - Setup Sanity Checks, C and C++.
*/
/*
* Copyright (C) 2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*
* Check that the IN_[RING3|RING0|GC] and [|R3_|R0_|GC_]ARCH_BITS
* match up correctly.
*
* IPRT assumes r0 and r3 to has the same bit count.
*/
# error "defined(IN_RING3) && ARCH_BITS != R3_ARCH_BITS"
#endif
# error "defined(IN_RING0) && ARCH_BITS != R0_ARCH_BITS"
#endif
# error "defined(IN_RC) && ARCH_BITS != 32"
#endif
# error "(defined(IN_RING0) || defined(IN_RING3)) && HC_ARCH_BITS != ARCH_BITS"
#endif
# error "defined(IN_RC) && GC_ARCH_BITS != ARCH_BITS"
#endif
/*
*/
#if HC_ARCH_BITS == 64
/*AssertCompileSize(RTHCINTREG, 8);*/
/*AssertCompileSize(RTR0INT, 4);*/
/*AssertCompileSize(RTR0UINT, 4);*/
/*AssertCompileSize(RTR3PTR, 8);*/
/*AssertCompileSize(RTR3INT, 4);*/
/*AssertCompileSize(RTR3UINT, 4);*/
/*AssertCompileSize(RTCCINTREG, 8);*/
# endif
#else
/*AssertCompileSize(RTHCINTPTR, 4);*/
/*AssertCompileSize(RTR0INT, 4);*/
/*AssertCompileSize(RTR0UINT, 4);*/
/*AssertCompileSize(RTR3PTR, 4);*/
/*AssertCompileSize(RTR3INT, 4);*/
/*AssertCompileSize(RTR3UINT, 4);*/
# if GC_ARCH_BITS == 64
# else
# endif
/*AssertCompileSize(RTCCINTREG, 4);*/
# endif
#endif
/*
* Check basic guest context types.
*/
#if GC_ARCH_BITS == 64
/*AssertCompileSize(RTGCINTREG, 8);*/
# ifdef IN_RC
/*AssertCompileSize(RTCCINTREG, 8);*/
/* Hack alert: there is no such thing as a GC context when GC_ARCH_BITS == 64; it's still 32 bits */
# endif
#else
/*AssertCompileSize(RTGCINTREG, 4);*/
# ifdef IN_RC
/*AssertCompileSize(RTCCINTREG, 4);*/
# endif
#endif
/*
* Check basic current context types.
*/
#if ARCH_BITS == 64
AssertCompileSize(void *, 8);
#else
AssertCompileSize(void *, 4);
#endif
/*
* Standard sized types.
*/
#define TEST_CONST_MACRO(c,t) \
AssertCompile(sizeof(c) == sizeof(t) || (sizeof(c) == sizeof(int) && sizeof(t) < sizeof(int)) )