VirtualBox

Changeset 22997 in vbox for trunk/src


Ignore:
Timestamp:
Sep 14, 2009 12:44:51 PM (15 years ago)
Author:
vboxsync
Message:

Test UVM padding as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r22919 r22997  
    5858#include "REMInternal.h"
    5959#include <VBox/vm.h>
     60#include <VBox/uvm.h>
    6061#include <VBox/param.h>
    6162#include <VBox/x86.h>
     
    107108            rc++; \
    108109        } \
     110    } while (0)
     111
     112#define CHECK_PADDING_UVM(align, member) \
     113    do \
     114    { \
     115        CHECK_PADDING(UVM, member, align); \
     116        CHECK_MEMBER_ALIGNMENT(UVM, member, align); \
     117        UVM *p; \
     118        if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
     119            printf("warning: UVM::%-8s: padding=%-5d s=%-5d -> %-4d  suggest=%-5u\n", \
     120                   #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
     121                   (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
     122                   (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
     123    } while (0)
     124
     125#define CHECK_PADDING_UVMCPU(align, member) \
     126    do \
     127    { \
     128        CHECK_PADDING(UVMCPU, member, align); \
     129        CHECK_MEMBER_ALIGNMENT(UVMCPU, member, align); \
     130        UVMCPU *p; \
     131        if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
     132            printf("warning: UVMCPU::%-8s: padding=%-5d s=%-5d -> %-4d  suggest=%-5u\n", \
     133                   #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
     134                   (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
     135                   (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
    109136    } while (0)
    110137
     
    355382    }
    356383
     384    printf("struct UVM: %d bytes\n", (int)sizeof(UVM));
     385
     386    CHECK_PADDING_UVM(32, vm);
     387    CHECK_PADDING_UVM(32, mm);
     388    CHECK_PADDING_UVM(32, pdm);
     389    CHECK_PADDING_UVM(32, stam);
     390    CHECK_PADDING_UVMCPU(32, vm);
     391
    357392    /*
    358393     * Compare HC and GC.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette