tstDeviceStructSize.cpp revision 3f72ab7ee9d1539bfa4ed19972430194627b9273
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/* $Id$ */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/** @file
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * tstDeviceStructSize - testcase for check structure sizes/alignment
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * and to verify that HC and GC uses the same
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * representation of the structures.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (C) 2006-2007 Sun Microsystems, Inc.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This file is part of VirtualBox Open Source Edition (OSE), as
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * available from http://www.virtualbox.org. This file is free software;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * you can redistribute it and/or modify it under the terms of the GNU
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * General Public License (GPL) as published by the Free Software
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Foundation, in version 2 as it comes in the "COPYING" file of the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Clara, CA 95054 USA or visit http://www.sun.com if you need
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * additional information or have any questions.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*******************************************************************************
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar* Header Files *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar*******************************************************************************/
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <VBox/types.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <VBox/x86.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define VBOX_DEVICE_STRUCT_TESTCASE
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../Bus/DevPCI.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../Graphics/DevVGA.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../Input/DevPS2.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../Network/DevPCNet.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../PC/DevACPI.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../PC/DevPIC.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../PC/DevPit-i8254.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../PC/DevRTC.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung#include "../PC/DevAPIC.cpp"
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung#undef LOG_GROUP
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung#include "../Storage/DevATA.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef VBOX_WITH_USB
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# include "../USB/DevOHCI.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# include "../USB/DevEHCI.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../VMMDev/VBoxDev.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../Parallel/DevParallel.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "../Serial/DevSerial.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef VBOX_WITH_AHCI
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# include "../Storage/DevAHCI.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef VBOX_WITH_E1000
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# include "../Network/DevE1000.cpp"
a307732568c3d861c38b0342ae32434226d10e94Pramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef VBOX_WITH_BUSLOGIC
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# undef LOG_GROUP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# include "../Storage/DevBusLogic.cpp"
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <stdio.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*******************************************************************************
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar* Defined Constants And Macros *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar*******************************************************************************/
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks the offset of a data member.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @param type Type.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @param off Correct offset.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @param m Member name.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_OFF(type, off, m) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (off != RT_OFFSETOF(type, m)) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("%#010x %s Off by %d!! (off=%#x)\n", RT_OFFSETOF(type, m), #type "." #m, off - RT_OFFSETOF(type, m), off); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /*else */ \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /*printf("%#08x %s\n", RT_OFFSETOF(type, m), #m);*/ \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks the size of type.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @param type Type.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @param size Correct size.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_SIZE(type, size) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (size != sizeof(type)) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("sizeof(%s): %#x (%d) Off by %d!!\n", #type, (int)sizeof(type), (int)sizeof(type), (int)(sizeof(type) - size)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar else \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("sizeof(%s): %#x (%d)\n", #type, (int)sizeof(type), (int)sizeof(type)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks the alignment of a struct member.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_MEMBER_ALIGNMENT(strct, member, align) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if ( RT_OFFSETOF(strct, member) & ((align) - 1) ) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("%s::%s offset=%d expected alignment %d, meaning %d off\n", #strct, #member, RT_OFFSETOF(strct, member), \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar align, RT_OFFSETOF(strct, member) & (align - 1)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks that the size of a type is aligned correctly.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_SIZE_ALIGNMENT(type, align) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (RT_ALIGN_Z(sizeof(type), (align)) != sizeof(type)) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("%s size=%#x, align=%#x %#x bytes off\n", #type, (int)sizeof(type), (align), (int)RT_ALIGN_Z(sizeof(type), align) - (int)sizeof(type)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks that a internal struct padding is big enough.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_PADDING(strct, member) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar strct *p; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (sizeof(p->member.s) > sizeof(p->member.padding)) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("padding of %s::%s is too small, padding=%d struct=%d correct=%d\n", #strct, #member, \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar (int)sizeof(p->member.padding), (int)sizeof(p->member.s), (int)RT_ALIGN_Z(sizeof(p->member.s), 32)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks that a internal struct padding is big enough.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_PADDING2(strct) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar strct *p; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (sizeof(p->s) > sizeof(p->padding)) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("padding of %s is too small, padding=%d struct=%d correct=%d\n", #strct, \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar (int)sizeof(p->padding), (int)sizeof(p->s), (int)RT_ALIGN_Z(sizeof(p->s), 32)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
a307732568c3d861c38b0342ae32434226d10e94Pramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Checks that a internal struct padding is big enough.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define CHECK_PADDING3(strct, member, pad_member) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar strct *p; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (sizeof(p->member) > sizeof(p->pad_member)) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("padding of %s::%s is too small, padding=%d struct=%d\n", #strct, #member, \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar (int)sizeof(p->pad_member), (int)sizeof(p->member)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar rc++; \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung/**
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Prints the offset of a struct member.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define PRINT_OFFSET(strct, member) \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar do \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar { \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("%s::%s offset %d sizeof %d\n", #strct, #member, (int)RT_OFFSETOF(strct, member), (int)RT_SIZEOFMEMB(strct, member)); \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } while (0)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint main()
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar{
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int rc = 0;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("tstDeviceStructSize: TESTING\n");
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* Assert sanity */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(uint128_t, 128/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(int128_t, 128/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(uint64_t, 64/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(int64_t, 64/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(uint32_t, 32/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(int32_t, 32/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(uint16_t, 16/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(int16_t, 16/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(uint8_t, 8/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_SIZE(int8_t, 8/8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Misc alignment checks.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PDMDEVINS, achInstanceData, 32);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PCIDEVICE, Int.s, 16);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PCIDEVICE, Int.s.aIORegions, 16);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PCIBUS, devices, 16);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PCIGLOBALS, pci_irq_levels, 16);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PCNetState, u64LastPoll, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(VGASTATE, Dev, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(VGASTATE, StatGCMemoryRead, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef VBOX_WITH_STATISTICS
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar// CHECK_MEMBER_ALIGNMENT(PCNetState, StatMMIOReadGC, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(DEVPIC, StatSetIrqGC, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(APICState, StatMMIOReadGC, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(IOAPICState, StatMMIOReadGC, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(IOAPICState, StatMMIOReadGC, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(PITState, StatPITIrq, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(ATADevState, cTotalSectors, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(ATADevState, StatATADMA, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(ATADevState, StatReads, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(ATACONTROLLER, StatAsyncOps, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef VBOX_WITH_USB
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(OHCI, RootHub, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# ifdef VBOX_WITH_STATISTICS
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(OHCI, StatCanceledIsocUrbs, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(EHCI, RootHub, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# ifdef VBOX_WITH_STATISTICS
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar CHECK_MEMBER_ALIGNMENT(EHCI, StatCanceledIsocUrbs, 8);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar# endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Compare HC and GC.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("tstDeviceStructSize: Comparing HC and GC...\n");
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include "tstDeviceStructSizeGC.h"
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung /*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Report result.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar if (rc)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("tstDeviceStructSize: FAILURE - %d errors\n", rc);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar else
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar printf("tstDeviceStructSize: SUCCESS\n");
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar return rc;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar}
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar