1 | /* $Id: tstVMStructSize.cpp 29329 2010-05-11 10:18:30Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * tstVMStructSize - testcase for check structure sizes/alignment
|
---|
4 | * and to verify that HC and GC uses the same
|
---|
5 | * representation of the structures.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | /*******************************************************************************
|
---|
21 | * Header Files *
|
---|
22 | *******************************************************************************/
|
---|
23 | #include <VBox/cfgm.h>
|
---|
24 | #include <VBox/cpum.h>
|
---|
25 | #include <VBox/mm.h>
|
---|
26 | #include <VBox/pgm.h>
|
---|
27 | #include <VBox/selm.h>
|
---|
28 | #include <VBox/trpm.h>
|
---|
29 | #include <VBox/vmm.h>
|
---|
30 | #include <VBox/stam.h>
|
---|
31 | #include "PDMInternal.h"
|
---|
32 | #include <VBox/pdm.h>
|
---|
33 | #include "CFGMInternal.h"
|
---|
34 | #include "CPUMInternal.h"
|
---|
35 | #include "MMInternal.h"
|
---|
36 | #include "PGMInternal.h"
|
---|
37 | #include "SELMInternal.h"
|
---|
38 | #include "TRPMInternal.h"
|
---|
39 | #include "TMInternal.h"
|
---|
40 | #include "IOMInternal.h"
|
---|
41 | #include "REMInternal.h"
|
---|
42 | #include "SSMInternal.h"
|
---|
43 | #include "HWACCMInternal.h"
|
---|
44 | #include "PATMInternal.h"
|
---|
45 | #include "VMMInternal.h"
|
---|
46 | #include "DBGFInternal.h"
|
---|
47 | #include "STAMInternal.h"
|
---|
48 | #include "VMInternal.h"
|
---|
49 | #include "CSAMInternal.h"
|
---|
50 | #include "EMInternal.h"
|
---|
51 | #include "REMInternal.h"
|
---|
52 | #include "VMMR0/GMMR0Internal.h"
|
---|
53 | #include "VMMR0/GVMMR0Internal.h"
|
---|
54 | #include <VBox/vm.h>
|
---|
55 | #include <VBox/uvm.h>
|
---|
56 | #include <VBox/gvm.h>
|
---|
57 | #include <VBox/param.h>
|
---|
58 | #include <VBox/x86.h>
|
---|
59 |
|
---|
60 | #include "tstHelp.h"
|
---|
61 | #include <stdio.h>
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 | int main()
|
---|
66 | {
|
---|
67 | int rc = 0;
|
---|
68 | printf("tstVMStructSize: TESTING\n");
|
---|
69 |
|
---|
70 | printf("info: struct VM: %d bytes\n", (int)sizeof(VM));
|
---|
71 |
|
---|
72 | #define CHECK_PADDING_VM(align, member) \
|
---|
73 | do \
|
---|
74 | { \
|
---|
75 | CHECK_PADDING(VM, member, align); \
|
---|
76 | CHECK_MEMBER_ALIGNMENT(VM, member, align); \
|
---|
77 | VM *p; \
|
---|
78 | if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
|
---|
79 | printf("warning: VM::%-8s: padding=%-5d s=%-5d -> %-4d suggest=%-5u\n", \
|
---|
80 | #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
|
---|
81 | (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
|
---|
82 | (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
|
---|
83 | } while (0)
|
---|
84 |
|
---|
85 |
|
---|
86 | #define CHECK_PADDING_VMCPU(align, member) \
|
---|
87 | do \
|
---|
88 | { \
|
---|
89 | CHECK_PADDING(VMCPU, member, align); \
|
---|
90 | CHECK_MEMBER_ALIGNMENT(VMCPU, member, align); \
|
---|
91 | VMCPU *p; \
|
---|
92 | if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
|
---|
93 | printf("warning: VMCPU::%-8s: padding=%-5d s=%-5d -> %-4d suggest=%-5u\n", \
|
---|
94 | #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
|
---|
95 | (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
|
---|
96 | (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
|
---|
97 | } while (0)
|
---|
98 |
|
---|
99 | #define CHECK_CPUMCTXCORE(member) \
|
---|
100 | do { \
|
---|
101 | if (RT_OFFSETOF(CPUMCTX, member) - RT_OFFSETOF(CPUMCTX, edi) != RT_OFFSETOF(CPUMCTXCORE, member)) \
|
---|
102 | { \
|
---|
103 | printf("error! CPUMCTX/CORE:: %s!\n", #member); \
|
---|
104 | rc++; \
|
---|
105 | } \
|
---|
106 | } while (0)
|
---|
107 |
|
---|
108 | #define CHECK_PADDING_UVM(align, member) \
|
---|
109 | do \
|
---|
110 | { \
|
---|
111 | CHECK_PADDING(UVM, member, align); \
|
---|
112 | CHECK_MEMBER_ALIGNMENT(UVM, member, align); \
|
---|
113 | UVM *p; \
|
---|
114 | if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
|
---|
115 | printf("warning: UVM::%-8s: padding=%-5d s=%-5d -> %-4d suggest=%-5u\n", \
|
---|
116 | #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
|
---|
117 | (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
|
---|
118 | (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
|
---|
119 | } while (0)
|
---|
120 |
|
---|
121 | #define CHECK_PADDING_UVMCPU(align, member) \
|
---|
122 | do \
|
---|
123 | { \
|
---|
124 | CHECK_PADDING(UVMCPU, member, align); \
|
---|
125 | CHECK_MEMBER_ALIGNMENT(UVMCPU, member, align); \
|
---|
126 | UVMCPU *p; \
|
---|
127 | if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
|
---|
128 | printf("warning: UVMCPU::%-8s: padding=%-5d s=%-5d -> %-4d suggest=%-5u\n", \
|
---|
129 | #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
|
---|
130 | (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
|
---|
131 | (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
|
---|
132 | } while (0)
|
---|
133 |
|
---|
134 | #define CHECK_PADDING_GVM(align, member) \
|
---|
135 | do \
|
---|
136 | { \
|
---|
137 | CHECK_PADDING(GVM, member, align); \
|
---|
138 | CHECK_MEMBER_ALIGNMENT(GVM, member, align); \
|
---|
139 | GVM *p; \
|
---|
140 | if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
|
---|
141 | printf("warning: GVM::%-8s: padding=%-5d s=%-5d -> %-4d suggest=%-5u\n", \
|
---|
142 | #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
|
---|
143 | (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
|
---|
144 | (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
|
---|
145 | } while (0)
|
---|
146 |
|
---|
147 | #define CHECK_PADDING_GVMCPU(align, member) \
|
---|
148 | do \
|
---|
149 | { \
|
---|
150 | CHECK_PADDING(GVMCPU, member, align); \
|
---|
151 | CHECK_MEMBER_ALIGNMENT(GVMCPU, member, align); \
|
---|
152 | GVMCPU *p; \
|
---|
153 | if (sizeof(p->member.padding) >= (ssize_t)sizeof(p->member.s) + 128 + sizeof(p->member.s) / 20) \
|
---|
154 | printf("warning: GVMCPU::%-8s: padding=%-5d s=%-5d -> %-4d suggest=%-5u\n", \
|
---|
155 | #member, (int)sizeof(p->member.padding), (int)sizeof(p->member.s), \
|
---|
156 | (int)sizeof(p->member.padding) - (int)sizeof(p->member.s), \
|
---|
157 | (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \
|
---|
158 | } while (0)
|
---|
159 |
|
---|
160 | #define PRINT_OFFSET(strct, member) \
|
---|
161 | do \
|
---|
162 | { \
|
---|
163 | printf("info: %s::%s offset %#x (%d) sizeof %d\n", #strct, #member, (int)RT_OFFSETOF(strct, member), (int)RT_OFFSETOF(strct, member), (int)RT_SIZEOFMEMB(strct, member)); \
|
---|
164 | } while (0)
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 | CHECK_SIZE(uint128_t, 128/8);
|
---|
169 | CHECK_SIZE(int128_t, 128/8);
|
---|
170 | CHECK_SIZE(uint64_t, 64/8);
|
---|
171 | CHECK_SIZE(int64_t, 64/8);
|
---|
172 | CHECK_SIZE(uint32_t, 32/8);
|
---|
173 | CHECK_SIZE(int32_t, 32/8);
|
---|
174 | CHECK_SIZE(uint16_t, 16/8);
|
---|
175 | CHECK_SIZE(int16_t, 16/8);
|
---|
176 | CHECK_SIZE(uint8_t, 8/8);
|
---|
177 | CHECK_SIZE(int8_t, 8/8);
|
---|
178 |
|
---|
179 | CHECK_SIZE(X86DESC, 8);
|
---|
180 | CHECK_SIZE(X86DESC64, 16);
|
---|
181 | CHECK_SIZE(VBOXIDTE, 8);
|
---|
182 | CHECK_SIZE(VBOXIDTR, 10);
|
---|
183 | CHECK_SIZE(VBOXGDTR, 10);
|
---|
184 | CHECK_SIZE(VBOXTSS, 136);
|
---|
185 | CHECK_SIZE(X86FXSTATE, 512);
|
---|
186 | CHECK_SIZE(RTUUID, 16);
|
---|
187 | CHECK_SIZE(X86PTE, 4);
|
---|
188 | CHECK_SIZE(X86PD, PAGE_SIZE);
|
---|
189 | CHECK_SIZE(X86PDE, 4);
|
---|
190 | CHECK_SIZE(X86PT, PAGE_SIZE);
|
---|
191 | CHECK_SIZE(X86PTEPAE, 8);
|
---|
192 | CHECK_SIZE(X86PTPAE, PAGE_SIZE);
|
---|
193 | CHECK_SIZE(X86PDEPAE, 8);
|
---|
194 | CHECK_SIZE(X86PDPAE, PAGE_SIZE);
|
---|
195 | CHECK_SIZE(X86PDPE, 8);
|
---|
196 | CHECK_SIZE(X86PDPT, PAGE_SIZE);
|
---|
197 | CHECK_SIZE(X86PML4E, 8);
|
---|
198 | CHECK_SIZE(X86PML4, PAGE_SIZE);
|
---|
199 |
|
---|
200 | PRINT_OFFSET(VM, cpum);
|
---|
201 | CHECK_PADDING_VM(64, cpum);
|
---|
202 | CHECK_PADDING_VM(64, vmm);
|
---|
203 | CHECK_PADDING_VM(64, pgm);
|
---|
204 | CHECK_PADDING_VM(64, hwaccm);
|
---|
205 | CHECK_PADDING_VM(64, trpm);
|
---|
206 | CHECK_PADDING_VM(64, selm);
|
---|
207 | CHECK_PADDING_VM(64, mm);
|
---|
208 | CHECK_PADDING_VM(64, pdm);
|
---|
209 | CHECK_PADDING_VM(64, iom);
|
---|
210 | CHECK_PADDING_VM(64, patm);
|
---|
211 | CHECK_PADDING_VM(64, csam);
|
---|
212 | CHECK_PADDING_VM(64, em);
|
---|
213 | CHECK_PADDING_VM(64, tm);
|
---|
214 | CHECK_PADDING_VM(64, dbgf);
|
---|
215 | CHECK_PADDING_VM(64, ssm);
|
---|
216 | CHECK_PADDING_VM(64, rem);
|
---|
217 | CHECK_PADDING_VM(8, vm);
|
---|
218 | CHECK_PADDING_VM(8, cfgm);
|
---|
219 |
|
---|
220 | PRINT_OFFSET(VMCPU, cpum);
|
---|
221 | CHECK_PADDING_VMCPU(64, cpum);
|
---|
222 | CHECK_PADDING_VMCPU(64, hwaccm);
|
---|
223 | CHECK_PADDING_VMCPU(64, em);
|
---|
224 | CHECK_PADDING_VMCPU(64, trpm);
|
---|
225 | CHECK_PADDING_VMCPU(64, tm);
|
---|
226 | CHECK_PADDING_VMCPU(64, vmm);
|
---|
227 | CHECK_PADDING_VMCPU(64, pdm);
|
---|
228 | CHECK_PADDING_VMCPU(64, iom);
|
---|
229 | CHECK_PADDING_VMCPU(64, dbgf);
|
---|
230 | CHECK_PADDING_VMCPU(4096, pgm);
|
---|
231 | #ifdef VBOX_WITH_STATISTICS
|
---|
232 | PRINT_OFFSET(VMCPU, pgm.s.pStatTrap0eAttributionRC);
|
---|
233 | #endif
|
---|
234 |
|
---|
235 | CHECK_MEMBER_ALIGNMENT(VM, selm.s.Tss, 16);
|
---|
236 | PRINT_OFFSET(VM, selm.s.Tss);
|
---|
237 | PVM pVM;
|
---|
238 | if ((RT_OFFSETOF(VM, selm.s.Tss) & PAGE_OFFSET_MASK) > PAGE_SIZE - sizeof(pVM->selm.s.Tss))
|
---|
239 | {
|
---|
240 | printf("error! SELM:Tss is crossing a page!\n");
|
---|
241 | rc++;
|
---|
242 | }
|
---|
243 | PRINT_OFFSET(VM, selm.s.TssTrap08);
|
---|
244 | if ((RT_OFFSETOF(VM, selm.s.TssTrap08) & PAGE_OFFSET_MASK) > PAGE_SIZE - sizeof(pVM->selm.s.TssTrap08))
|
---|
245 | {
|
---|
246 | printf("error! SELM:TssTrap08 is crossing a page!\n");
|
---|
247 | rc++;
|
---|
248 | }
|
---|
249 | CHECK_MEMBER_ALIGNMENT(VM, trpm.s.aIdt, 16);
|
---|
250 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[0], PAGE_SIZE);
|
---|
251 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[1], PAGE_SIZE);
|
---|
252 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[0].cpum.s.Host, 64);
|
---|
253 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[0].cpum.s.Guest, 64);
|
---|
254 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[1].cpum.s.Host, 64);
|
---|
255 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[1].cpum.s.Guest, 64);
|
---|
256 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[0].cpum.s.Hyper, 64);
|
---|
257 | CHECK_MEMBER_ALIGNMENT(VM, aCpus[1].cpum.s.Hyper, 64);
|
---|
258 | CHECK_MEMBER_ALIGNMENT(VM, cpum.s.GuestEntry, 64);
|
---|
259 |
|
---|
260 | CHECK_MEMBER_ALIGNMENT(VMCPU, vmm.s.u64CallRing3Arg, 8);
|
---|
261 | #if defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64)
|
---|
262 | CHECK_MEMBER_ALIGNMENT(VMCPU, vmm.s.CallRing3JmpBufR0, 16);
|
---|
263 | CHECK_MEMBER_ALIGNMENT(VMCPU, vmm.s.CallRing3JmpBufR0.xmm6, 16);
|
---|
264 | #endif
|
---|
265 | CHECK_MEMBER_ALIGNMENT(VM, vmm.s.u64LastYield, 8);
|
---|
266 | CHECK_MEMBER_ALIGNMENT(VM, vmm.s.StatRunRC, 8);
|
---|
267 | CHECK_MEMBER_ALIGNMENT(VM, StatTotalQemuToGC, 8);
|
---|
268 | CHECK_MEMBER_ALIGNMENT(VM, rem.s.uPendingExcptCR2, 8);
|
---|
269 | CHECK_MEMBER_ALIGNMENT(VM, rem.s.StatsInQEMU, 8);
|
---|
270 | CHECK_MEMBER_ALIGNMENT(VM, rem.s.Env, 64);
|
---|
271 |
|
---|
272 | /* the VMCPUs are page aligned TLB hit reassons. */
|
---|
273 | CHECK_MEMBER_ALIGNMENT(VM, aCpus, 4096);
|
---|
274 | CHECK_SIZE_ALIGNMENT(VMCPU, 4096);
|
---|
275 |
|
---|
276 | /* cpumctx */
|
---|
277 | CHECK_MEMBER_ALIGNMENT(CPUMCTX, fpu, 32);
|
---|
278 | CHECK_MEMBER_ALIGNMENT(CPUMCTX, edi, 32);
|
---|
279 | CHECK_MEMBER_ALIGNMENT(CPUMCTX, idtr, 4);
|
---|
280 | CHECK_MEMBER_ALIGNMENT(CPUMCTX, SysEnter, 8);
|
---|
281 | CHECK_CPUMCTXCORE(eax);
|
---|
282 | CHECK_CPUMCTXCORE(ebx);
|
---|
283 | CHECK_CPUMCTXCORE(ecx);
|
---|
284 | CHECK_CPUMCTXCORE(edx);
|
---|
285 | CHECK_CPUMCTXCORE(ebp);
|
---|
286 | CHECK_CPUMCTXCORE(esp);
|
---|
287 | CHECK_CPUMCTXCORE(edi);
|
---|
288 | CHECK_CPUMCTXCORE(esi);
|
---|
289 | CHECK_CPUMCTXCORE(eip);
|
---|
290 | CHECK_CPUMCTXCORE(eflags);
|
---|
291 | CHECK_CPUMCTXCORE(cs);
|
---|
292 | CHECK_CPUMCTXCORE(ds);
|
---|
293 | CHECK_CPUMCTXCORE(es);
|
---|
294 | CHECK_CPUMCTXCORE(fs);
|
---|
295 | CHECK_CPUMCTXCORE(gs);
|
---|
296 | CHECK_CPUMCTXCORE(ss);
|
---|
297 | CHECK_CPUMCTXCORE(r8);
|
---|
298 | CHECK_CPUMCTXCORE(r9);
|
---|
299 | CHECK_CPUMCTXCORE(r10);
|
---|
300 | CHECK_CPUMCTXCORE(r11);
|
---|
301 | CHECK_CPUMCTXCORE(r12);
|
---|
302 | CHECK_CPUMCTXCORE(r13);
|
---|
303 | CHECK_CPUMCTXCORE(r14);
|
---|
304 | CHECK_CPUMCTXCORE(r15);
|
---|
305 | CHECK_CPUMCTXCORE(esHid);
|
---|
306 | CHECK_CPUMCTXCORE(csHid);
|
---|
307 | CHECK_CPUMCTXCORE(ssHid);
|
---|
308 | CHECK_CPUMCTXCORE(dsHid);
|
---|
309 | CHECK_CPUMCTXCORE(fsHid);
|
---|
310 | CHECK_CPUMCTXCORE(gsHid);
|
---|
311 |
|
---|
312 | #if HC_ARCH_BITS == 32
|
---|
313 | /* CPUMHOSTCTX - lss pair */
|
---|
314 | if (RT_OFFSETOF(CPUMHOSTCTX, esp) + 4 != RT_OFFSETOF(CPUMHOSTCTX, ss))
|
---|
315 | {
|
---|
316 | printf("error! CPUMHOSTCTX lss has been split up!\n");
|
---|
317 | rc++;
|
---|
318 | }
|
---|
319 | #endif
|
---|
320 | CHECK_SIZE_ALIGNMENT(CPUMCTX, 64);
|
---|
321 | CHECK_SIZE_ALIGNMENT(CPUMHOSTCTX, 64);
|
---|
322 | CHECK_SIZE_ALIGNMENT(CPUMCTXMSR, 64);
|
---|
323 |
|
---|
324 | /* pdm */
|
---|
325 | CHECK_MEMBER_ALIGNMENT(PDMDEVINS, achInstanceData, 64);
|
---|
326 | CHECK_PADDING(PDMDEVINS, Internal, 1);
|
---|
327 | CHECK_MEMBER_ALIGNMENT(PDMUSBINS, achInstanceData, 16);
|
---|
328 | CHECK_PADDING(PDMUSBINS, Internal, 1);
|
---|
329 | CHECK_MEMBER_ALIGNMENT(PDMDRVINS, achInstanceData, 16);
|
---|
330 | CHECK_PADDING(PDMDRVINS, Internal, 1);
|
---|
331 | CHECK_PADDING2(PDMCRITSECT);
|
---|
332 |
|
---|
333 | /* pgm */
|
---|
334 | #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
|
---|
335 | CHECK_MEMBER_ALIGNMENT(PGMCPU, AutoSet, 8);
|
---|
336 | #endif
|
---|
337 | CHECK_MEMBER_ALIGNMENT(PGMCPU, GCPhysCR3, sizeof(RTGCPHYS));
|
---|
338 | CHECK_MEMBER_ALIGNMENT(PGMCPU, aGCPhysGstPaePDs, sizeof(RTGCPHYS));
|
---|
339 | CHECK_MEMBER_ALIGNMENT(PGMCPU, DisState, 8);
|
---|
340 | CHECK_MEMBER_ALIGNMENT(PGMCPU, cPoolAccessHandler, 8);
|
---|
341 | #ifdef VBOX_WITH_STATISTICS
|
---|
342 | CHECK_MEMBER_ALIGNMENT(PGMCPU, StatSyncPtPD, 8);
|
---|
343 | CHECK_MEMBER_ALIGNMENT(PGMCPU, StatR3Prefetch, 8);
|
---|
344 | #endif
|
---|
345 | CHECK_MEMBER_ALIGNMENT(PGMPOOLPAGE, idx, sizeof(uint16_t));
|
---|
346 | CHECK_MEMBER_ALIGNMENT(PGMPOOLPAGE, pvPageR3, sizeof(RTHCPTR));
|
---|
347 | CHECK_MEMBER_ALIGNMENT(PGMPOOLPAGE, GCPhys, sizeof(RTGCPHYS));
|
---|
348 | CHECK_SIZE(PGMPAGE, 16);
|
---|
349 | CHECK_MEMBER_ALIGNMENT(PGMRAMRANGE, aPages, 16);
|
---|
350 | CHECK_MEMBER_ALIGNMENT(PGMMMIO2RANGE, RamRange, 16);
|
---|
351 |
|
---|
352 | /* rem */
|
---|
353 | CHECK_MEMBER_ALIGNMENT(REM, aGCPtrInvalidatedPages, 8);
|
---|
354 | CHECK_PADDING3(REMHANDLERNOTIFICATION, u.PhysicalRegister, u.padding);
|
---|
355 | CHECK_PADDING3(REMHANDLERNOTIFICATION, u.PhysicalDeregister, u.padding);
|
---|
356 | CHECK_PADDING3(REMHANDLERNOTIFICATION, u.PhysicalModify, u.padding);
|
---|
357 | CHECK_SIZE_ALIGNMENT(REMHANDLERNOTIFICATION, 8);
|
---|
358 | CHECK_MEMBER_ALIGNMENT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.GCPhys, 8);
|
---|
359 |
|
---|
360 | /* TM */
|
---|
361 | CHECK_MEMBER_ALIGNMENT(TM, TimerCritSect, sizeof(uintptr_t));
|
---|
362 | CHECK_MEMBER_ALIGNMENT(TM, VirtualSyncLock, sizeof(uintptr_t));
|
---|
363 |
|
---|
364 | /* misc */
|
---|
365 | CHECK_PADDING3(EMCPU, u.FatalLongJump, u.achPaddingFatalLongJump);
|
---|
366 | CHECK_SIZE_ALIGNMENT(VMMR0JMPBUF, 8);
|
---|
367 | CHECK_SIZE_ALIGNMENT(PATCHINFO, 8);
|
---|
368 | #if 0
|
---|
369 | PRINT_OFFSET(VM, fForcedActions);
|
---|
370 | PRINT_OFFSET(VM, StatQemuToGC);
|
---|
371 | PRINT_OFFSET(VM, StatGCToQemu);
|
---|
372 | #endif
|
---|
373 |
|
---|
374 | CHECK_MEMBER_ALIGNMENT(IOM, EmtLock, sizeof(uintptr_t));
|
---|
375 | CHECK_MEMBER_ALIGNMENT(EM, CritSectREM, sizeof(uintptr_t));
|
---|
376 | CHECK_MEMBER_ALIGNMENT(PGM, CritSect, sizeof(uintptr_t));
|
---|
377 | CHECK_MEMBER_ALIGNMENT(PDM, CritSect, sizeof(uintptr_t));
|
---|
378 | CHECK_MEMBER_ALIGNMENT(MMHYPERHEAP, Lock, sizeof(uintptr_t));
|
---|
379 |
|
---|
380 | /* hwaccm - 32-bit gcc won't align uint64_t naturally, so check. */
|
---|
381 | CHECK_MEMBER_ALIGNMENT(HWACCM, u64RegisterMask, 8);
|
---|
382 | CHECK_MEMBER_ALIGNMENT(HWACCM, vmx.hostCR4, 8);
|
---|
383 | CHECK_MEMBER_ALIGNMENT(HWACCM, vmx.msr.feature_ctrl, 8);
|
---|
384 | CHECK_MEMBER_ALIGNMENT(HWACCM, StatTPRPatchSuccess, 8);
|
---|
385 | CHECK_MEMBER_ALIGNMENT(HWACCMCPU, StatEntry, 8);
|
---|
386 | CHECK_MEMBER_ALIGNMENT(HWACCMCPU, vmx.pVMCSPhys, sizeof(RTHCPHYS));
|
---|
387 | CHECK_MEMBER_ALIGNMENT(HWACCMCPU, vmx.proc_ctls, 8);
|
---|
388 | CHECK_MEMBER_ALIGNMENT(HWACCMCPU, Event.intInfo, 8);
|
---|
389 |
|
---|
390 | /* The various disassembler state members. */
|
---|
391 | CHECK_PADDING3(EMCPU, DisState, abDisStatePadding);
|
---|
392 | CHECK_PADDING3(HWACCMCPU, DisState, abDisStatePadding);
|
---|
393 | CHECK_PADDING3(IOMCPU, DisState, abDisStatePadding);
|
---|
394 | CHECK_PADDING3(PGMCPU, DisState, abDisStatePadding);
|
---|
395 |
|
---|
396 | /* Make sure the set is large enough and has the correct size. */
|
---|
397 | CHECK_SIZE(VMCPUSET, 32);
|
---|
398 | if (sizeof(VMCPUSET) * 8 < VMM_MAX_CPU_COUNT)
|
---|
399 | {
|
---|
400 | printf("error! VMCPUSET is too small for VMM_MAX_CPU_COUNT=%u!\n", VMM_MAX_CPU_COUNT);
|
---|
401 | rc++;
|
---|
402 | }
|
---|
403 |
|
---|
404 | printf("info: struct UVM: %d bytes\n", (int)sizeof(UVM));
|
---|
405 |
|
---|
406 | CHECK_PADDING_UVM(32, vm);
|
---|
407 | CHECK_PADDING_UVM(32, mm);
|
---|
408 | CHECK_PADDING_UVM(32, pdm);
|
---|
409 | CHECK_PADDING_UVM(32, stam);
|
---|
410 |
|
---|
411 | printf("info: struct UVMCPU: %d bytes\n", (int)sizeof(UVMCPU));
|
---|
412 | CHECK_PADDING_UVMCPU(32, vm);
|
---|
413 |
|
---|
414 | #ifdef VBOX_WITH_RAW_MODE
|
---|
415 | /*
|
---|
416 | * Compare HC and RC.
|
---|
417 | */
|
---|
418 | printf("tstVMStructSize: Comparing HC and RC...\n");
|
---|
419 | # include "tstVMStructRC.h"
|
---|
420 | #endif /* VBOX_WITH_RAW_MODE */
|
---|
421 |
|
---|
422 | CHECK_PADDING_GVM(4, gvmm);
|
---|
423 | CHECK_PADDING_GVM(4, gmm);
|
---|
424 | CHECK_PADDING_GVMCPU(4, gvmm);
|
---|
425 |
|
---|
426 | /*
|
---|
427 | * Report result.
|
---|
428 | */
|
---|
429 | if (rc)
|
---|
430 | printf("tstVMStructSize: FAILURE - %d errors\n", rc);
|
---|
431 | else
|
---|
432 | printf("tstVMStructSize: SUCCESS\n");
|
---|
433 | return rc;
|
---|
434 | }
|
---|
435 |
|
---|