tstDeviceStructSize.cpp revision c58f1213e628a545081c70e26c6b67a841cff880
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * tstDeviceStructSize - testcase for check structure sizes/alignment
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * and to verify that HC and RC uses the same
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * representation of the structures.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Copyright (C) 2006-2012 Oracle Corporation
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * General Public License (GPL) as published by the Free Software
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*******************************************************************************
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* Header Files *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync*******************************************************************************/
#include "../Bus/DevPCI.cpp"
#include "../Bus/DevPciIch9.cpp"
#include "../Graphics/DevVGA.cpp"
#include "../Input/DevPS2.cpp"
#ifdef VBOX_WITH_E1000
# include "../Network/DevE1000.cpp"
#include "../Network/DevPCNet.cpp"
#ifdef VBOX_WITH_VIRTIO
# include "../Network/DevVirtioNet.cpp"
#include "../PC/DevACPI.cpp"
#include "../PC/DevPIC.cpp"
#include "../PC/DevPit-i8254.cpp"
#include "../PC/DevRTC.cpp"
#include "../PC/DevAPIC.cpp"
#include "../PC/DevIoApic.cpp"
#include "../PC/DevHPET.cpp"
#include "../PC/DevLPC.cpp"
#include "../PC/DevSMC.cpp"
#include "../Storage/DevATA.cpp"
#ifdef VBOX_WITH_USB
# include "../USB/DevOHCI.cpp"
# ifdef VBOX_WITH_EHCI_IMPL
# include "../USB/DevEHCI.cpp"
#include "../VMMDev/VMMDev.cpp"
#include "../Parallel/DevParallel.cpp"
#include "../Serial/DevSerial.cpp"
#ifdef VBOX_WITH_AHCI
# include "../Storage/DevAHCI.cpp"
#ifdef VBOX_WITH_BUSLOGIC
# include "../Storage/DevBusLogic.cpp"
#ifdef VBOX_WITH_LSILOGIC
# include "../Storage/DevLsiLogicSCSI.cpp"
# include "../Bus/DevPciRaw.cpp"
#include <stdio.h>
printf("tstDeviceStructSize: error! %#010x %s Off by %d!! (off=%#x)\n", RT_OFFSETOF(type, m), #type "." #m, off - RT_OFFSETOF(type, m), off); \
rc++; \
printf("tstDeviceStructSize: error! sizeof(%s): %#x (%d) Off by %d!!\n", #type, (int)sizeof(type), (int)sizeof(type), (int)(sizeof(type) - size)); \
rc++; \
printf("tstDeviceStructSize: info: sizeof(%s): %#x (%d)\n", #type, (int)sizeof(type), (int)sizeof(type)); \
printf("tstDeviceStructSize: error! %s::%s offset=%#x (%u) expected alignment %x, meaning %#x (%u) off\n", \
(unsigned)(align), \
rc++; \
#type, \
(unsigned)sizeof(type), \
(unsigned)sizeof(type), \
(align), \
rc++; \
printf("tstDeviceStructSize: error! padding of %s::%s is too small, padding=%d struct=%d correct=%d\n", #strct, #member, \
(int)sizeof(p->member.padding), (int)sizeof(p->member.s), (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
rc++; \
printf("tstDeviceStructSize: error! padding of %s::%s is misaligned, padding=%d correct=%d\n", #strct, #member, \
rc++; \
if (sizeof(p->s) > sizeof(p->padding)) \
printf("tstDeviceStructSize: error! padding of %s is too small, padding=%d struct=%d correct=%d\n", #strct, \
rc++; \
printf("tstDeviceStructSize: error! padding of %s::%s is too small, padding=%d struct=%d\n", #strct, #member, \
rc++; \
printf("tstDeviceStructSize: info: %s::%s offset %d sizeof %d\n", #strct, #member, (int)RT_OFFSETOF(strct, member), (int)RT_SIZEOFMEMB(strct, member)); \
int main()
int rc = 0;
#ifdef VBOX_WITH_STATISTICS
#ifdef VBOX_WITH_STATISTICS
#ifdef VBOX_WITH_E1000
#ifdef VBOX_WITH_VIRTIO
#ifdef VBOX_WITH_USB
# ifdef VBOX_WITH_EHCI_IMPL
# ifdef VBOX_WITH_STATISTICS
#ifdef VBOX_WITH_STATISTICS
#ifdef VBOX_WITH_USB
# ifdef VBOX_WITH_STATISTICS
#ifdef VBOX_WITH_STATISTICS
#ifdef VBOX_WITH_VIRTIO
#ifdef VBOX_WITH_RAW_MODE
# include "tstDeviceStructSizeRC.h"
if (rc)
return rc;