VirtualBox

source: vbox/trunk/include/VBox/vmm/cpumctx.h@ 67937

Last change on this file since 67937 was 67924, checked in by vboxsync, 7 years ago

VMM/CPUM: Nested Hw.virt: Allocate the nested-guest VMCB (controls and state-save area) dynamically.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.2 KB
Line 
1/** @file
2 * CPUM - CPU Monitor(/ Manager), Context Structures.
3 */
4
5/*
6 * Copyright (C) 2006-2016 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_vmm_cpumctx_h
27#define ___VBox_vmm_cpumctx_h
28
29#ifndef VBOX_FOR_DTRACE_LIB
30# include <iprt/x86.h>
31# include <VBox/types.h>
32# include <VBox/vmm/hm_svm.h>
33#else
34# pragma D depends_on library x86.d
35#endif
36
37
38RT_C_DECLS_BEGIN
39
40/** @defgroup grp_cpum_ctx The CPUM Context Structures
41 * @ingroup grp_cpum
42 * @{
43 */
44
45/**
46 * Selector hidden registers.
47 */
48typedef struct CPUMSELREG
49{
50 /** The selector register. */
51 RTSEL Sel;
52 /** Padding, don't use. */
53 RTSEL PaddingSel;
54 /** The selector which info resides in u64Base, u32Limit and Attr, provided
55 * that CPUMSELREG_FLAGS_VALID is set. */
56 RTSEL ValidSel;
57 /** Flags, see CPUMSELREG_FLAGS_XXX. */
58 uint16_t fFlags;
59
60 /** Base register.
61 *
62 * Long mode remarks:
63 * - Unused in long mode for CS, DS, ES, SS
64 * - 32 bits for FS & GS; FS(GS)_BASE msr used for the base address
65 * - 64 bits for TR & LDTR
66 */
67 uint64_t u64Base;
68 /** Limit (expanded). */
69 uint32_t u32Limit;
70 /** Flags.
71 * This is the high 32-bit word of the descriptor entry.
72 * Only the flags, dpl and type are used. */
73 X86DESCATTR Attr;
74} CPUMSELREG;
75#ifndef VBOX_FOR_DTRACE_LIB
76AssertCompileSize(CPUMSELREG, 24);
77#endif
78
79/** @name CPUMSELREG_FLAGS_XXX - CPUMSELREG::fFlags values.
80 * @{ */
81#define CPUMSELREG_FLAGS_VALID UINT16_C(0x0001)
82#define CPUMSELREG_FLAGS_STALE UINT16_C(0x0002)
83#define CPUMSELREG_FLAGS_VALID_MASK UINT16_C(0x0003)
84/** @} */
85
86/** Checks if the hidden parts of the selector register are valid. */
87#ifdef VBOX_WITH_RAW_MODE_NOT_R0
88# define CPUMSELREG_ARE_HIDDEN_PARTS_VALID(a_pVCpu, a_pSelReg) \
89 ( ((a_pSelReg)->fFlags & CPUMSELREG_FLAGS_VALID) \
90 && ( (a_pSelReg)->ValidSel == (a_pSelReg)->Sel \
91 || ( (a_pVCpu) /*!= NULL*/ \
92 && (a_pSelReg)->ValidSel == ((a_pSelReg)->Sel & X86_SEL_MASK_OFF_RPL) \
93 && ((a_pSelReg)->Sel & X86_SEL_RPL) == 1 \
94 && ((a_pSelReg)->ValidSel & X86_SEL_RPL) == 0 \
95 && CPUMIsGuestInRawMode(a_pVCpu) \
96 ) \
97 ) \
98 )
99#else
100# define CPUMSELREG_ARE_HIDDEN_PARTS_VALID(a_pVCpu, a_pSelReg) \
101 ( ((a_pSelReg)->fFlags & CPUMSELREG_FLAGS_VALID) \
102 && (a_pSelReg)->ValidSel == (a_pSelReg)->Sel )
103#endif
104
105/** Old type used for the hidden register part.
106 * @deprecated */
107typedef CPUMSELREG CPUMSELREGHID;
108
109/**
110 * The sysenter register set.
111 */
112typedef struct CPUMSYSENTER
113{
114 /** Ring 0 cs.
115 * This value + 8 is the Ring 0 ss.
116 * This value + 16 is the Ring 3 cs.
117 * This value + 24 is the Ring 3 ss.
118 */
119 uint64_t cs;
120 /** Ring 0 eip. */
121 uint64_t eip;
122 /** Ring 0 esp. */
123 uint64_t esp;
124} CPUMSYSENTER;
125
126/** @def CPUM_UNION_NM
127 * For compilers (like DTrace) that does not grok nameless unions, we have a
128 * little hack to make them palatable.
129 */
130/** @def CPUM_STRUCT_NM
131 * For compilers (like DTrace) that does not grok nameless structs (it is
132 * non-standard C++), we have a little hack to make them palatable.
133 */
134#ifdef VBOX_FOR_DTRACE_LIB
135# define CPUM_UNION_NM(a_Nm) a_Nm
136# define CPUM_STRUCT_NM(a_Nm) a_Nm
137#elif defined(VBOX_WITHOUT_UNNAMED_UNIONS)
138# define CPUM_UNION_NM(a_Nm) a_Nm
139# define CPUM_STRUCT_NM(a_Nm) a_Nm
140#else
141# define CPUM_UNION_NM(a_Nm)
142# define CPUM_STRUCT_NM(a_Nm)
143#endif
144/** @def CPUM_UNION_STRUCT_NM
145 * Combines CPUM_UNION_NM and CPUM_STRUCT_NM to avoid hitting the right side of
146 * the screen in the compile time assertions.
147 */
148#define CPUM_UNION_STRUCT_NM(a_UnionNm, a_StructNm) CPUM_UNION_NM(a_UnionNm .) CPUM_STRUCT_NM(a_StructNm)
149
150/** A general register (union). */
151typedef union CPUMCTXGREG
152{
153 /** Natural unsigned integer view. */
154 uint64_t u;
155 /** 64-bit view. */
156 uint64_t u64;
157 /** 32-bit view. */
158 uint32_t u32;
159 /** 16-bit view. */
160 uint16_t u16;
161 /** 8-bit view. */
162 uint8_t u8;
163 /** 8-bit low/high view. */
164 RT_GCC_EXTENSION struct
165 {
166 /** Low byte (al, cl, dl, bl, ++). */
167 uint8_t bLo;
168 /** High byte in the first word - ah, ch, dh, bh. */
169 uint8_t bHi;
170 } CPUM_STRUCT_NM(s);
171} CPUMCTXGREG;
172#ifndef VBOX_FOR_DTRACE_LIB
173AssertCompileSize(CPUMCTXGREG, 8);
174AssertCompileMemberOffset(CPUMCTXGREG, CPUM_STRUCT_NM(s.) bLo, 0);
175AssertCompileMemberOffset(CPUMCTXGREG, CPUM_STRUCT_NM(s.) bHi, 1);
176#endif
177
178
179
180/**
181 * CPU context core.
182 *
183 * @todo Eliminate this structure!
184 * @deprecated We don't push any context cores any more in TRPM.
185 */
186#pragma pack(1)
187typedef struct CPUMCTXCORE
188{
189 /** @name General Register.
190 * @note These follow the encoding order (X86_GREG_XXX) and can be accessed as
191 * an array starting a rax.
192 * @{ */
193 union
194 {
195 uint8_t al;
196 uint16_t ax;
197 uint32_t eax;
198 uint64_t rax;
199 } CPUM_UNION_NM(rax);
200 union
201 {
202 uint8_t cl;
203 uint16_t cx;
204 uint32_t ecx;
205 uint64_t rcx;
206 } CPUM_UNION_NM(rcx);
207 union
208 {
209 uint8_t dl;
210 uint16_t dx;
211 uint32_t edx;
212 uint64_t rdx;
213 } CPUM_UNION_NM(rdx);
214 union
215 {
216 uint8_t bl;
217 uint16_t bx;
218 uint32_t ebx;
219 uint64_t rbx;
220 } CPUM_UNION_NM(rbx);
221 union
222 {
223 uint16_t sp;
224 uint32_t esp;
225 uint64_t rsp;
226 } CPUM_UNION_NM(rsp);
227 union
228 {
229 uint16_t bp;
230 uint32_t ebp;
231 uint64_t rbp;
232 } CPUM_UNION_NM(rbp);
233 union
234 {
235 uint8_t sil;
236 uint16_t si;
237 uint32_t esi;
238 uint64_t rsi;
239 } CPUM_UNION_NM(rsi);
240 union
241 {
242 uint8_t dil;
243 uint16_t di;
244 uint32_t edi;
245 uint64_t rdi;
246 } CPUM_UNION_NM(rdi);
247 uint64_t r8;
248 uint64_t r9;
249 uint64_t r10;
250 uint64_t r11;
251 uint64_t r12;
252 uint64_t r13;
253 uint64_t r14;
254 uint64_t r15;
255 /** @} */
256
257 /** @name Segment registers.
258 * @note These follow the encoding order (X86_SREG_XXX) and can be accessed as
259 * an array starting a es.
260 * @{ */
261 CPUMSELREG es;
262 CPUMSELREG cs;
263 CPUMSELREG ss;
264 CPUMSELREG ds;
265 CPUMSELREG fs;
266 CPUMSELREG gs;
267 /** @} */
268
269 /** The program counter. */
270 union
271 {
272 uint16_t ip;
273 uint32_t eip;
274 uint64_t rip;
275 } CPUM_UNION_NM(rip);
276
277 /** The flags register. */
278 union
279 {
280 X86EFLAGS eflags;
281 X86RFLAGS rflags;
282 } CPUM_UNION_NM(rflags);
283
284} CPUMCTXCORE;
285#pragma pack()
286
287
288/**
289 * SVM Host-state area (Nested Hw.virt - VirtualBox's layout).
290 */
291#pragma pack(1)
292typedef struct SVMHOSTSTATE
293{
294 uint64_t uEferMsr;
295 uint64_t uCr0;
296 uint64_t uCr4;
297 uint64_t uCr3;
298 uint64_t uRip;
299 uint64_t uRsp;
300 uint64_t uRax;
301 X86RFLAGS rflags;
302 CPUMSELREG es;
303 CPUMSELREG cs;
304 CPUMSELREG ss;
305 CPUMSELREG ds;
306 VBOXGDTR gdtr;
307 VBOXIDTR idtr;
308 uint8_t abPadding[4];
309} SVMHOSTSTATE;
310#pragma pack()
311/** Pointer to the SVMHOSTSTATE structure. */
312typedef SVMHOSTSTATE *PSVMHOSTSTATE;
313/** Pointer to a const SVMHOSTSTATE structure. */
314typedef const SVMHOSTSTATE *PCSVMHOSTSTATE;
315#ifndef VBOX_FOR_DTRACE_LIB
316AssertCompileSizeAlignment(SVMHOSTSTATE, 8);
317AssertCompileSize(SVMHOSTSTATE, 184);
318#endif
319
320
321/**
322 * CPU context.
323 */
324#pragma pack(1) /* for VBOXIDTR / VBOXGDTR. */
325typedef struct CPUMCTX
326{
327 /** CPUMCTXCORE Part.
328 * @{ */
329
330 /** General purpose registers. */
331 union /* no tag! */
332 {
333 /** The general purpose register array view, indexed by X86_GREG_XXX. */
334 CPUMCTXGREG aGRegs[16];
335
336 /** 64-bit general purpose register view. */
337 RT_GCC_EXTENSION struct /* no tag! */
338 {
339 uint64_t rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
340 } CPUM_STRUCT_NM(qw);
341 /** 64-bit general purpose register view. */
342 RT_GCC_EXTENSION struct /* no tag! */
343 {
344 uint64_t r0, r1, r2, r3, r4, r5, r6, r7;
345 } CPUM_STRUCT_NM(qw2);
346 /** 32-bit general purpose register view. */
347 RT_GCC_EXTENSION struct /* no tag! */
348 {
349 uint32_t eax, u32Pad00, ecx, u32Pad01, edx, u32Pad02, ebx, u32Pad03,
350 esp, u32Pad04, ebp, u32Pad05, esi, u32Pad06, edi, u32Pad07,
351 r8d, u32Pad08, r9d, u32Pad09, r10d, u32Pad10, r11d, u32Pad11,
352 r12d, u32Pad12, r13d, u32Pad13, r14d, u32Pad14, r15d, u32Pad15;
353 } CPUM_STRUCT_NM(dw);
354 /** 16-bit general purpose register view. */
355 RT_GCC_EXTENSION struct /* no tag! */
356 {
357 uint16_t ax, au16Pad00[3], cx, au16Pad01[3], dx, au16Pad02[3], bx, au16Pad03[3],
358 sp, au16Pad04[3], bp, au16Pad05[3], si, au16Pad06[3], di, au16Pad07[3],
359 r8w, au16Pad08[3], r9w, au16Pad09[3], r10w, au16Pad10[3], r11w, au16Pad11[3],
360 r12w, au16Pad12[3], r13w, au16Pad13[3], r14w, au16Pad14[3], r15w, au16Pad15[3];
361 } CPUM_STRUCT_NM(w);
362 RT_GCC_EXTENSION struct /* no tag! */
363 {
364 uint8_t al, ah, abPad00[6], cl, ch, abPad01[6], dl, dh, abPad02[6], bl, bh, abPad03[6],
365 spl, abPad04[7], bpl, abPad05[7], sil, abPad06[7], dil, abPad07[7],
366 r8l, abPad08[7], r9l, abPad09[7], r10l, abPad10[7], r11l, abPad11[7],
367 r12l, abPad12[7], r13l, abPad13[7], r14l, abPad14[7], r15l, abPad15[7];
368 } CPUM_STRUCT_NM(b);
369 } CPUM_UNION_NM(g);
370
371 /** Segment registers. */
372 union /* no tag! */
373 {
374 /** The segment register array view, indexed by X86_SREG_XXX. */
375 CPUMSELREG aSRegs[6];
376 /** The named segment register view. */
377 RT_GCC_EXTENSION struct /* no tag! */
378 {
379 CPUMSELREG es, cs, ss, ds, fs, gs;
380 } CPUM_STRUCT_NM(n);
381 } CPUM_UNION_NM(s);
382
383 /** The program counter. */
384 union
385 {
386 uint16_t ip;
387 uint32_t eip;
388 uint64_t rip;
389 } CPUM_UNION_NM(rip);
390
391 /** The flags register. */
392 union
393 {
394 X86EFLAGS eflags;
395 X86RFLAGS rflags;
396 } CPUM_UNION_NM(rflags);
397
398 /** @} */ /*(CPUMCTXCORE)*/
399
400
401 /** @name Control registers.
402 * @{ */
403 uint64_t cr0;
404 uint64_t cr2;
405 uint64_t cr3;
406 uint64_t cr4;
407 /** @} */
408
409 /** Debug registers.
410 * @remarks DR4 and DR5 should not be used since they are aliases for
411 * DR6 and DR7 respectively on both AMD and Intel CPUs.
412 * @remarks DR8-15 are currently not supported by AMD or Intel, so
413 * neither do we.
414 */
415 uint64_t dr[8];
416
417 /** Padding before the structure so the 64-bit member is correctly aligned.
418 * @todo fix this structure! */
419 uint16_t gdtrPadding[3];
420 /** Global Descriptor Table register. */
421 VBOXGDTR gdtr;
422
423 /** Padding before the structure so the 64-bit member is correctly aligned.
424 * @todo fix this structure! */
425 uint16_t idtrPadding[3];
426 /** Interrupt Descriptor Table register. */
427 VBOXIDTR idtr;
428
429 /** The task register.
430 * Only the guest context uses all the members. */
431 CPUMSELREG ldtr;
432 /** The task register.
433 * Only the guest context uses all the members. */
434 CPUMSELREG tr;
435
436 /** The sysenter msr registers.
437 * This member is not used by the hypervisor context. */
438 CPUMSYSENTER SysEnter;
439
440 /** @name System MSRs.
441 * @{ */
442 uint64_t msrEFER;
443 uint64_t msrSTAR; /**< Legacy syscall eip, cs & ss. */
444 uint64_t msrPAT; /**< Page attribute table. */
445 uint64_t msrLSTAR; /**< 64 bits mode syscall rip. */
446 uint64_t msrCSTAR; /**< Compatibility mode syscall rip. */
447 uint64_t msrSFMASK; /**< syscall flag mask. */
448 uint64_t msrKERNELGSBASE; /**< swapgs exchange value. */
449 uint64_t uMsrPadding0; /**< no longer used (used to hold a copy of APIC base MSR). */
450 /** @} */
451
452 /** The XCR0..XCR1 registers. */
453 uint64_t aXcr[2];
454 /** The mask to pass to XSAVE/XRSTOR in EDX:EAX. If zero we use
455 * FXSAVE/FXRSTOR (since bit 0 will always be set, we only need to test it). */
456 uint64_t fXStateMask;
457
458 /** Pointer to the FPU/SSE/AVX/XXXX state ring-0 mapping. */
459 R0PTRTYPE(PX86XSAVEAREA) pXStateR0;
460 /** Pointer to the FPU/SSE/AVX/XXXX state ring-3 mapping. */
461 R3PTRTYPE(PX86XSAVEAREA) pXStateR3;
462 /** Pointer to the FPU/SSE/AVX/XXXX state raw-mode mapping. */
463 RCPTRTYPE(PX86XSAVEAREA) pXStateRC;
464 /** State component offsets into pXState, UINT16_MAX if not present. */
465 uint16_t aoffXState[64];
466
467 /** 724 - Size padding. */
468 uint8_t abPadding[HC_ARCH_BITS == 64 ? 4 : 12];
469
470 /** 728 - Hardware virtualization state. */
471 struct
472 {
473 union /* no tag! */
474 {
475 struct
476 {
477 /** 728 - MSR holding physical address of the Guest's Host-state. */
478 uint64_t uMsrHSavePa;
479 /** 736 - Guest physical address of the nested-guest VMCB. */
480 RTGCPHYS GCPhysVmcb;
481 /** 744 - Cache of the nested-guest VMCB - R0 ptr. */
482 R0PTRTYPE(PSVMVMCB) pVmcbR0;
483 /** 752 / 748 - Cache of the nested-guest VMCB - R3 ptr. */
484 R3PTRTYPE(PSVMVMCB) pVmcbR3;
485#if HC_ARCH_BITS == 32
486 /** NA / 752 - Padding. */
487 uint8_t abPadding0[8];
488#endif
489 /** 760 - Guest's host-state save area. */
490 SVMHOSTSTATE HostState;
491 /** 944 - Global interrupt flag. */
492 uint8_t fGif;
493 /** 945 - Pause filter count. */
494 uint16_t cPauseFilter;
495 /** 947 - Pause filter count. */
496 uint16_t cPauseFilterThreshold;
497 /** 949 - Whether the injected event is subject to event intercepts. */
498 uint8_t fInterceptEvents;
499 /** 950 - Padding. */
500 uint8_t abPadding1[2];
501 /** 952 - MSR permission bitmap - R0 ptr. */
502 R0PTRTYPE(void *) pvMsrBitmapR0;
503 /** 960 / 956 - MSR permission bitmap - R3 ptr. */
504 R3PTRTYPE(void *) pvMsrBitmapR3;
505 /** 968 / 960 - IO permission bitmap - R0 ptr. */
506 R0PTRTYPE(void *) pvIoBitmapR0;
507 /** 976 / 964 - IO permission bitmap - R3 ptr. */
508 R3PTRTYPE(void *) pvIoBitmapR3;
509#if HC_ARCH_BITS == 32
510 /** NA / 968 - Padding. */
511 uint8_t abPadding2[16];
512#endif
513 } svm;
514#if 0
515 struct
516 {
517 } vmx;
518#endif
519 } CPUM_UNION_NM(s);
520
521 /** 984 - A subset of force flags that are preserved while running
522 * the nested-guest. */
523 uint32_t fLocalForcedActions;
524 /** 1212 - Padding. */
525 uint8_t abPadding1[36];
526 } hwvirt;
527 /** @} */
528} CPUMCTX;
529#pragma pack()
530
531#ifndef VBOX_FOR_DTRACE_LIB
532AssertCompileSizeAlignment(CPUMCTX, 64);
533AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rax, 0);
534AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rcx, 8);
535AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rdx, 16);
536AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rbx, 24);
537AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rsp, 32);
538AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rbp, 40);
539AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rsi, 48);
540AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rdi, 56);
541AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r8, 64);
542AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r9, 72);
543AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r10, 80);
544AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r11, 88);
545AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r12, 96);
546AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r13, 104);
547AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r14, 112);
548AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r15, 120);
549AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) es, 128);
550AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) cs, 152);
551AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) ss, 176);
552AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) ds, 200);
553AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) fs, 224);
554AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) gs, 248);
555AssertCompileMemberOffset(CPUMCTX, rip, 272);
556AssertCompileMemberOffset(CPUMCTX, rflags, 280);
557AssertCompileMemberOffset(CPUMCTX, cr0, 288);
558AssertCompileMemberOffset(CPUMCTX, cr2, 296);
559AssertCompileMemberOffset(CPUMCTX, cr3, 304);
560AssertCompileMemberOffset(CPUMCTX, cr4, 312);
561AssertCompileMemberOffset(CPUMCTX, dr, 320);
562AssertCompileMemberOffset(CPUMCTX, gdtr, 384+6);
563AssertCompileMemberOffset(CPUMCTX, idtr, 400+6);
564AssertCompileMemberOffset(CPUMCTX, ldtr, 416);
565AssertCompileMemberOffset(CPUMCTX, tr, 440);
566AssertCompileMemberOffset(CPUMCTX, SysEnter, 464);
567AssertCompileMemberOffset(CPUMCTX, msrEFER, 488);
568AssertCompileMemberOffset(CPUMCTX, msrSTAR, 496);
569AssertCompileMemberOffset(CPUMCTX, msrPAT, 504);
570AssertCompileMemberOffset(CPUMCTX, msrLSTAR, 512);
571AssertCompileMemberOffset(CPUMCTX, msrCSTAR, 520);
572AssertCompileMemberOffset(CPUMCTX, msrSFMASK, 528);
573AssertCompileMemberOffset(CPUMCTX, msrKERNELGSBASE, 536);
574AssertCompileMemberOffset(CPUMCTX, aXcr, 552);
575AssertCompileMemberOffset(CPUMCTX, fXStateMask, 568);
576AssertCompileMemberOffset(CPUMCTX, pXStateR0, 576);
577AssertCompileMemberOffset(CPUMCTX, pXStateR3, HC_ARCH_BITS == 64 ? 584 : 580);
578AssertCompileMemberOffset(CPUMCTX, pXStateRC, HC_ARCH_BITS == 64 ? 592 : 584);
579AssertCompileMemberOffset(CPUMCTX, aoffXState, HC_ARCH_BITS == 64 ? 596 : 588);
580AssertCompileMemberOffset(CPUMCTX, hwvirt, 728);
581AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.uMsrHSavePa, 728);
582AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.GCPhysVmcb, 736);
583AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pVmcbR0, 744);
584AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pVmcbR3, HC_ARCH_BITS == 64 ? 752 : 748);
585AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.HostState, 760);
586AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.fGif, 944);
587AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.cPauseFilter, 945);
588AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.cPauseFilterThreshold, 947);
589AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.fInterceptEvents, 949);
590AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvMsrBitmapR0, 952);
591AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvMsrBitmapR3, HC_ARCH_BITS == 64 ? 960 : 956);
592AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvIoBitmapR0, HC_ARCH_BITS == 64 ? 968 : 960);
593AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvIoBitmapR3, HC_ARCH_BITS == 64 ? 976 : 964);
594AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) fLocalForcedActions, 984);
595AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pVmcbR0, 8);
596AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvMsrBitmapR0, 8);
597AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvIoBitmapR0, 8);
598
599AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_NM(g.) aGRegs);
600AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r0);
601AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r1);
602AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r2);
603AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r3);
604AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r4);
605AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r5);
606AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r6);
607AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r7);
608AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) eax);
609AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) ecx);
610AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) edx);
611AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) ebx);
612AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) esp);
613AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) ebp);
614AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) esi);
615AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) edi);
616AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r8d);
617AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r9d);
618AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r10d);
619AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r11d);
620AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r12d);
621AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r13d);
622AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r14d);
623AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r15d);
624AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) ax);
625AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) cx);
626AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) dx);
627AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) bx);
628AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) sp);
629AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) bp);
630AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) si);
631AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) di);
632AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r8w);
633AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r9w);
634AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r10w);
635AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r11w);
636AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r12w);
637AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r13w);
638AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r14w);
639AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r15w);
640AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) al);
641AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) cl);
642AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) dl);
643AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) bl);
644AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) spl);
645AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) bpl);
646AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) sil);
647AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) dil);
648AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r8l);
649AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r9l);
650AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r10l);
651AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r11l);
652AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r12l);
653AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r13l);
654AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r14l);
655AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r15l);
656AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) es, CPUMCTX, CPUM_UNION_NM(s.) aSRegs);
657# ifndef _MSC_VER
658AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xAX]);
659AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xCX]);
660AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xDX]);
661AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xBX]);
662AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xSP]);
663AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xBP]);
664AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xSI]);
665AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xDI]);
666AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x8]);
667AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x9]);
668AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x10]);
669AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x11]);
670AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x12]);
671AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x13]);
672AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x14]);
673AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x15]);
674AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) es, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_ES]);
675AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) cs, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_CS]);
676AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) ss, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_SS]);
677AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) ds, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_DS]);
678AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) fs, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_FS]);
679AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) gs, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_GS]);
680# endif
681
682/**
683 * Calculates the pointer to the given extended state component.
684 *
685 * @returns Pointer of type @a a_PtrType
686 * @param a_pCtx Pointer to the context.
687 * @param a_iCompBit The extended state component bit number. This bit
688 * must be set in CPUMCTX::fXStateMask.
689 * @param a_PtrType The pointer type of the extended state component.
690 *
691 */
692#if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA)
693# define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
694 ([](PCCPUMCTX a_pLambdaCtx) -> a_PtrType \
695 { \
696 AssertCompile((a_iCompBit) < 64U); \
697 AssertMsg(a_pLambdaCtx->fXStateMask & RT_BIT_64(a_iCompBit), (#a_iCompBit "\n")); \
698 AssertMsg(a_pLambdaCtx->aoffXState[(a_iCompBit)] != UINT16_MAX, (#a_iCompBit "\n")); \
699 return (a_PtrType)((uint8_t *)a_pLambdaCtx->CTX_SUFF(pXState) + a_pLambdaCtx->aoffXState[(a_iCompBit)]); \
700 }(a_pCtx))
701#elif defined(VBOX_STRICT) && defined(__GNUC__)
702# define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
703 __extension__ (\
704 { \
705 AssertCompile((a_iCompBit) < 64U); \
706 AssertMsg((a_pCtx)->fXStateMask & RT_BIT_64(a_iCompBit), (#a_iCompBit "\n")); \
707 AssertMsg((a_pCtx)->aoffXState[(a_iCompBit)] != UINT16_MAX, (#a_iCompBit "\n")); \
708 (a_PtrType)((uint8_t *)(a_pCtx)->CTX_SUFF(pXState) + (a_pCtx)->aoffXState[(a_iCompBit)]); \
709 })
710#else
711# define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
712 ((a_PtrType)((uint8_t *)(a_pCtx)->CTX_SUFF(pXState) + (a_pCtx)->aoffXState[(a_iCompBit)]))
713#endif
714
715/**
716 * Gets the CPUMCTXCORE part of a CPUMCTX.
717 */
718# define CPUMCTX2CORE(pCtx) ((PCPUMCTXCORE)(void *)&(pCtx)->rax)
719
720/**
721 * Gets the CPUMCTX part from a CPUMCTXCORE.
722 */
723# define CPUMCTX_FROM_CORE(a_pCtxCore) RT_FROM_MEMBER(a_pCtxCore, CPUMCTX, rax)
724
725/**
726 * Gets the first selector register of a CPUMCTX.
727 *
728 * Use this with X86_SREG_COUNT to loop thru the selector registers.
729 */
730# define CPUMCTX_FIRST_SREG(a_pCtx) (&(a_pCtx)->es)
731
732#endif /* !VBOX_FOR_DTRACE_LIB */
733
734/**
735 * Additional guest MSRs (i.e. not part of the CPU context structure).
736 *
737 * @remarks Never change the order here because of the saved stated! The size
738 * can in theory be changed, but keep older VBox versions in mind.
739 */
740typedef union CPUMCTXMSRS
741{
742 struct
743 {
744 uint64_t TscAux; /**< MSR_K8_TSC_AUX */
745 uint64_t MiscEnable; /**< MSR_IA32_MISC_ENABLE */
746 uint64_t MtrrDefType; /**< IA32_MTRR_DEF_TYPE */
747 uint64_t MtrrFix64K_00000; /**< IA32_MTRR_FIX16K_80000 */
748 uint64_t MtrrFix16K_80000; /**< IA32_MTRR_FIX16K_80000 */
749 uint64_t MtrrFix16K_A0000; /**< IA32_MTRR_FIX16K_A0000 */
750 uint64_t MtrrFix4K_C0000; /**< IA32_MTRR_FIX4K_C0000 */
751 uint64_t MtrrFix4K_C8000; /**< IA32_MTRR_FIX4K_C8000 */
752 uint64_t MtrrFix4K_D0000; /**< IA32_MTRR_FIX4K_D0000 */
753 uint64_t MtrrFix4K_D8000; /**< IA32_MTRR_FIX4K_D8000 */
754 uint64_t MtrrFix4K_E0000; /**< IA32_MTRR_FIX4K_E0000 */
755 uint64_t MtrrFix4K_E8000; /**< IA32_MTRR_FIX4K_E8000 */
756 uint64_t MtrrFix4K_F0000; /**< IA32_MTRR_FIX4K_F0000 */
757 uint64_t MtrrFix4K_F8000; /**< IA32_MTRR_FIX4K_F8000 */
758 uint64_t PkgCStateCfgCtrl; /**< MSR_PKG_CST_CONFIG_CONTROL */
759 } msr;
760 uint64_t au64[64];
761} CPUMCTXMSRS;
762/** Pointer to the guest MSR state. */
763typedef CPUMCTXMSRS *PCPUMCTXMSRS;
764/** Pointer to the const guest MSR state. */
765typedef const CPUMCTXMSRS *PCCPUMCTXMSRS;
766
767/**
768 * The register set returned by a CPUID operation.
769 */
770typedef struct CPUMCPUID
771{
772 uint32_t uEax;
773 uint32_t uEbx;
774 uint32_t uEcx;
775 uint32_t uEdx;
776} CPUMCPUID;
777/** Pointer to a CPUID leaf. */
778typedef CPUMCPUID *PCPUMCPUID;
779/** Pointer to a const CPUID leaf. */
780typedef const CPUMCPUID *PCCPUMCPUID;
781
782/** @} */
783
784RT_C_DECLS_END
785
786#endif
787
Note: See TracBrowser for help on using the repository browser.

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