1 | /** @file
|
---|
2 | * CPUM - CPU Monitor(/ Manager), Context Structures.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 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 |
|
---|
38 | RT_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 | */
|
---|
48 | typedef 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
|
---|
76 | AssertCompileSize(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 */
|
---|
107 | typedef CPUMSELREG CPUMSELREGHID;
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * The sysenter register set.
|
---|
111 | */
|
---|
112 | typedef 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). */
|
---|
151 | typedef 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
|
---|
173 | AssertCompileSize(CPUMCTXGREG, 8);
|
---|
174 | AssertCompileMemberOffset(CPUMCTXGREG, CPUM_STRUCT_NM(s.) bLo, 0);
|
---|
175 | AssertCompileMemberOffset(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)
|
---|
187 | typedef 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)
|
---|
292 | typedef 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. */
|
---|
312 | typedef SVMHOSTSTATE *PSVMHOSTSTATE;
|
---|
313 | /** Pointer to a const SVMHOSTSTATE structure. */
|
---|
314 | typedef const SVMHOSTSTATE *PCSVMHOSTSTATE;
|
---|
315 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
316 | AssertCompileSizeAlignment(SVMHOSTSTATE, 8);
|
---|
317 | AssertCompileSize(SVMHOSTSTATE, 184);
|
---|
318 | #endif
|
---|
319 |
|
---|
320 |
|
---|
321 | /**
|
---|
322 | * CPU context.
|
---|
323 | */
|
---|
324 | #pragma pack(1) /* for VBOXIDTR / VBOXGDTR. */
|
---|
325 | typedef 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 | bool fGif;
|
---|
493 | /** 945 - Padding. */
|
---|
494 | uint8_t u8Padding0;
|
---|
495 | /** 946 - Pause filter count. */
|
---|
496 | uint16_t cPauseFilter;
|
---|
497 | /** 948 - Pause filter count. */
|
---|
498 | uint16_t cPauseFilterThreshold;
|
---|
499 | /** 950 - Whether the injected event is subject to event intercepts. */
|
---|
500 | bool fInterceptEvents;
|
---|
501 | /** 951 - Padding. */
|
---|
502 | uint8_t u8Padding1;
|
---|
503 | /** 952 - MSR permission bitmap - R0 ptr. */
|
---|
504 | R0PTRTYPE(void *) pvMsrBitmapR0;
|
---|
505 | /** 960 / 956 - MSR permission bitmap - R3 ptr. */
|
---|
506 | R3PTRTYPE(void *) pvMsrBitmapR3;
|
---|
507 | /** 968 / 960 - IO permission bitmap - R0 ptr. */
|
---|
508 | R0PTRTYPE(void *) pvIoBitmapR0;
|
---|
509 | /** 976 / 964 - IO permission bitmap - R3 ptr. */
|
---|
510 | R3PTRTYPE(void *) pvIoBitmapR3;
|
---|
511 | /** 984 / 968 - Host physical address of the nested-guest VMCB. */
|
---|
512 | RTHCPHYS HCPhysVmcb;
|
---|
513 | #if HC_ARCH_BITS == 32
|
---|
514 | /** NA / 976 - Padding. */
|
---|
515 | uint8_t abPadding2[16];
|
---|
516 | #endif
|
---|
517 | } svm;
|
---|
518 | #if 0
|
---|
519 | struct
|
---|
520 | {
|
---|
521 | } vmx;
|
---|
522 | #endif
|
---|
523 | } CPUM_UNION_NM(s);
|
---|
524 |
|
---|
525 | /** 992 - A subset of force flags that are preserved while running
|
---|
526 | * the nested-guest. */
|
---|
527 | uint32_t fLocalForcedActions;
|
---|
528 | /** 996 - Padding. */
|
---|
529 | uint8_t abPadding1[28];
|
---|
530 | } hwvirt;
|
---|
531 | /** @} */
|
---|
532 | } CPUMCTX;
|
---|
533 | #pragma pack()
|
---|
534 |
|
---|
535 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
536 | AssertCompileSizeAlignment(CPUMCTX, 64);
|
---|
537 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rax, 0);
|
---|
538 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rcx, 8);
|
---|
539 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rdx, 16);
|
---|
540 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rbx, 24);
|
---|
541 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rsp, 32);
|
---|
542 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rbp, 40);
|
---|
543 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rsi, 48);
|
---|
544 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) rdi, 56);
|
---|
545 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r8, 64);
|
---|
546 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r9, 72);
|
---|
547 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r10, 80);
|
---|
548 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r11, 88);
|
---|
549 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r12, 96);
|
---|
550 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r13, 104);
|
---|
551 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r14, 112);
|
---|
552 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(g.) CPUM_STRUCT_NM(qw.) r15, 120);
|
---|
553 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) es, 128);
|
---|
554 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) cs, 152);
|
---|
555 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) ss, 176);
|
---|
556 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) ds, 200);
|
---|
557 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) fs, 224);
|
---|
558 | AssertCompileMemberOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) gs, 248);
|
---|
559 | AssertCompileMemberOffset(CPUMCTX, rip, 272);
|
---|
560 | AssertCompileMemberOffset(CPUMCTX, rflags, 280);
|
---|
561 | AssertCompileMemberOffset(CPUMCTX, cr0, 288);
|
---|
562 | AssertCompileMemberOffset(CPUMCTX, cr2, 296);
|
---|
563 | AssertCompileMemberOffset(CPUMCTX, cr3, 304);
|
---|
564 | AssertCompileMemberOffset(CPUMCTX, cr4, 312);
|
---|
565 | AssertCompileMemberOffset(CPUMCTX, dr, 320);
|
---|
566 | AssertCompileMemberOffset(CPUMCTX, gdtr, 384+6);
|
---|
567 | AssertCompileMemberOffset(CPUMCTX, idtr, 400+6);
|
---|
568 | AssertCompileMemberOffset(CPUMCTX, ldtr, 416);
|
---|
569 | AssertCompileMemberOffset(CPUMCTX, tr, 440);
|
---|
570 | AssertCompileMemberOffset(CPUMCTX, SysEnter, 464);
|
---|
571 | AssertCompileMemberOffset(CPUMCTX, msrEFER, 488);
|
---|
572 | AssertCompileMemberOffset(CPUMCTX, msrSTAR, 496);
|
---|
573 | AssertCompileMemberOffset(CPUMCTX, msrPAT, 504);
|
---|
574 | AssertCompileMemberOffset(CPUMCTX, msrLSTAR, 512);
|
---|
575 | AssertCompileMemberOffset(CPUMCTX, msrCSTAR, 520);
|
---|
576 | AssertCompileMemberOffset(CPUMCTX, msrSFMASK, 528);
|
---|
577 | AssertCompileMemberOffset(CPUMCTX, msrKERNELGSBASE, 536);
|
---|
578 | AssertCompileMemberOffset(CPUMCTX, aXcr, 552);
|
---|
579 | AssertCompileMemberOffset(CPUMCTX, fXStateMask, 568);
|
---|
580 | AssertCompileMemberOffset(CPUMCTX, pXStateR0, 576);
|
---|
581 | AssertCompileMemberOffset(CPUMCTX, pXStateR3, HC_ARCH_BITS == 64 ? 584 : 580);
|
---|
582 | AssertCompileMemberOffset(CPUMCTX, pXStateRC, HC_ARCH_BITS == 64 ? 592 : 584);
|
---|
583 | AssertCompileMemberOffset(CPUMCTX, aoffXState, HC_ARCH_BITS == 64 ? 596 : 588);
|
---|
584 | AssertCompileMemberOffset(CPUMCTX, hwvirt, 728);
|
---|
585 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.uMsrHSavePa, 728);
|
---|
586 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.GCPhysVmcb, 736);
|
---|
587 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pVmcbR0, 744);
|
---|
588 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pVmcbR3, HC_ARCH_BITS == 64 ? 752 : 748);
|
---|
589 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.HostState, 760);
|
---|
590 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.fGif, 944);
|
---|
591 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.cPauseFilter, 946);
|
---|
592 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.cPauseFilterThreshold, 948);
|
---|
593 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.fInterceptEvents, 950);
|
---|
594 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvMsrBitmapR0, 952);
|
---|
595 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvMsrBitmapR3, HC_ARCH_BITS == 64 ? 960 : 956);
|
---|
596 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvIoBitmapR0, HC_ARCH_BITS == 64 ? 968 : 960);
|
---|
597 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvIoBitmapR3, HC_ARCH_BITS == 64 ? 976 : 964);
|
---|
598 | AssertCompileMemberOffset(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.HCPhysVmcb, HC_ARCH_BITS == 64 ? 984 : 968);
|
---|
599 | AssertCompileMemberOffset(CPUMCTX, hwvirt.fLocalForcedActions, 992);
|
---|
600 | AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pVmcbR0, 8);
|
---|
601 | AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvMsrBitmapR0, 8);
|
---|
602 | AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.pvIoBitmapR0, 8);
|
---|
603 |
|
---|
604 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_NM(g.) aGRegs);
|
---|
605 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r0);
|
---|
606 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r1);
|
---|
607 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r2);
|
---|
608 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r3);
|
---|
609 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r4);
|
---|
610 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r5);
|
---|
611 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r6);
|
---|
612 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw2.) r7);
|
---|
613 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) eax);
|
---|
614 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) ecx);
|
---|
615 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) edx);
|
---|
616 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) ebx);
|
---|
617 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) esp);
|
---|
618 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) ebp);
|
---|
619 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) esi);
|
---|
620 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) edi);
|
---|
621 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r8d);
|
---|
622 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r9d);
|
---|
623 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r10d);
|
---|
624 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r11d);
|
---|
625 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r12d);
|
---|
626 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r13d);
|
---|
627 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r14d);
|
---|
628 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_STRUCT_NM(g,dw.) r15d);
|
---|
629 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) ax);
|
---|
630 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) cx);
|
---|
631 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) dx);
|
---|
632 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) bx);
|
---|
633 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) sp);
|
---|
634 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) bp);
|
---|
635 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) si);
|
---|
636 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) di);
|
---|
637 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r8w);
|
---|
638 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r9w);
|
---|
639 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r10w);
|
---|
640 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r11w);
|
---|
641 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r12w);
|
---|
642 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r13w);
|
---|
643 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r14w);
|
---|
644 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_STRUCT_NM(g,w.) r15w);
|
---|
645 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) al);
|
---|
646 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) cl);
|
---|
647 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) dl);
|
---|
648 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) bl);
|
---|
649 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) spl);
|
---|
650 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) bpl);
|
---|
651 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) sil);
|
---|
652 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) dil);
|
---|
653 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r8l);
|
---|
654 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r9l);
|
---|
655 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r10l);
|
---|
656 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r11l);
|
---|
657 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r12l);
|
---|
658 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r13l);
|
---|
659 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r14l);
|
---|
660 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_STRUCT_NM(g,b.) r15l);
|
---|
661 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_NM(s.) CPUM_STRUCT_NM(n.) es, CPUMCTX, CPUM_UNION_NM(s.) aSRegs);
|
---|
662 | # ifndef _MSC_VER
|
---|
663 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rax, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xAX]);
|
---|
664 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rcx, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xCX]);
|
---|
665 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdx, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xDX]);
|
---|
666 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbx, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xBX]);
|
---|
667 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsp, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xSP]);
|
---|
668 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rbp, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xBP]);
|
---|
669 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rsi, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xSI]);
|
---|
670 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) rdi, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_xDI]);
|
---|
671 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r8, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x8]);
|
---|
672 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r9, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x9]);
|
---|
673 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r10, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x10]);
|
---|
674 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r11, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x11]);
|
---|
675 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r12, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x12]);
|
---|
676 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r13, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x13]);
|
---|
677 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r14, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x14]);
|
---|
678 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(g,qw.) r15, CPUMCTX, CPUM_UNION_NM(g.) aGRegs[X86_GREG_x15]);
|
---|
679 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) es, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_ES]);
|
---|
680 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) cs, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_CS]);
|
---|
681 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) ss, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_SS]);
|
---|
682 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) ds, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_DS]);
|
---|
683 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) fs, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_FS]);
|
---|
684 | AssertCompileMembersAtSameOffset(CPUMCTX, CPUM_UNION_STRUCT_NM(s,n.) gs, CPUMCTX, CPUM_UNION_NM(s.) aSRegs[X86_SREG_GS]);
|
---|
685 | # endif
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Calculates the pointer to the given extended state component.
|
---|
689 | *
|
---|
690 | * @returns Pointer of type @a a_PtrType
|
---|
691 | * @param a_pCtx Pointer to the context.
|
---|
692 | * @param a_iCompBit The extended state component bit number. This bit
|
---|
693 | * must be set in CPUMCTX::fXStateMask.
|
---|
694 | * @param a_PtrType The pointer type of the extended state component.
|
---|
695 | *
|
---|
696 | */
|
---|
697 | #if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA)
|
---|
698 | # define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
|
---|
699 | ([](PCCPUMCTX a_pLambdaCtx) -> a_PtrType \
|
---|
700 | { \
|
---|
701 | AssertCompile((a_iCompBit) < 64U); \
|
---|
702 | AssertMsg(a_pLambdaCtx->fXStateMask & RT_BIT_64(a_iCompBit), (#a_iCompBit "\n")); \
|
---|
703 | AssertMsg(a_pLambdaCtx->aoffXState[(a_iCompBit)] != UINT16_MAX, (#a_iCompBit "\n")); \
|
---|
704 | return (a_PtrType)((uint8_t *)a_pLambdaCtx->CTX_SUFF(pXState) + a_pLambdaCtx->aoffXState[(a_iCompBit)]); \
|
---|
705 | }(a_pCtx))
|
---|
706 | #elif defined(VBOX_STRICT) && defined(__GNUC__)
|
---|
707 | # define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
|
---|
708 | __extension__ (\
|
---|
709 | { \
|
---|
710 | AssertCompile((a_iCompBit) < 64U); \
|
---|
711 | AssertMsg((a_pCtx)->fXStateMask & RT_BIT_64(a_iCompBit), (#a_iCompBit "\n")); \
|
---|
712 | AssertMsg((a_pCtx)->aoffXState[(a_iCompBit)] != UINT16_MAX, (#a_iCompBit "\n")); \
|
---|
713 | (a_PtrType)((uint8_t *)(a_pCtx)->CTX_SUFF(pXState) + (a_pCtx)->aoffXState[(a_iCompBit)]); \
|
---|
714 | })
|
---|
715 | #else
|
---|
716 | # define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
|
---|
717 | ((a_PtrType)((uint8_t *)(a_pCtx)->CTX_SUFF(pXState) + (a_pCtx)->aoffXState[(a_iCompBit)]))
|
---|
718 | #endif
|
---|
719 |
|
---|
720 | /**
|
---|
721 | * Gets the CPUMCTXCORE part of a CPUMCTX.
|
---|
722 | */
|
---|
723 | # define CPUMCTX2CORE(pCtx) ((PCPUMCTXCORE)(void *)&(pCtx)->rax)
|
---|
724 |
|
---|
725 | /**
|
---|
726 | * Gets the CPUMCTX part from a CPUMCTXCORE.
|
---|
727 | */
|
---|
728 | # define CPUMCTX_FROM_CORE(a_pCtxCore) RT_FROM_MEMBER(a_pCtxCore, CPUMCTX, rax)
|
---|
729 |
|
---|
730 | /**
|
---|
731 | * Gets the first selector register of a CPUMCTX.
|
---|
732 | *
|
---|
733 | * Use this with X86_SREG_COUNT to loop thru the selector registers.
|
---|
734 | */
|
---|
735 | # define CPUMCTX_FIRST_SREG(a_pCtx) (&(a_pCtx)->es)
|
---|
736 |
|
---|
737 | #endif /* !VBOX_FOR_DTRACE_LIB */
|
---|
738 |
|
---|
739 | /**
|
---|
740 | * Additional guest MSRs (i.e. not part of the CPU context structure).
|
---|
741 | *
|
---|
742 | * @remarks Never change the order here because of the saved stated! The size
|
---|
743 | * can in theory be changed, but keep older VBox versions in mind.
|
---|
744 | */
|
---|
745 | typedef union CPUMCTXMSRS
|
---|
746 | {
|
---|
747 | struct
|
---|
748 | {
|
---|
749 | uint64_t TscAux; /**< MSR_K8_TSC_AUX */
|
---|
750 | uint64_t MiscEnable; /**< MSR_IA32_MISC_ENABLE */
|
---|
751 | uint64_t MtrrDefType; /**< IA32_MTRR_DEF_TYPE */
|
---|
752 | uint64_t MtrrFix64K_00000; /**< IA32_MTRR_FIX16K_80000 */
|
---|
753 | uint64_t MtrrFix16K_80000; /**< IA32_MTRR_FIX16K_80000 */
|
---|
754 | uint64_t MtrrFix16K_A0000; /**< IA32_MTRR_FIX16K_A0000 */
|
---|
755 | uint64_t MtrrFix4K_C0000; /**< IA32_MTRR_FIX4K_C0000 */
|
---|
756 | uint64_t MtrrFix4K_C8000; /**< IA32_MTRR_FIX4K_C8000 */
|
---|
757 | uint64_t MtrrFix4K_D0000; /**< IA32_MTRR_FIX4K_D0000 */
|
---|
758 | uint64_t MtrrFix4K_D8000; /**< IA32_MTRR_FIX4K_D8000 */
|
---|
759 | uint64_t MtrrFix4K_E0000; /**< IA32_MTRR_FIX4K_E0000 */
|
---|
760 | uint64_t MtrrFix4K_E8000; /**< IA32_MTRR_FIX4K_E8000 */
|
---|
761 | uint64_t MtrrFix4K_F0000; /**< IA32_MTRR_FIX4K_F0000 */
|
---|
762 | uint64_t MtrrFix4K_F8000; /**< IA32_MTRR_FIX4K_F8000 */
|
---|
763 | uint64_t PkgCStateCfgCtrl; /**< MSR_PKG_CST_CONFIG_CONTROL */
|
---|
764 | } msr;
|
---|
765 | uint64_t au64[64];
|
---|
766 | } CPUMCTXMSRS;
|
---|
767 | /** Pointer to the guest MSR state. */
|
---|
768 | typedef CPUMCTXMSRS *PCPUMCTXMSRS;
|
---|
769 | /** Pointer to the const guest MSR state. */
|
---|
770 | typedef const CPUMCTXMSRS *PCCPUMCTXMSRS;
|
---|
771 |
|
---|
772 | /**
|
---|
773 | * The register set returned by a CPUID operation.
|
---|
774 | */
|
---|
775 | typedef struct CPUMCPUID
|
---|
776 | {
|
---|
777 | uint32_t uEax;
|
---|
778 | uint32_t uEbx;
|
---|
779 | uint32_t uEcx;
|
---|
780 | uint32_t uEdx;
|
---|
781 | } CPUMCPUID;
|
---|
782 | /** Pointer to a CPUID leaf. */
|
---|
783 | typedef CPUMCPUID *PCPUMCPUID;
|
---|
784 | /** Pointer to a const CPUID leaf. */
|
---|
785 | typedef const CPUMCPUID *PCCPUMCPUID;
|
---|
786 |
|
---|
787 | /** @} */
|
---|
788 |
|
---|
789 | RT_C_DECLS_END
|
---|
790 |
|
---|
791 | #endif
|
---|
792 |
|
---|