VirtualBox

source: vbox/trunk/src/VBox/VMM/include/HMInternal.h@ 87491

Last change on this file since 87491 was 87491, checked in by vboxsync, 4 years ago

VMM/HMVMX: Some stats.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 67.2 KB
Line 
1/* $Id: HMInternal.h 87491 2021-01-30 01:15:50Z vboxsync $ */
2/** @file
3 * HM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VMM_INCLUDED_SRC_include_HMInternal_h
19#define VMM_INCLUDED_SRC_include_HMInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/cdefs.h>
25#include <VBox/types.h>
26#include <VBox/vmm/stam.h>
27#include <VBox/dis.h>
28#include <VBox/vmm/hm.h>
29#include <VBox/vmm/hm_vmx.h>
30#include <VBox/vmm/hm_svm.h>
31#include <VBox/vmm/pgm.h>
32#include <VBox/vmm/cpum.h>
33#include <VBox/vmm/trpm.h>
34#include <iprt/memobj.h>
35#include <iprt/cpuset.h>
36#include <iprt/mp.h>
37#include <iprt/avl.h>
38#include <iprt/string.h>
39
40#if HC_ARCH_BITS == 32
41# error "32-bit hosts are no longer supported. Go back to 6.0 or earlier!"
42#endif
43
44/** @def HM_PROFILE_EXIT_DISPATCH
45 * Enables profiling of the VM exit handler dispatching. */
46#if 0 || defined(DOXYGEN_RUNNING)
47# define HM_PROFILE_EXIT_DISPATCH
48#endif
49
50RT_C_DECLS_BEGIN
51
52
53/** @defgroup grp_hm_int Internal
54 * @ingroup grp_hm
55 * @internal
56 * @{
57 */
58
59/** @name HM_CHANGED_XXX
60 * HM CPU-context changed flags.
61 *
62 * These flags are used to keep track of which registers and state has been
63 * modified since they were imported back into the guest-CPU context.
64 *
65 * @{
66 */
67#define HM_CHANGED_HOST_CONTEXT UINT64_C(0x0000000000000001)
68#define HM_CHANGED_GUEST_RIP UINT64_C(0x0000000000000004)
69#define HM_CHANGED_GUEST_RFLAGS UINT64_C(0x0000000000000008)
70
71#define HM_CHANGED_GUEST_RAX UINT64_C(0x0000000000000010)
72#define HM_CHANGED_GUEST_RCX UINT64_C(0x0000000000000020)
73#define HM_CHANGED_GUEST_RDX UINT64_C(0x0000000000000040)
74#define HM_CHANGED_GUEST_RBX UINT64_C(0x0000000000000080)
75#define HM_CHANGED_GUEST_RSP UINT64_C(0x0000000000000100)
76#define HM_CHANGED_GUEST_RBP UINT64_C(0x0000000000000200)
77#define HM_CHANGED_GUEST_RSI UINT64_C(0x0000000000000400)
78#define HM_CHANGED_GUEST_RDI UINT64_C(0x0000000000000800)
79#define HM_CHANGED_GUEST_R8_R15 UINT64_C(0x0000000000001000)
80#define HM_CHANGED_GUEST_GPRS_MASK UINT64_C(0x0000000000001ff0)
81
82#define HM_CHANGED_GUEST_ES UINT64_C(0x0000000000002000)
83#define HM_CHANGED_GUEST_CS UINT64_C(0x0000000000004000)
84#define HM_CHANGED_GUEST_SS UINT64_C(0x0000000000008000)
85#define HM_CHANGED_GUEST_DS UINT64_C(0x0000000000010000)
86#define HM_CHANGED_GUEST_FS UINT64_C(0x0000000000020000)
87#define HM_CHANGED_GUEST_GS UINT64_C(0x0000000000040000)
88#define HM_CHANGED_GUEST_SREG_MASK UINT64_C(0x000000000007e000)
89
90#define HM_CHANGED_GUEST_GDTR UINT64_C(0x0000000000080000)
91#define HM_CHANGED_GUEST_IDTR UINT64_C(0x0000000000100000)
92#define HM_CHANGED_GUEST_LDTR UINT64_C(0x0000000000200000)
93#define HM_CHANGED_GUEST_TR UINT64_C(0x0000000000400000)
94#define HM_CHANGED_GUEST_TABLE_MASK UINT64_C(0x0000000000780000)
95
96#define HM_CHANGED_GUEST_CR0 UINT64_C(0x0000000000800000)
97#define HM_CHANGED_GUEST_CR2 UINT64_C(0x0000000001000000)
98#define HM_CHANGED_GUEST_CR3 UINT64_C(0x0000000002000000)
99#define HM_CHANGED_GUEST_CR4 UINT64_C(0x0000000004000000)
100#define HM_CHANGED_GUEST_CR_MASK UINT64_C(0x0000000007800000)
101
102#define HM_CHANGED_GUEST_APIC_TPR UINT64_C(0x0000000008000000)
103#define HM_CHANGED_GUEST_EFER_MSR UINT64_C(0x0000000010000000)
104
105#define HM_CHANGED_GUEST_DR0_DR3 UINT64_C(0x0000000020000000)
106#define HM_CHANGED_GUEST_DR6 UINT64_C(0x0000000040000000)
107#define HM_CHANGED_GUEST_DR7 UINT64_C(0x0000000080000000)
108#define HM_CHANGED_GUEST_DR_MASK UINT64_C(0x00000000e0000000)
109
110#define HM_CHANGED_GUEST_X87 UINT64_C(0x0000000100000000)
111#define HM_CHANGED_GUEST_SSE_AVX UINT64_C(0x0000000200000000)
112#define HM_CHANGED_GUEST_OTHER_XSAVE UINT64_C(0x0000000400000000)
113#define HM_CHANGED_GUEST_XCRx UINT64_C(0x0000000800000000)
114
115#define HM_CHANGED_GUEST_KERNEL_GS_BASE UINT64_C(0x0000001000000000)
116#define HM_CHANGED_GUEST_SYSCALL_MSRS UINT64_C(0x0000002000000000)
117#define HM_CHANGED_GUEST_SYSENTER_CS_MSR UINT64_C(0x0000004000000000)
118#define HM_CHANGED_GUEST_SYSENTER_EIP_MSR UINT64_C(0x0000008000000000)
119#define HM_CHANGED_GUEST_SYSENTER_ESP_MSR UINT64_C(0x0000010000000000)
120#define HM_CHANGED_GUEST_SYSENTER_MSR_MASK UINT64_C(0x000001c000000000)
121#define HM_CHANGED_GUEST_TSC_AUX UINT64_C(0x0000020000000000)
122#define HM_CHANGED_GUEST_OTHER_MSRS UINT64_C(0x0000040000000000)
123#define HM_CHANGED_GUEST_ALL_MSRS ( HM_CHANGED_GUEST_EFER \
124 | HM_CHANGED_GUEST_KERNEL_GS_BASE \
125 | HM_CHANGED_GUEST_SYSCALL_MSRS \
126 | HM_CHANGED_GUEST_SYSENTER_MSR_MASK \
127 | HM_CHANGED_GUEST_TSC_AUX \
128 | HM_CHANGED_GUEST_OTHER_MSRS)
129
130#define HM_CHANGED_GUEST_HWVIRT UINT64_C(0x0000080000000000)
131#define HM_CHANGED_GUEST_MASK UINT64_C(0x00000ffffffffffc)
132
133#define HM_CHANGED_KEEPER_STATE_MASK UINT64_C(0xffff000000000000)
134
135#define HM_CHANGED_VMX_XCPT_INTERCEPTS UINT64_C(0x0001000000000000)
136#define HM_CHANGED_VMX_GUEST_AUTO_MSRS UINT64_C(0x0002000000000000)
137#define HM_CHANGED_VMX_GUEST_LAZY_MSRS UINT64_C(0x0004000000000000)
138#define HM_CHANGED_VMX_ENTRY_EXIT_CTLS UINT64_C(0x0008000000000000)
139#define HM_CHANGED_VMX_MASK UINT64_C(0x000f000000000000)
140#define HM_CHANGED_VMX_HOST_GUEST_SHARED_STATE ( HM_CHANGED_GUEST_DR_MASK \
141 | HM_CHANGED_VMX_GUEST_LAZY_MSRS)
142
143#define HM_CHANGED_SVM_XCPT_INTERCEPTS UINT64_C(0x0001000000000000)
144#define HM_CHANGED_SVM_MASK UINT64_C(0x0001000000000000)
145#define HM_CHANGED_SVM_HOST_GUEST_SHARED_STATE HM_CHANGED_GUEST_DR_MASK
146
147#define HM_CHANGED_ALL_GUEST ( HM_CHANGED_GUEST_MASK \
148 | HM_CHANGED_KEEPER_STATE_MASK)
149
150/** Mask of what state might have changed when IEM raised an exception.
151 * This is a based on IEM_CPUMCTX_EXTRN_XCPT_MASK. */
152#define HM_CHANGED_RAISED_XCPT_MASK ( HM_CHANGED_GUEST_GPRS_MASK \
153 | HM_CHANGED_GUEST_RIP \
154 | HM_CHANGED_GUEST_RFLAGS \
155 | HM_CHANGED_GUEST_SS \
156 | HM_CHANGED_GUEST_CS \
157 | HM_CHANGED_GUEST_CR0 \
158 | HM_CHANGED_GUEST_CR3 \
159 | HM_CHANGED_GUEST_CR4 \
160 | HM_CHANGED_GUEST_APIC_TPR \
161 | HM_CHANGED_GUEST_EFER_MSR \
162 | HM_CHANGED_GUEST_DR7 \
163 | HM_CHANGED_GUEST_CR2 \
164 | HM_CHANGED_GUEST_SREG_MASK \
165 | HM_CHANGED_GUEST_TABLE_MASK)
166
167#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
168/** Mask of what state might have changed when \#VMEXIT is emulated. */
169# define HM_CHANGED_SVM_VMEXIT_MASK ( HM_CHANGED_GUEST_RSP \
170 | HM_CHANGED_GUEST_RAX \
171 | HM_CHANGED_GUEST_RIP \
172 | HM_CHANGED_GUEST_RFLAGS \
173 | HM_CHANGED_GUEST_CS \
174 | HM_CHANGED_GUEST_SS \
175 | HM_CHANGED_GUEST_DS \
176 | HM_CHANGED_GUEST_ES \
177 | HM_CHANGED_GUEST_GDTR \
178 | HM_CHANGED_GUEST_IDTR \
179 | HM_CHANGED_GUEST_CR_MASK \
180 | HM_CHANGED_GUEST_EFER_MSR \
181 | HM_CHANGED_GUEST_DR6 \
182 | HM_CHANGED_GUEST_DR7 \
183 | HM_CHANGED_GUEST_OTHER_MSRS \
184 | HM_CHANGED_GUEST_HWVIRT \
185 | HM_CHANGED_SVM_MASK \
186 | HM_CHANGED_GUEST_APIC_TPR)
187
188/** Mask of what state might have changed when VMRUN is emulated. */
189# define HM_CHANGED_SVM_VMRUN_MASK HM_CHANGED_SVM_VMEXIT_MASK
190#endif
191#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
192/** Mask of what state might have changed when VM-exit is emulated.
193 *
194 * This is currently unused, but keeping it here in case we can get away a bit more
195 * fine-grained state handling.
196 *
197 * @note Update IEM_CPUMCTX_EXTRN_VMX_VMEXIT_MASK when this changes. */
198# define HM_CHANGED_VMX_VMEXIT_MASK ( HM_CHANGED_GUEST_CR0 | HM_CHANGED_GUEST_CR3 | HM_CHANGED_GUEST_CR4 \
199 | HM_CHANGED_GUEST_DR7 | HM_CHANGED_GUEST_DR6 \
200 | HM_CHANGED_GUEST_EFER_MSR \
201 | HM_CHANGED_GUEST_SYSENTER_MSR_MASK \
202 | HM_CHANGED_GUEST_OTHER_MSRS /* for PAT MSR */ \
203 | HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RSP | HM_CHANGED_GUEST_RFLAGS \
204 | HM_CHANGED_GUEST_SREG_MASK \
205 | HM_CHANGED_GUEST_TR \
206 | HM_CHANGED_GUEST_LDTR | HM_CHANGED_GUEST_GDTR | HM_CHANGED_GUEST_IDTR \
207 | HM_CHANGED_GUEST_HWVIRT )
208#endif
209/** @} */
210
211/** Maximum number of exit reason statistics counters. */
212#define MAX_EXITREASON_STAT 0x100
213#define MASK_EXITREASON_STAT 0xff
214#define MASK_INJECT_IRQ_STAT 0xff
215
216/** Size for the EPT identity page table (1024 4 MB pages to cover the entire address space). */
217#define HM_EPT_IDENTITY_PG_TABLE_SIZE PAGE_SIZE
218/** Size of the TSS structure + 2 pages for the IO bitmap + end byte. */
219#define HM_VTX_TSS_SIZE (sizeof(VBOXTSS) + 2 * PAGE_SIZE + 1)
220/** Total guest mapped memory needed. */
221#define HM_VTX_TOTAL_DEVHEAP_MEM (HM_EPT_IDENTITY_PG_TABLE_SIZE + HM_VTX_TSS_SIZE)
222
223
224/** @name Macros for enabling and disabling preemption.
225 * These are really just for hiding the RTTHREADPREEMPTSTATE and asserting that
226 * preemption has already been disabled when there is no context hook.
227 * @{ */
228#ifdef VBOX_STRICT
229# define HM_DISABLE_PREEMPT(a_pVCpu) \
230 RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
231 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD) || VMMR0ThreadCtxHookIsEnabled((a_pVCpu))); \
232 RTThreadPreemptDisable(&PreemptStateInternal)
233#else
234# define HM_DISABLE_PREEMPT(a_pVCpu) \
235 RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
236 RTThreadPreemptDisable(&PreemptStateInternal)
237#endif /* VBOX_STRICT */
238#define HM_RESTORE_PREEMPT() do { RTThreadPreemptRestore(&PreemptStateInternal); } while(0)
239/** @} */
240
241
242/** @name HM saved state versions.
243 * @{
244 */
245#define HM_SAVED_STATE_VERSION HM_SAVED_STATE_VERSION_SVM_NESTED_HWVIRT
246#define HM_SAVED_STATE_VERSION_SVM_NESTED_HWVIRT 6
247#define HM_SAVED_STATE_VERSION_TPR_PATCHING 5
248#define HM_SAVED_STATE_VERSION_NO_TPR_PATCHING 4
249#define HM_SAVED_STATE_VERSION_2_0_X 3
250/** @} */
251
252
253/**
254 * HM physical (host) CPU information.
255 */
256typedef struct HMPHYSCPU
257{
258 /** The CPU ID. */
259 RTCPUID idCpu;
260 /** The VM_HSAVE_AREA (AMD-V) / VMXON region (Intel) memory backing. */
261 RTR0MEMOBJ hMemObj;
262 /** The physical address of the first page in hMemObj (it's a
263 * physcially contigous allocation if it spans multiple pages). */
264 RTHCPHYS HCPhysMemObj;
265 /** The address of the memory (for pfnEnable). */
266 void *pvMemObj;
267 /** Current ASID (AMD-V) / VPID (Intel). */
268 uint32_t uCurrentAsid;
269 /** TLB flush count. */
270 uint32_t cTlbFlushes;
271 /** Whether to flush each new ASID/VPID before use. */
272 bool fFlushAsidBeforeUse;
273 /** Configured for VT-x or AMD-V. */
274 bool fConfigured;
275 /** Set if the VBOX_HWVIRTEX_IGNORE_SVM_IN_USE hack is active. */
276 bool fIgnoreAMDVInUseError;
277 /** Whether CR4.VMXE was already enabled prior to us enabling it. */
278 bool fVmxeAlreadyEnabled;
279 /** In use by our code. (for power suspend) */
280 bool volatile fInUse;
281#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
282 /** Nested-guest union (put data common to SVM/VMX outside the union). */
283 union
284 {
285 /** Nested-guest SVM data. */
286 struct
287 {
288 /** The active nested-guest MSR permission bitmap memory backing. */
289 RTR0MEMOBJ hNstGstMsrpm;
290 /** The physical address of the first page in hNstGstMsrpm (physcially
291 * contiguous allocation). */
292 RTHCPHYS HCPhysNstGstMsrpm;
293 /** The address of the active nested-guest MSRPM. */
294 void *pvNstGstMsrpm;
295 } svm;
296 /** @todo Nested-VMX. */
297 } n;
298#endif
299} HMPHYSCPU;
300/** Pointer to HMPHYSCPU struct. */
301typedef HMPHYSCPU *PHMPHYSCPU;
302/** Pointer to a const HMPHYSCPU struct. */
303typedef const HMPHYSCPU *PCHMPHYSCPU;
304
305/**
306 * TPR-instruction type.
307 */
308typedef enum
309{
310 HMTPRINSTR_INVALID,
311 HMTPRINSTR_READ,
312 HMTPRINSTR_READ_SHR4,
313 HMTPRINSTR_WRITE_REG,
314 HMTPRINSTR_WRITE_IMM,
315 HMTPRINSTR_JUMP_REPLACEMENT,
316 /** The usual 32-bit paranoia. */
317 HMTPRINSTR_32BIT_HACK = 0x7fffffff
318} HMTPRINSTR;
319
320/**
321 * TPR patch information.
322 */
323typedef struct
324{
325 /** The key is the address of patched instruction. (32 bits GC ptr) */
326 AVLOU32NODECORE Core;
327 /** Original opcode. */
328 uint8_t aOpcode[16];
329 /** Instruction size. */
330 uint32_t cbOp;
331 /** Replacement opcode. */
332 uint8_t aNewOpcode[16];
333 /** Replacement instruction size. */
334 uint32_t cbNewOp;
335 /** Instruction type. */
336 HMTPRINSTR enmType;
337 /** Source operand. */
338 uint32_t uSrcOperand;
339 /** Destination operand. */
340 uint32_t uDstOperand;
341 /** Number of times the instruction caused a fault. */
342 uint32_t cFaults;
343 /** Patch address of the jump replacement. */
344 RTGCPTR32 pJumpTarget;
345} HMTPRPATCH;
346/** Pointer to HMTPRPATCH. */
347typedef HMTPRPATCH *PHMTPRPATCH;
348/** Pointer to a const HMTPRPATCH. */
349typedef const HMTPRPATCH *PCHMTPRPATCH;
350
351
352/**
353 * Makes a HMEXITSTAT::uKey value from a program counter and an exit code.
354 *
355 * @returns 64-bit key
356 * @param a_uPC The RIP + CS.BASE value of the exit.
357 * @param a_uExit The exit code.
358 * @todo Add CPL?
359 */
360#define HMEXITSTAT_MAKE_KEY(a_uPC, a_uExit) (((a_uPC) & UINT64_C(0x0000ffffffffffff)) | (uint64_t)(a_uExit) << 48)
361
362typedef struct HMEXITINFO
363{
364 /** See HMEXITSTAT_MAKE_KEY(). */
365 uint64_t uKey;
366 /** Number of recent hits (depreciates with time). */
367 uint32_t volatile cHits;
368 /** The age + lock. */
369 uint16_t volatile uAge;
370 /** Action or action table index. */
371 uint16_t iAction;
372} HMEXITINFO;
373AssertCompileSize(HMEXITINFO, 16); /* Lots of these guys, so don't add any unnecessary stuff! */
374
375typedef struct HMEXITHISTORY
376{
377 /** The exit timestamp. */
378 uint64_t uTscExit;
379 /** The index of the corresponding HMEXITINFO entry.
380 * UINT32_MAX if none (too many collisions, race, whatever). */
381 uint32_t iExitInfo;
382 /** Figure out later, needed for padding now. */
383 uint32_t uSomeClueOrSomething;
384} HMEXITHISTORY;
385
386/**
387 * Switcher function, HC to the special 64-bit RC.
388 *
389 * @param pVM The cross context VM structure.
390 * @param offCpumVCpu Offset from pVM->cpum to pVM->aCpus[idCpu].cpum.
391 * @returns Return code indicating the action to take.
392 */
393typedef DECLCALLBACKTYPE(int, FNHMSWITCHERHC,(PVM pVM, uint32_t offCpumVCpu));
394/** Pointer to switcher function. */
395typedef FNHMSWITCHERHC *PFNHMSWITCHERHC;
396
397/** @def HM_UNION_NM
398 * For compilers (like DTrace) that does not grok nameless unions, we have a
399 * little hack to make them palatable.
400 */
401/** @def HM_STRUCT_NM
402 * For compilers (like DTrace) that does not grok nameless structs (it is
403 * non-standard C++), we have a little hack to make them palatable.
404 */
405/** @def HM_NAMELESS_UNION_TAG
406 * For tagging a nameless union so tstASMStructs.cpp can find check the nested
407 * structures within the union.
408 */
409#ifdef VBOX_FOR_DTRACE_LIB
410# define HM_UNION_NM(a_Nm) a_Nm
411# define HM_STRUCT_NM(a_Nm) a_Nm
412# define HM_NAMELESS_UNION_TAG(a_Tag)
413#elif defined(IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS)
414# define HM_UNION_NM(a_Nm) a_Nm
415# define HM_STRUCT_NM(a_Nm) a_Nm
416# define HM_NAMELESS_UNION_TAG(a_Tag) a_Tag
417#else
418# define HM_UNION_NM(a_Nm)
419# define HM_STRUCT_NM(a_Nm)
420# define HM_NAMELESS_UNION_TAG(a_Tag)
421#endif
422
423/**
424 * HM event.
425 *
426 * VT-x and AMD-V common event injection structure.
427 */
428typedef struct HMEVENT
429{
430 /** Whether the event is pending. */
431 uint32_t fPending;
432 /** The error-code associated with the event. */
433 uint32_t u32ErrCode;
434 /** The length of the instruction in bytes (only relevant for software
435 * interrupts or software exceptions). */
436 uint32_t cbInstr;
437 /** Alignment. */
438 uint32_t u32Padding;
439 /** The encoded event (VM-entry interruption-information for VT-x or EVENTINJ
440 * for SVM). */
441 uint64_t u64IntInfo;
442 /** Guest virtual address if this is a page-fault event. */
443 RTGCUINTPTR GCPtrFaultAddress;
444} HMEVENT;
445/** Pointer to a HMEVENT struct. */
446typedef HMEVENT *PHMEVENT;
447/** Pointer to a const HMEVENT struct. */
448typedef const HMEVENT *PCHMEVENT;
449AssertCompileSizeAlignment(HMEVENT, 8);
450
451/**
452 * HM VM Instance data.
453 * Changes to this must checked against the padding of the hm union in VM!
454 */
455typedef struct HM
456{
457 /** Set if nested paging is enabled. */
458 bool fNestedPaging;
459 /** Set when we've initialized VMX or SVM. */
460 bool fInitialized;
461 /** Set if large pages are enabled (requires nested paging). */
462 bool fLargePages;
463 /** Set if we can support 64-bit guests or not. */
464 bool fAllow64BitGuests;
465 /** Set when TPR patching is allowed. */
466 bool fTprPatchingAllowed;
467 /** Set when we initialize VT-x or AMD-V once for all CPUs. */
468 bool fGlobalInit;
469 /** Set when TPR patching is active. */
470 bool fTPRPatchingActive;
471 /** Set when the debug facility has breakpoints/events enabled that requires
472 * us to use the debug execution loop in ring-0. */
473 bool fUseDebugLoop;
474 /** Set if hardware APIC virtualization is enabled. */
475 bool fVirtApicRegs;
476 /** Set if posted interrupt processing is enabled. */
477 bool fPostedIntrs;
478 /** Set if indirect branch prediction barrier on VM exit. */
479 bool fIbpbOnVmExit;
480 /** Set if indirect branch prediction barrier on VM entry. */
481 bool fIbpbOnVmEntry;
482 /** Set if level 1 data cache should be flushed on VM entry. */
483 bool fL1dFlushOnVmEntry;
484 /** Set if level 1 data cache should be flushed on EMT scheduling. */
485 bool fL1dFlushOnSched;
486 /** Set if host manages speculation control settings. */
487 bool fSpecCtrlByHost;
488 /** Set if MDS related buffers should be cleared on VM entry. */
489 bool fMdsClearOnVmEntry;
490 /** Set if MDS related buffers should be cleared on EMT scheduling. */
491 bool fMdsClearOnSched;
492 /** Alignment padding. */
493 bool afPaddingMinus1[7];
494
495 /** Maximum ASID allowed. */
496 uint32_t uMaxAsid;
497 /** The maximum number of resumes loops allowed in ring-0 (safety precaution).
498 * This number is set much higher when RTThreadPreemptIsPending is reliable. */
499 uint32_t cMaxResumeLoops;
500
501 /** Host kernel flags that HM might need to know (SUPKERNELFEATURES_XXX). */
502 uint32_t fHostKernelFeatures;
503
504 /** Size of the guest patch memory block. */
505 uint32_t cbGuestPatchMem;
506 /** Guest allocated memory for patching purposes. */
507 RTGCPTR pGuestPatchMem;
508 /** Current free pointer inside the patch block. */
509 RTGCPTR pFreeGuestPatchMem;
510
511 struct
512 {
513 /** Set by the ring-0 side of HM to indicate VMX is supported by the
514 * CPU. */
515 bool fSupported;
516 /** Set when we've enabled VMX. */
517 bool fEnabled;
518 /** Set if VPID is supported. */
519 bool fVpid;
520 /** Set if VT-x VPID is allowed. */
521 bool fAllowVpid;
522 /** Set if unrestricted guest execution is in use (real and protected mode
523 * without paging). */
524 bool fUnrestrictedGuest;
525 /** Set if the preemption timer is in use or not. */
526 bool fUsePreemptTimer;
527 /** The shift mask employed by the VMX-Preemption timer. */
528 uint8_t cPreemptTimerShift;
529 /** Padding. */
530 bool afPadding0;
531
532 /** Virtual address of the APIC-access page. */
533 R0PTRTYPE(uint8_t *) pbApicAccess;
534 /** Pointer to the VMREAD bitmap. */
535 R0PTRTYPE(void *) pvVmreadBitmap;
536 /** Pointer to the VMWRITE bitmap. */
537 R0PTRTYPE(void *) pvVmwriteBitmap;
538
539 /** Pointer to the shadow VMCS read-only fields array. */
540 R0PTRTYPE(uint32_t *) paShadowVmcsRoFields;
541 /** Pointer to the shadow VMCS read/write fields array. */
542 R0PTRTYPE(uint32_t *) paShadowVmcsFields;
543 /** Number of elements in the shadow VMCS read-only fields array. */
544 uint32_t cShadowVmcsRoFields;
545 /** Number of elements in the shadow VMCS read-write fields array. */
546 uint32_t cShadowVmcsFields;
547
548 /** Tagged-TLB flush type. */
549 VMXTLBFLUSHTYPE enmTlbFlushType;
550 /** Flush type to use for INVEPT. */
551 VMXTLBFLUSHEPT enmTlbFlushEpt;
552 /** Flush type to use for INVVPID. */
553 VMXTLBFLUSHVPID enmTlbFlushVpid;
554
555 /** Pause-loop exiting (PLE) gap in ticks. */
556 uint32_t cPleGapTicks;
557 /** Pause-loop exiting (PLE) window in ticks. */
558 uint32_t cPleWindowTicks;
559 uint32_t u32Alignment0;
560
561 /** Host CR4 value (set by ring-0 VMX init) */
562 uint64_t u64HostCr4;
563 /** Host SMM monitor control (set by ring-0 VMX init) */
564 uint64_t u64HostSmmMonitorCtl;
565 /** Host EFER value (set by ring-0 VMX init) */
566 uint64_t u64HostMsrEfer;
567 /** Whether the CPU supports VMCS fields for swapping EFER. */
568 bool fSupportsVmcsEfer;
569 /** Whether to use VMCS shadowing. */
570 bool fUseVmcsShadowing;
571 /** Set if Last Branch Record (LBR) is enabled. */
572 bool fLbr;
573 uint8_t u8Alignment2[5];
574
575 /** The first valid host LBR branch-from-IP stack range. */
576 uint32_t idLbrFromIpMsrFirst;
577 /** The last valid host LBR branch-from-IP stack range. */
578 uint32_t idLbrFromIpMsrLast;
579
580 /** The first valid host LBR branch-to-IP stack range. */
581 uint32_t idLbrToIpMsrFirst;
582 /** The last valid host LBR branch-to-IP stack range. */
583 uint32_t idLbrToIpMsrLast;
584
585 /** The host LBR TOS (top-of-stack) MSR id. */
586 uint32_t idLbrTosMsr;
587 /** Padding. */
588 uint32_t u32Alignment1;
589
590 /** VMX MSR values. */
591 VMXMSRS Msrs;
592
593 /** Host-physical address for a failing VMXON instruction. */
594 RTHCPHYS HCPhysVmxEnableError;
595 /** Host-physical address of the APIC-access page. */
596 RTHCPHYS HCPhysApicAccess;
597 /** Host-physical address of the VMREAD bitmap. */
598 RTHCPHYS HCPhysVmreadBitmap;
599 /** Host-physical address of the VMWRITE bitmap. */
600 RTHCPHYS HCPhysVmwriteBitmap;
601#ifdef VBOX_WITH_CRASHDUMP_MAGIC
602 /** Host-physical address of the crash-dump scratch area. */
603 RTHCPHYS HCPhysScratch;
604#endif
605
606#ifdef VBOX_WITH_CRASHDUMP_MAGIC
607 /** Pointer to the crash-dump scratch bitmap. */
608 R0PTRTYPE(uint8_t *) pbScratch;
609#endif
610 /** Virtual address of the TSS page used for real mode emulation. */
611 R3PTRTYPE(PVBOXTSS) pRealModeTSS;
612 /** Virtual address of the identity page table used for real mode and protected
613 * mode without paging emulation in EPT mode. */
614 R3PTRTYPE(PX86PD) pNonPagingModeEPTPageTable;
615
616 /** Ring-0 memory object for per-VM VMX structures. */
617 RTR0MEMOBJ hMemObj;
618 } vmx;
619
620 struct
621 {
622 /** Set by the ring-0 side of HM to indicate SVM is supported by the
623 * CPU. */
624 bool fSupported;
625 /** Set when we've enabled SVM. */
626 bool fEnabled;
627 /** Set if erratum 170 affects the AMD cpu. */
628 bool fAlwaysFlushTLB;
629 /** Set when the hack to ignore VERR_SVM_IN_USE is active. */
630 bool fIgnoreInUseError;
631 /** Whether to use virtualized VMSAVE/VMLOAD feature. */
632 bool fVirtVmsaveVmload;
633 /** Whether to use virtual GIF feature. */
634 bool fVGif;
635 /** Whether to use LBR virtualization feature. */
636 bool fLbrVirt;
637 uint8_t u8Alignment0[1];
638
639 /** Physical address of the IO bitmap (12kb). */
640 RTHCPHYS HCPhysIOBitmap;
641 /** R0 memory object for the IO bitmap (12kb). */
642 RTR0MEMOBJ hMemObjIOBitmap;
643 /** Virtual address of the IO bitmap. */
644 R0PTRTYPE(void *) pvIOBitmap;
645
646 /* HWCR MSR (for diagnostics) */
647 uint64_t u64MsrHwcr;
648
649 /** SVM revision. */
650 uint32_t u32Rev;
651 /** SVM feature bits from cpuid 0x8000000a */
652 uint32_t u32Features;
653
654 /** Pause filter counter. */
655 uint16_t cPauseFilter;
656 /** Pause filter treshold in ticks. */
657 uint16_t cPauseFilterThresholdTicks;
658 uint32_t u32Alignment0;
659 } svm;
660
661 /**
662 * AVL tree with all patches (active or disabled) sorted by guest instruction
663 * address.
664 */
665 AVLOU32TREE PatchTree;
666 uint32_t cPatches;
667 HMTPRPATCH aPatches[64];
668
669 /** Last recorded error code during HM ring-0 init. */
670 int32_t rcInit;
671
672 /** HMR0Init was run */
673 bool fHMR0Init;
674 bool u8Alignment1[3];
675
676 STAMCOUNTER StatTprPatchSuccess;
677 STAMCOUNTER StatTprPatchFailure;
678 STAMCOUNTER StatTprReplaceSuccessCr8;
679 STAMCOUNTER StatTprReplaceSuccessVmc;
680 STAMCOUNTER StatTprReplaceFailure;
681} HM;
682/** Pointer to HM VM instance data. */
683typedef HM *PHM;
684AssertCompileMemberAlignment(HM, StatTprPatchSuccess, 8);
685AssertCompileMemberAlignment(HM, vmx, 8);
686AssertCompileMemberAlignment(HM, svm, 8);
687
688
689/** @addtogroup grp_hm_int_svm SVM Internal
690 * @{ */
691/** SVM VMRun function, see SVMR0VMRun(). */
692typedef DECLCALLBACKTYPE(int, FNHMSVMVMRUN,(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhysVMCB));
693/** Pointer to a SVM VMRun function. */
694typedef R0PTRTYPE(FNHMSVMVMRUN *) PFNHMSVMVMRUN;
695/** @} */
696
697
698/** @addtogroup grp_hm_int_vmx VMX Internal
699 * @{ */
700/**
701 * VMX VMCS information, shared.
702 *
703 * This structure provides information maintained for and during the executing of a
704 * guest (or nested-guest) VMCS (VM control structure) using hardware-assisted VMX.
705 *
706 * Note! The members here are ordered and aligned based on estimated frequency of
707 * usage and grouped to fit within a cache line in hot code paths. Even subtle
708 * changes here have a noticeable effect in the bootsector benchmarks. Modify with
709 * care.
710 */
711typedef struct VMXVMCSINFOSHARED
712{
713 /** @name Real-mode emulation state.
714 * @{ */
715 /** Set if guest was executing in real mode (extra checks). */
716 bool fWasInRealMode;
717 /** Set if the guest switched to 64-bit mode on a 32-bit host. */
718 bool fSwitchedTo64on32Obsolete;
719 /** Padding. */
720 bool afPadding0[6];
721 struct
722 {
723 X86DESCATTR AttrCS;
724 X86DESCATTR AttrDS;
725 X86DESCATTR AttrES;
726 X86DESCATTR AttrFS;
727 X86DESCATTR AttrGS;
728 X86DESCATTR AttrSS;
729 X86EFLAGS Eflags;
730 bool fRealOnV86Active;
731 bool afPadding1[3];
732 } RealMode;
733 /** @} */
734
735 /** @name LBR MSR data.
736 * @{ */
737 /** List of LastBranch-From-IP MSRs. */
738 uint64_t au64LbrFromIpMsr[32];
739 /** List of LastBranch-To-IP MSRs. */
740 uint64_t au64LbrToIpMsr[32];
741 /** The MSR containing the index to the most recent branch record. */
742 uint64_t u64LbrTosMsr;
743 /** @} */
744} VMXVMCSINFOSHARED;
745/** Pointer to a VMXVMCSINFOSHARED struct. */
746typedef VMXVMCSINFOSHARED *PVMXVMCSINFOSHARED;
747/** Pointer to a const VMXVMCSINFOSHARED struct. */
748typedef const VMXVMCSINFOSHARED *PCVMXVMCSINFOSHARED;
749AssertCompileSizeAlignment(VMXVMCSINFOSHARED, 8);
750
751
752/**
753 * VMX VMCS information, ring-0 only.
754 *
755 * This structure provides information maintained for and during the executing of a
756 * guest (or nested-guest) VMCS (VM control structure) using hardware-assisted VMX.
757 *
758 * Note! The members here are ordered and aligned based on estimated frequency of
759 * usage and grouped to fit within a cache line in hot code paths. Even subtle
760 * changes here have a noticeable effect in the bootsector benchmarks. Modify with
761 * care.
762 */
763typedef struct VMXVMCSINFO
764{
765 /** Pointer to the bits we share with ring-3. */
766 R0PTRTYPE(PVMXVMCSINFOSHARED) pShared;
767
768 /** @name Auxiliary information.
769 * @{ */
770 /** Host-physical address of the EPTP. */
771 RTHCPHYS HCPhysEPTP;
772 /** The VMCS launch state, see VMX_V_VMCS_LAUNCH_STATE_XXX. */
773 uint32_t fVmcsState;
774 /** The VMCS launch state of the shadow VMCS, see VMX_V_VMCS_LAUNCH_STATE_XXX. */
775 uint32_t fShadowVmcsState;
776 /** The host CPU for which its state has been exported to this VMCS. */
777 RTCPUID idHostCpuState;
778 /** The host CPU on which we last executed this VMCS. */
779 RTCPUID idHostCpuExec;
780 /** Number of guest MSRs in the VM-entry MSR-load area. */
781 uint32_t cEntryMsrLoad;
782 /** Number of guest MSRs in the VM-exit MSR-store area. */
783 uint32_t cExitMsrStore;
784 /** Number of host MSRs in the VM-exit MSR-load area. */
785 uint32_t cExitMsrLoad;
786 /** @} */
787
788 /** @name Cache of execution related VMCS fields.
789 * @{ */
790 /** Pin-based VM-execution controls. */
791 uint32_t u32PinCtls;
792 /** Processor-based VM-execution controls. */
793 uint32_t u32ProcCtls;
794 /** Secondary processor-based VM-execution controls. */
795 uint32_t u32ProcCtls2;
796 /** VM-entry controls. */
797 uint32_t u32EntryCtls;
798 /** VM-exit controls. */
799 uint32_t u32ExitCtls;
800 /** Exception bitmap. */
801 uint32_t u32XcptBitmap;
802 /** Page-fault exception error-code mask. */
803 uint32_t u32XcptPFMask;
804 /** Page-fault exception error-code match. */
805 uint32_t u32XcptPFMatch;
806 /** Padding. */
807 uint32_t u32Alignment0;
808 /** TSC offset. */
809 uint64_t u64TscOffset;
810 /** VMCS link pointer. */
811 uint64_t u64VmcsLinkPtr;
812 /** CR0 guest/host mask. */
813 uint64_t u64Cr0Mask;
814 /** CR4 guest/host mask. */
815 uint64_t u64Cr4Mask;
816 /** Current VMX_VMCS_HOST_RIP value (only used in HMR0A.asm). */
817 uint64_t uHostRip;
818 /** Current VMX_VMCS_HOST_RSP value (only used in HMR0A.asm). */
819 uint64_t uHostRsp;
820 /** @} */
821
822 /** @name Host-virtual address of VMCS and related data structures.
823 * @{ */
824 /** The VMCS. */
825 R0PTRTYPE(void *) pvVmcs;
826 /** The shadow VMCS. */
827 R0PTRTYPE(void *) pvShadowVmcs;
828 /** The virtual-APIC page. */
829 R0PTRTYPE(uint8_t *) pbVirtApic;
830 /** The MSR bitmap. */
831 R0PTRTYPE(void *) pvMsrBitmap;
832 /** The VM-entry MSR-load area. */
833 R0PTRTYPE(void *) pvGuestMsrLoad;
834 /** The VM-exit MSR-store area. */
835 R0PTRTYPE(void *) pvGuestMsrStore;
836 /** The VM-exit MSR-load area. */
837 R0PTRTYPE(void *) pvHostMsrLoad;
838 /** @} */
839
840 /** @name Host-physical address of VMCS and related data structures.
841 * @{ */
842 /** The VMCS. */
843 RTHCPHYS HCPhysVmcs;
844 /** The shadow VMCS. */
845 RTHCPHYS HCPhysShadowVmcs;
846 /** The virtual APIC page. */
847 RTHCPHYS HCPhysVirtApic;
848 /** The MSR bitmap. */
849 RTHCPHYS HCPhysMsrBitmap;
850 /** The VM-entry MSR-load area. */
851 RTHCPHYS HCPhysGuestMsrLoad;
852 /** The VM-exit MSR-store area. */
853 RTHCPHYS HCPhysGuestMsrStore;
854 /** The VM-exit MSR-load area. */
855 RTHCPHYS HCPhysHostMsrLoad;
856 /** @} */
857
858 /** @name R0-memory objects address for VMCS and related data structures.
859 * @{ */
860 /** R0-memory object for VMCS and related data structures. */
861 RTR0MEMOBJ hMemObj;
862 /** @} */
863} VMXVMCSINFO;
864/** Pointer to a VMXVMCSINFOR0 struct. */
865typedef VMXVMCSINFO *PVMXVMCSINFO;
866/** Pointer to a const VMXVMCSINFO struct. */
867typedef const VMXVMCSINFO *PCVMXVMCSINFO;
868AssertCompileSizeAlignment(VMXVMCSINFO, 8);
869AssertCompileMemberAlignment(VMXVMCSINFO, u32PinCtls, 4);
870AssertCompileMemberAlignment(VMXVMCSINFO, u64VmcsLinkPtr, 8);
871AssertCompileMemberAlignment(VMXVMCSINFO, pvVmcs, 8);
872AssertCompileMemberAlignment(VMXVMCSINFO, pvShadowVmcs, 8);
873AssertCompileMemberAlignment(VMXVMCSINFO, pbVirtApic, 8);
874AssertCompileMemberAlignment(VMXVMCSINFO, pvMsrBitmap, 8);
875AssertCompileMemberAlignment(VMXVMCSINFO, pvGuestMsrLoad, 8);
876AssertCompileMemberAlignment(VMXVMCSINFO, pvGuestMsrStore, 8);
877AssertCompileMemberAlignment(VMXVMCSINFO, pvHostMsrLoad, 8);
878AssertCompileMemberAlignment(VMXVMCSINFO, HCPhysVmcs, 8);
879AssertCompileMemberAlignment(VMXVMCSINFO, hMemObj, 8);
880
881
882/** @name Host-state restoration flags.
883 * @note If you change these values don't forget to update the assembly
884 * defines as well!
885 * @{
886 */
887#define VMX_RESTORE_HOST_SEL_DS RT_BIT(0)
888#define VMX_RESTORE_HOST_SEL_ES RT_BIT(1)
889#define VMX_RESTORE_HOST_SEL_FS RT_BIT(2)
890#define VMX_RESTORE_HOST_SEL_GS RT_BIT(3)
891#define VMX_RESTORE_HOST_SEL_TR RT_BIT(4)
892#define VMX_RESTORE_HOST_GDTR RT_BIT(5)
893#define VMX_RESTORE_HOST_IDTR RT_BIT(6)
894#define VMX_RESTORE_HOST_GDT_READ_ONLY RT_BIT(7)
895#define VMX_RESTORE_HOST_GDT_NEED_WRITABLE RT_BIT(8)
896#define VMX_RESTORE_HOST_CAN_USE_WRFSBASE_AND_WRGSBASE RT_BIT(9)
897/**
898 * This _must_ be the top most bit, so that we can easily that that it and
899 * something else is set w/o having to do two checks like this:
900 * @code
901 * if ( (pVCpu->hm.s.vmx.fRestoreHostFlags & VMX_RESTORE_HOST_REQUIRED)
902 * && (pVCpu->hm.s.vmx.fRestoreHostFlags & ~VMX_RESTORE_HOST_REQUIRED))
903 * @endcode
904 * Instead we can then do:
905 * @code
906 * if (pVCpu->hm.s.vmx.fRestoreHostFlags > VMX_RESTORE_HOST_REQUIRED)
907 * @endcode
908 */
909#define VMX_RESTORE_HOST_REQUIRED RT_BIT(10)
910/** @} */
911
912/**
913 * Host-state restoration structure.
914 *
915 * This holds host-state fields that require manual restoration.
916 * Assembly version found in HMInternal.mac (should be automatically verified).
917 */
918typedef struct VMXRESTOREHOST
919{
920 RTSEL uHostSelDS; /**< 0x00 */
921 RTSEL uHostSelES; /**< 0x02 */
922 RTSEL uHostSelFS; /**< 0x04 */
923 X86XDTR64 HostGdtr; /**< 0x06 - should be aligned by its 64-bit member. */
924 RTSEL uHostSelGS; /**< 0x10 */
925 RTSEL uHostSelTR; /**< 0x12 */
926 RTSEL uHostSelSS; /**< 0x14 - not restored, just for fetching */
927 X86XDTR64 HostGdtrRw; /**< 0x16 - should be aligned by its 64-bit member. */
928 RTSEL uHostSelCS; /**< 0x20 - not restored, just for fetching */
929 uint8_t abPadding1[4]; /**< 0x22 */
930 X86XDTR64 HostIdtr; /**< 0x26 - should be aligned by its 64-bit member. */
931 uint64_t uHostFSBase; /**< 0x30 */
932 uint64_t uHostGSBase; /**< 0x38 */
933} VMXRESTOREHOST;
934/** Pointer to VMXRESTOREHOST. */
935typedef VMXRESTOREHOST *PVMXRESTOREHOST;
936AssertCompileSize(X86XDTR64, 10);
937AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr.uAddr, 0x08);
938AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtrRw.uAddr, 0x18);
939AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr.uAddr, 0x28);
940AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase, 0x30);
941AssertCompileSize(VMXRESTOREHOST, 64);
942AssertCompileSizeAlignment(VMXRESTOREHOST, 8);
943
944/**
945 * VMX StartVM function.
946 *
947 * @returns VBox status code (no informational stuff).
948 * @param pVmcsInfo Pointer to the VMCS info (for cached host RIP and RSP).
949 * @param pVCpu Pointer to the cross context per-CPU structure.
950 * @param fResume Whether to use VMRESUME (true) or VMLAUNCH (false).
951 */
952typedef DECLCALLBACKTYPE(int, FNHMVMXSTARTVM,(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume));
953/** Pointer to a VMX StartVM function. */
954typedef R0PTRTYPE(FNHMVMXSTARTVM *) PFNHMVMXSTARTVM;
955/** @} */
956
957/**
958 * HM VMCPU Instance data.
959 *
960 * Note! If you change members of this struct, make sure to check if the
961 * assembly counterpart in HMInternal.mac needs to be updated as well.
962 *
963 * Note! The members here are ordered and aligned based on estimated frequency of
964 * usage and grouped to fit within a cache line in hot code paths. Even subtle
965 * changes here have a noticeable effect in the bootsector benchmarks. Modify with
966 * care.
967 */
968typedef struct HMCPU
969{
970 /** Set when the TLB has been checked until we return from the world switch. */
971 bool volatile fCheckedTLBFlush;
972 /** Set when we're using VT-x or AMD-V at that moment.
973 * @todo r=bird: Misleading description. For AMD-V this will be set the first
974 * time HMCanExecuteGuest() is called and only cleared again by
975 * HMR3ResetCpu(). For VT-x it will be set by HMCanExecuteGuest when we
976 * can execute something in VT-x mode, and cleared if we cannot.
977 *
978 * The field is much more about recording the last HMCanExecuteGuest
979 * return value than anything about any "moment". */
980 bool fActive;
981
982 /** Whether we should use the debug loop because of single stepping or special
983 * debug breakpoints / events are armed. */
984 bool fUseDebugLoop;
985
986 /** Whether \#UD needs to be intercepted (required by certain GIM providers). */
987 bool fGIMTrapXcptUD;
988 /** Whether \#GP needs to be intercepted for mesa driver workaround. */
989 bool fTrapXcptGpForLovelyMesaDrv;
990 /** Whether we're executing a single instruction. */
991 bool fSingleInstruction;
992
993 bool afAlignment0[2];
994
995 /** An additional error code used for some gurus. */
996 uint32_t u32HMError;
997 /** The last exit-to-ring-3 reason. */
998 int32_t rcLastExitToR3;
999 /** CPU-context changed flags (see HM_CHANGED_xxx). */
1000 uint64_t fCtxChanged;
1001
1002 union HM_NAMELESS_UNION_TAG(HMCPUUNION) /* no tag! */
1003 {
1004 /** VT-x data. */
1005 struct HM_NAMELESS_UNION_TAG(HMCPUVMX)
1006 {
1007 /** @name Guest information.
1008 * @{ */
1009 /** Guest VMCS information shared with ring-3. */
1010 VMXVMCSINFOSHARED VmcsInfo;
1011 /** Nested-guest VMCS information shared with ring-3. */
1012 VMXVMCSINFOSHARED VmcsInfoNstGst;
1013 /** Whether the nested-guest VMCS was the last current VMCS (shadow copy for ring-3).
1014 * @see HMR0PERVCPU::vmx.fSwitchedToNstGstVmcs */
1015 bool fSwitchedToNstGstVmcsCopyForRing3;
1016 /** Whether the static guest VMCS controls has been merged with the
1017 * nested-guest VMCS controls. */
1018 bool fMergedNstGstCtls;
1019 /** Whether the nested-guest VMCS has been copied to the shadow VMCS. */
1020 bool fCopiedNstGstToShadowVmcs;
1021 /** Whether flushing the TLB is required due to switching to/from the
1022 * nested-guest. */
1023 bool fSwitchedNstGstFlushTlb;
1024 /** Alignment. */
1025 bool afAlignment0[4];
1026 /** Cached guest APIC-base MSR for identifying when to map the APIC-access page. */
1027 uint64_t u64GstMsrApicBase;
1028 /** @} */
1029
1030 /** @name Error reporting and diagnostics.
1031 * @{ */
1032 /** VT-x error-reporting (mainly for ring-3 propagation). */
1033 struct
1034 {
1035 RTCPUID idCurrentCpu;
1036 RTCPUID idEnteredCpu;
1037 RTHCPHYS HCPhysCurrentVmcs;
1038 uint32_t u32VmcsRev;
1039 uint32_t u32InstrError;
1040 uint32_t u32ExitReason;
1041 uint32_t u32GuestIntrState;
1042 } LastError;
1043 /** @} */
1044 } vmx;
1045
1046 /** SVM data. */
1047 struct HM_NAMELESS_UNION_TAG(HMCPUSVM)
1048 {
1049 /** Physical address of the host VMCB which holds additional host-state. */
1050 RTHCPHYS HCPhysVmcbHost;
1051 /** R0 memory object for the host VMCB which holds additional host-state. */
1052 RTR0MEMOBJ hMemObjVmcbHost;
1053 /** Padding.
1054 * @todo remove, pointless now */
1055 R0PTRTYPE(void *) pvPadding;
1056
1057 /** Physical address of the guest VMCB. */
1058 RTHCPHYS HCPhysVmcb;
1059 /** R0 memory object for the guest VMCB. */
1060 RTR0MEMOBJ hMemObjVmcb;
1061 /** Pointer to the guest VMCB. */
1062 R0PTRTYPE(PSVMVMCB) pVmcb;
1063
1064 /** Physical address of the MSR bitmap (8 KB). */
1065 RTHCPHYS HCPhysMsrBitmap;
1066 /** R0 memory object for the MSR bitmap (8 KB). */
1067 RTR0MEMOBJ hMemObjMsrBitmap;
1068 /** Pointer to the MSR bitmap. */
1069 R0PTRTYPE(void *) pvMsrBitmap;
1070
1071 /** Whether VTPR with V_INTR_MASKING set is in effect, indicating
1072 * we should check if the VTPR changed on every VM-exit. */
1073 bool fSyncVTpr;
1074 /** Whether to emulate long mode support for sysenter/sysexit like intel CPUs
1075 * does. This means intercepting \#UD to emulate the instructions in
1076 * long-mode and to intercept reads and writes to the SYSENTER MSRs in order to
1077 * preserve the upper 32 bits written to them (AMD will ignore and discard). */
1078 bool fEmulateLongModeSysEnterExit;
1079 uint8_t au8Alignment0[6];
1080
1081 /** Host's TSC_AUX MSR (used when RDTSCP doesn't cause VM-exits). */
1082 uint64_t u64HostTscAux;
1083
1084 /** Cache of the nested-guest's VMCB fields that we modify in order to run the
1085 * nested-guest using AMD-V. This will be restored on \#VMEXIT. */
1086 SVMNESTEDVMCBCACHE NstGstVmcbCache;
1087 } svm;
1088 } HM_UNION_NM(u);
1089
1090 /** Event injection state. */
1091 HMEVENT Event;
1092
1093 /** Current shadow paging mode for updating CR4.
1094 * @todo move later (@bugref{9217}). */
1095 PGMMODE enmShadowMode;
1096 uint32_t u32TemporaryPadding;
1097
1098 /** The PAE PDPEs used with Nested Paging (only valid when
1099 * VMCPU_FF_HM_UPDATE_PAE_PDPES is set). */
1100 X86PDPE aPdpes[4];
1101
1102 /** For saving stack space, the disassembler state is allocated here instead of
1103 * on the stack. */
1104 DISCPUSTATE DisState;
1105
1106 /* These two comes because they are accessed from assembly and we don't
1107 want to detail all the stats in the assembly version of this structure. */
1108 STAMCOUNTER StatVmxWriteHostRip;
1109 STAMCOUNTER StatVmxWriteHostRsp;
1110 STAMCOUNTER StatVmxVmLaunch;
1111 STAMCOUNTER StatVmxVmResume;
1112
1113 STAMPROFILEADV StatEntry;
1114 STAMPROFILEADV StatPreExit;
1115 STAMPROFILEADV StatExitHandling;
1116 STAMPROFILEADV StatExitIO;
1117 STAMPROFILEADV StatExitMovCRx;
1118 STAMPROFILEADV StatExitXcptNmi;
1119 STAMPROFILEADV StatExitVmentry;
1120 STAMPROFILEADV StatImportGuestState;
1121 STAMPROFILEADV StatExportGuestState;
1122 STAMPROFILEADV StatLoadGuestFpuState;
1123 STAMPROFILEADV StatInGC;
1124 STAMPROFILEADV StatPoke;
1125 STAMPROFILEADV StatSpinPoke;
1126 STAMPROFILEADV StatSpinPokeFailed;
1127
1128 STAMCOUNTER StatInjectInterrupt;
1129 STAMCOUNTER StatInjectXcpt;
1130 STAMCOUNTER StatInjectReflect;
1131 STAMCOUNTER StatInjectConvertDF;
1132 STAMCOUNTER StatInjectInterpret;
1133 STAMCOUNTER StatInjectReflectNPF;
1134
1135 STAMCOUNTER StatExitAll;
1136 STAMCOUNTER StatNestedExitAll;
1137 STAMCOUNTER StatExitShadowNM;
1138 STAMCOUNTER StatExitGuestNM;
1139 STAMCOUNTER StatExitShadowPF; /**< Misleading, currently used for MMIO \#PFs as well. */
1140 STAMCOUNTER StatExitShadowPFEM;
1141 STAMCOUNTER StatExitGuestPF;
1142 STAMCOUNTER StatExitGuestUD;
1143 STAMCOUNTER StatExitGuestSS;
1144 STAMCOUNTER StatExitGuestNP;
1145 STAMCOUNTER StatExitGuestTS;
1146 STAMCOUNTER StatExitGuestOF;
1147 STAMCOUNTER StatExitGuestGP;
1148 STAMCOUNTER StatExitGuestDE;
1149 STAMCOUNTER StatExitGuestDF;
1150 STAMCOUNTER StatExitGuestBR;
1151 STAMCOUNTER StatExitGuestAC;
1152 STAMCOUNTER StatExitGuestDB;
1153 STAMCOUNTER StatExitGuestMF;
1154 STAMCOUNTER StatExitGuestBP;
1155 STAMCOUNTER StatExitGuestXF;
1156 STAMCOUNTER StatExitGuestXcpUnk;
1157 STAMCOUNTER StatExitDRxWrite;
1158 STAMCOUNTER StatExitDRxRead;
1159 STAMCOUNTER StatExitCR0Read;
1160 STAMCOUNTER StatExitCR2Read;
1161 STAMCOUNTER StatExitCR3Read;
1162 STAMCOUNTER StatExitCR4Read;
1163 STAMCOUNTER StatExitCR8Read;
1164 STAMCOUNTER StatExitCR0Write;
1165 STAMCOUNTER StatExitCR2Write;
1166 STAMCOUNTER StatExitCR3Write;
1167 STAMCOUNTER StatExitCR4Write;
1168 STAMCOUNTER StatExitCR8Write;
1169 STAMCOUNTER StatExitRdmsr;
1170 STAMCOUNTER StatExitWrmsr;
1171 STAMCOUNTER StatExitClts;
1172 STAMCOUNTER StatExitXdtrAccess;
1173 STAMCOUNTER StatExitLmsw;
1174 STAMCOUNTER StatExitIOWrite;
1175 STAMCOUNTER StatExitIORead;
1176 STAMCOUNTER StatExitIOStringWrite;
1177 STAMCOUNTER StatExitIOStringRead;
1178 STAMCOUNTER StatExitIntWindow;
1179 STAMCOUNTER StatExitExtInt;
1180 STAMCOUNTER StatExitHostNmiInGC;
1181 STAMCOUNTER StatExitHostNmiInGCIpi;
1182 STAMCOUNTER StatExitPreemptTimer;
1183 STAMCOUNTER StatExitTprBelowThreshold;
1184 STAMCOUNTER StatExitTaskSwitch;
1185 STAMCOUNTER StatExitApicAccess;
1186 STAMCOUNTER StatExitReasonNpf;
1187
1188 STAMCOUNTER StatNestedExitReasonNpf;
1189
1190 STAMCOUNTER StatFlushPage;
1191 STAMCOUNTER StatFlushPageManual;
1192 STAMCOUNTER StatFlushPhysPageManual;
1193 STAMCOUNTER StatFlushTlb;
1194 STAMCOUNTER StatFlushTlbNstGst;
1195 STAMCOUNTER StatFlushTlbManual;
1196 STAMCOUNTER StatFlushTlbWorldSwitch;
1197 STAMCOUNTER StatNoFlushTlbWorldSwitch;
1198 STAMCOUNTER StatFlushEntire;
1199 STAMCOUNTER StatFlushAsid;
1200 STAMCOUNTER StatFlushNestedPaging;
1201 STAMCOUNTER StatFlushTlbInvlpgVirt;
1202 STAMCOUNTER StatFlushTlbInvlpgPhys;
1203 STAMCOUNTER StatTlbShootdown;
1204 STAMCOUNTER StatTlbShootdownFlush;
1205
1206 STAMCOUNTER StatSwitchPendingHostIrq;
1207 STAMCOUNTER StatSwitchTprMaskedIrq;
1208 STAMCOUNTER StatSwitchGuestIrq;
1209 STAMCOUNTER StatSwitchHmToR3FF;
1210 STAMCOUNTER StatSwitchVmReq;
1211 STAMCOUNTER StatSwitchPgmPoolFlush;
1212 STAMCOUNTER StatSwitchDma;
1213 STAMCOUNTER StatSwitchExitToR3;
1214 STAMCOUNTER StatSwitchLongJmpToR3;
1215 STAMCOUNTER StatSwitchMaxResumeLoops;
1216 STAMCOUNTER StatSwitchHltToR3;
1217 STAMCOUNTER StatSwitchApicAccessToR3;
1218 STAMCOUNTER StatSwitchPreempt;
1219 STAMCOUNTER StatSwitchNstGstVmexit;
1220
1221 STAMCOUNTER StatTscParavirt;
1222 STAMCOUNTER StatTscOffset;
1223 STAMCOUNTER StatTscIntercept;
1224
1225 STAMCOUNTER StatDRxArmed;
1226 STAMCOUNTER StatDRxContextSwitch;
1227 STAMCOUNTER StatDRxIoCheck;
1228
1229 STAMCOUNTER StatExportMinimal;
1230 STAMCOUNTER StatExportFull;
1231 STAMCOUNTER StatLoadGuestFpu;
1232 STAMCOUNTER StatExportHostState;
1233
1234 STAMCOUNTER StatVmxCheckBadRmSelBase;
1235 STAMCOUNTER StatVmxCheckBadRmSelLimit;
1236 STAMCOUNTER StatVmxCheckBadRmSelAttr;
1237 STAMCOUNTER StatVmxCheckBadV86SelBase;
1238 STAMCOUNTER StatVmxCheckBadV86SelLimit;
1239 STAMCOUNTER StatVmxCheckBadV86SelAttr;
1240 STAMCOUNTER StatVmxCheckRmOk;
1241 STAMCOUNTER StatVmxCheckBadSel;
1242 STAMCOUNTER StatVmxCheckBadRpl;
1243 STAMCOUNTER StatVmxCheckPmOk;
1244
1245#ifdef VBOX_WITH_STATISTICS
1246 R3PTRTYPE(PSTAMCOUNTER) paStatExitReason;
1247 R0PTRTYPE(PSTAMCOUNTER) paStatExitReasonR0;
1248 R3PTRTYPE(PSTAMCOUNTER) paStatInjectedIrqs;
1249 R0PTRTYPE(PSTAMCOUNTER) paStatInjectedIrqsR0;
1250 R3PTRTYPE(PSTAMCOUNTER) paStatInjectedXcpts;
1251 R0PTRTYPE(PSTAMCOUNTER) paStatInjectedXcptsR0;
1252 R3PTRTYPE(PSTAMCOUNTER) paStatNestedExitReason;
1253 R0PTRTYPE(PSTAMCOUNTER) paStatNestedExitReasonR0;
1254#endif
1255#ifdef HM_PROFILE_EXIT_DISPATCH
1256 STAMPROFILEADV StatExitDispatch;
1257#endif
1258} HMCPU;
1259/** Pointer to HM VMCPU instance data. */
1260typedef HMCPU *PHMCPU;
1261AssertCompileMemberAlignment(HMCPU, fCheckedTLBFlush, 4);
1262AssertCompileMemberAlignment(HMCPU, fCtxChanged, 8);
1263AssertCompileMemberAlignment(HMCPU, HM_UNION_NM(u.) vmx, 8);
1264AssertCompileMemberAlignment(HMCPU, HM_UNION_NM(u.) vmx.VmcsInfo, 8);
1265AssertCompileMemberAlignment(HMCPU, HM_UNION_NM(u.) vmx.VmcsInfoNstGst, 8);
1266AssertCompileMemberAlignment(HMCPU, HM_UNION_NM(u.) svm, 8);
1267AssertCompileMemberAlignment(HMCPU, Event, 8);
1268
1269
1270/**
1271 * HM per-VCpu ring-0 only instance data.
1272 */
1273typedef struct HMR0PERVCPU
1274{
1275 /** World switch exit counter. */
1276 uint32_t volatile cWorldSwitchExits;
1277 /** TLB flush count. */
1278 uint32_t cTlbFlushes;
1279 /** The last CPU we were executing code on (NIL_RTCPUID for the first time). */
1280 RTCPUID idLastCpu;
1281 /** The CPU ID of the CPU currently owning the VMCS. Set in
1282 * HMR0Enter and cleared in HMR0Leave. */
1283 RTCPUID idEnteredCpu;
1284 /** Current ASID in use by the VM. */
1285 uint32_t uCurrentAsid;
1286
1287 /** Set if we need to flush the TLB during the world switch. */
1288 bool fForceTLBFlush;
1289 /** Whether we've completed the inner HM leave function. */
1290 bool fLeaveDone;
1291 /** Whether we're using the hyper DR7 or guest DR7. */
1292 bool fUsingHyperDR7;
1293 /** Whether we are currently executing in the debug loop.
1294 * Mainly for assertions. */
1295 bool fUsingDebugLoop;
1296 /** Set if we using the debug loop and wish to intercept RDTSC. */
1297 bool fDebugWantRdTscExit;
1298 /** Set if XCR0 needs to be saved/restored when entering/exiting guest code
1299 * execution. */
1300 bool fLoadSaveGuestXcr0;
1301 /** Set if we need to clear the trap flag because of single stepping. */
1302 bool fClearTrapFlag;
1303
1304 bool afPadding1[5];
1305
1306 union HM_NAMELESS_UNION_TAG(HMR0CPUUNION) /* no tag! */
1307 {
1308 /** VT-x data. */
1309 struct HM_NAMELESS_UNION_TAG(HMR0CPUVMX)
1310 {
1311 /** Ring-0 pointer to the hardware-assisted VMX execution function. */
1312 PFNHMVMXSTARTVM pfnStartVm;
1313
1314 /** @name Guest information.
1315 * @{ */
1316 /** Guest VMCS information. */
1317 VMXVMCSINFO VmcsInfo;
1318 /** Nested-guest VMCS information. */
1319 VMXVMCSINFO VmcsInfoNstGst;
1320 /* Whether the nested-guest VMCS was the last current VMCS (authoritative copy).
1321 * @see HMCPU::vmx.fSwitchedToNstGstVmcsCopyForRing3 */
1322 bool fSwitchedToNstGstVmcs;
1323 bool afAlignment0[7];
1324 /** @} */
1325
1326 /** @name Host information.
1327 * @{ */
1328 /** Host LSTAR MSR to restore lazily while leaving VT-x. */
1329 uint64_t u64HostMsrLStar;
1330 /** Host STAR MSR to restore lazily while leaving VT-x. */
1331 uint64_t u64HostMsrStar;
1332 /** Host SF_MASK MSR to restore lazily while leaving VT-x. */
1333 uint64_t u64HostMsrSfMask;
1334 /** Host KernelGS-Base MSR to restore lazily while leaving VT-x. */
1335 uint64_t u64HostMsrKernelGsBase;
1336 /** The mask of lazy MSRs swap/restore state, see VMX_LAZY_MSRS_XXX. */
1337 uint32_t fLazyMsrs;
1338 /** Whether the host MSR values are up-to-date in the auto-load/store MSR area. */
1339 bool fUpdatedHostAutoMsrs;
1340 /** Alignment. */
1341 uint8_t au8Alignment0[3];
1342 /** Which host-state bits to restore before being preempted, see
1343 * VMX_RESTORE_HOST_XXX. */
1344 uint32_t fRestoreHostFlags;
1345 /** Alignment. */
1346 uint32_t u32Alignment0;
1347 /** The host-state restoration structure. */
1348 VMXRESTOREHOST RestoreHost;
1349 /** @} */
1350 } vmx;
1351
1352 /** SVM data. */
1353 struct HM_NAMELESS_UNION_TAG(HMR0CPUSVM)
1354 {
1355 /** Ring 0 handlers for VT-x. */
1356 PFNHMSVMVMRUN pfnVMRun;
1357 } svm;
1358 } HM_UNION_NM(u);
1359} HMR0PERVCPU;
1360/** Pointer to HM ring-0 VMCPU instance data. */
1361typedef HMR0PERVCPU *PHMR0PERVCPU;
1362AssertCompileMemberAlignment(HMR0PERVCPU, cWorldSwitchExits, 4);
1363AssertCompileMemberAlignment(HMR0PERVCPU, fForceTLBFlush, 4);
1364AssertCompileMemberAlignment(HMR0PERVCPU, HM_UNION_NM(u.) vmx.RestoreHost, 8);
1365
1366
1367#ifdef IN_RING0
1368VMMR0_INT_DECL(PHMPHYSCPU) hmR0GetCurrentCpu(void);
1369VMMR0_INT_DECL(int) hmR0EnterCpu(PVMCPUCC pVCpu);
1370
1371# ifdef VBOX_STRICT
1372# define HM_DUMP_REG_FLAGS_GPRS RT_BIT(0)
1373# define HM_DUMP_REG_FLAGS_FPU RT_BIT(1)
1374# define HM_DUMP_REG_FLAGS_MSRS RT_BIT(2)
1375# define HM_DUMP_REG_FLAGS_ALL (HM_DUMP_REG_FLAGS_GPRS | HM_DUMP_REG_FLAGS_FPU | HM_DUMP_REG_FLAGS_MSRS)
1376
1377VMMR0_INT_DECL(void) hmR0DumpRegs(PVMCPUCC pVCpu, uint32_t fFlags);
1378VMMR0_INT_DECL(void) hmR0DumpDescriptor(PCX86DESCHC pDesc, RTSEL Sel, const char *pszMsg);
1379# endif
1380
1381DECLASM(void) hmR0MdsClear(void);
1382#endif /* IN_RING0 */
1383
1384
1385/** @addtogroup grp_hm_int_svm SVM Internal
1386 * @{ */
1387VMM_INT_DECL(int) hmEmulateSvmMovTpr(PVMCC pVM, PVMCPUCC pVCpu);
1388
1389/**
1390 * Prepares for and executes VMRUN (64-bit register context).
1391 *
1392 * @returns VBox status code (no informational stuff).
1393 * @param pVM The cross context VM structure. (Not used.)
1394 * @param pVCpu The cross context virtual CPU structure.
1395 * @param HCPhyspVMCB Physical address of the VMCB.
1396 *
1397 * @remarks With spectre mitigations and the usual need for speed (/ micro
1398 * optimizations), we have a bunch of variations of this code depending
1399 * on a few precoditions. In release builds, the code is entirely
1400 * without conditionals. Debug builds have a couple of assertions that
1401 * shouldn't ever be triggered.
1402 *
1403 * @{
1404 */
1405DECLASM(int) hmR0SvmVmRun_SansXcr0_SansIbpbEntry_SansIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1406DECLASM(int) hmR0SvmVmRun_WithXcr0_SansIbpbEntry_SansIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1407DECLASM(int) hmR0SvmVmRun_SansXcr0_WithIbpbEntry_SansIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1408DECLASM(int) hmR0SvmVmRun_WithXcr0_WithIbpbEntry_SansIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1409DECLASM(int) hmR0SvmVmRun_SansXcr0_SansIbpbEntry_WithIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1410DECLASM(int) hmR0SvmVmRun_WithXcr0_SansIbpbEntry_WithIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1411DECLASM(int) hmR0SvmVmRun_SansXcr0_WithIbpbEntry_WithIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1412DECLASM(int) hmR0SvmVmRun_WithXcr0_WithIbpbEntry_WithIbpbExit(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhyspVMCB);
1413/** @} */
1414
1415/** @} */
1416
1417
1418/** @addtogroup grp_hm_int_vmx VMX Internal
1419 * @{ */
1420VMM_INT_DECL(PVMXVMCSINFOSHARED) hmGetVmxActiveVmcsInfoShared(PVMCPUCC pVCpu);
1421
1422/**
1423 * Used on platforms with poor inline assembly support to retrieve all the
1424 * info from the CPU and put it in the @a pRestoreHost structure.
1425 */
1426DECLASM(void) hmR0VmxExportHostSegmentRegsAsmHlp(PVMXRESTOREHOST pRestoreHost, bool fHaveFsGsBase);
1427
1428/**
1429 * Restores some host-state fields that need not be done on every VM-exit.
1430 *
1431 * @returns VBox status code.
1432 * @param fRestoreHostFlags Flags of which host registers needs to be
1433 * restored.
1434 * @param pRestoreHost Pointer to the host-restore structure.
1435 */
1436DECLASM(int) VMXRestoreHostState(uint32_t fRestoreHostFlags, PVMXRESTOREHOST pRestoreHost);
1437
1438/**
1439 * VMX StartVM functions.
1440 *
1441 * @returns VBox status code (no informational stuff).
1442 * @param pVM Pointer to the cross context VM structure.
1443 * @param pVCpu Pointer to the cross context per-CPU structure.
1444 * @param fResume Whether to use VMRESUME (true) or VMLAUNCH (false).
1445 *
1446 * @remarks With spectre mitigations and the usual need for speed (/ micro
1447 * optimizations), we have a bunch of variations of this code depending
1448 * on a few precoditions. In release builds, the code is entirely
1449 * without conditionals. Debug builds have a couple of assertions that
1450 * shouldn't ever be triggered.
1451 *
1452 * @{
1453 */
1454DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_SansL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1455DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_SansL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1456DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_SansL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1457DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_SansL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1458DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_WithL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1459DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_WithL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1460DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_WithL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1461DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_WithL1dEntry_SansMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1462DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_SansL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1463DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_SansL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1464DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_SansL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1465DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_SansL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1466DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_WithL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1467DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_WithL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1468DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_WithL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1469DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_WithL1dEntry_WithMdsEntry_SansIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1470DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_SansL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1471DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_SansL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1472DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_SansL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1473DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_SansL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1474DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_WithL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1475DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_WithL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1476DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_WithL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1477DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_WithL1dEntry_SansMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1478DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_SansL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1479DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_SansL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1480DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_SansL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1481DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_SansL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1482DECLASM(int) hmR0VmxStartVm_SansXcr0_SansIbpbEntry_WithL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1483DECLASM(int) hmR0VmxStartVm_WithXcr0_SansIbpbEntry_WithL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1484DECLASM(int) hmR0VmxStartVm_SansXcr0_WithIbpbEntry_WithL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1485DECLASM(int) hmR0VmxStartVm_WithXcr0_WithIbpbEntry_WithL1dEntry_WithMdsEntry_WithIbpbExit(PVMXVMCSINFO pVmcsInfo, PVMCPUCC pVCpu, bool fResume);
1486/** @} */
1487
1488/** @} */
1489
1490/** @} */
1491
1492RT_C_DECLS_END
1493
1494#endif /* !VMM_INCLUDED_SRC_include_HMInternal_h */
1495
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