VirtualBox

source: vbox/trunk/src/VBox/VMM/include/VMXInternal.h@ 94249

Last change on this file since 94249 was 93947, checked in by vboxsync, 3 years ago

VMM: Doxygen fix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 12.4 KB
Line 
1/* $Id: VMXInternal.h 93947 2022-02-25 05:20:20Z vboxsync $ */
2/** @file
3 * VMX - Internal header file for the VMX code template.
4 */
5
6/*
7 * Copyright (C) 2006-2022 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_VMXInternal_h
19#define VMM_INCLUDED_SRC_include_VMXInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "HMVMXCommon.h"
25
26#if HC_ARCH_BITS == 32
27# error "32-bit hosts are no longer supported. Go back to 6.0 or earlier!"
28#endif
29
30/** @def HM_PROFILE_EXIT_DISPATCH
31 * Enables profiling of the VM exit handler dispatching. */
32#if 0 || defined(DOXYGEN_RUNNING)
33# define HM_PROFILE_EXIT_DISPATCH
34#endif
35
36RT_C_DECLS_BEGIN
37
38
39/** @defgroup grp_hm_int Internal
40 * @ingroup grp_hm
41 * @internal
42 * @{
43 */
44
45/** @addtogroup grp_hm_int_vmx VMX Internal
46 * @{ */
47/**
48 * VMX per-VCPU transient state.
49 *
50 * A state structure for holding miscellaneous information across
51 * VMX non-root operation and restored after the transition.
52 *
53 * Note: The members are ordered and aligned such that the most
54 * frequently used ones (in the guest execution loop) fall within
55 * the first cache line.
56 */
57typedef struct VMXTRANSIENT
58{
59 /** Mask of currently read VMCS fields; HMVMX_READ_XXX. */
60 uint32_t fVmcsFieldsRead;
61 /** The guest's TPR value used for TPR shadowing. */
62 uint8_t u8GuestTpr;
63 uint8_t abAlignment0[3];
64
65 /** Whether the VM-exit was caused by a page-fault during delivery of an
66 * external interrupt or NMI. */
67 bool fVectoringPF;
68 /** Whether the VM-exit was caused by a page-fault during delivery of a
69 * contributory exception or a page-fault. */
70 bool fVectoringDoublePF;
71 /** Whether the VM-entry failed or not. */
72 bool fVMEntryFailed;
73 /** Whether the TSC_AUX MSR needs to be removed from the auto-load/store MSR
74 * area after VM-exit. */
75 bool fRemoveTscAuxMsr;
76 /** Whether TSC-offsetting and VMX-preemption timer was updated before VM-entry. */
77 bool fUpdatedTscOffsettingAndPreemptTimer;
78 /** Whether we are currently executing a nested-guest. */
79 bool fIsNestedGuest;
80 /** Whether the guest debug state was active at the time of VM-exit. */
81 bool fWasGuestDebugStateActive;
82 /** Whether the hyper debug state was active at the time of VM-exit. */
83 bool fWasHyperDebugStateActive;
84
85 /** The basic VM-exit reason. */
86 uint32_t uExitReason;
87 /** The VM-exit interruption error code. */
88 uint32_t uExitIntErrorCode;
89
90 /** The host's rflags/eflags. */
91 RTCCUINTREG fEFlags;
92
93 /** The VM-exit exit code qualification. */
94 uint64_t uExitQual;
95
96 /** The VMCS info. object. */
97 PVMXVMCSINFO pVmcsInfo;
98
99 /** The VM-exit interruption-information field. */
100 uint32_t uExitIntInfo;
101 /** The VM-exit instruction-length field. */
102 uint32_t cbExitInstr;
103
104 /** The VM-exit instruction-information field. */
105 VMXEXITINSTRINFO ExitInstrInfo;
106 /** IDT-vectoring information field. */
107 uint32_t uIdtVectoringInfo;
108
109 /** IDT-vectoring error code. */
110 uint32_t uIdtVectoringErrorCode;
111 uint32_t u32Alignment0;
112
113 /** The Guest-linear address. */
114 uint64_t uGuestLinearAddr;
115
116 /** The Guest-physical address. */
117 uint64_t uGuestPhysicalAddr;
118
119 /** The Guest pending-debug exceptions. */
120 uint64_t uGuestPendingDbgXcpts;
121
122 /** The VM-entry interruption-information field. */
123 uint32_t uEntryIntInfo;
124 /** The VM-entry exception error code field. */
125 uint32_t uEntryXcptErrorCode;
126
127 /** The VM-entry instruction length field. */
128 uint32_t cbEntryInstr;
129} VMXTRANSIENT;
130AssertCompileMemberSize(VMXTRANSIENT, ExitInstrInfo, sizeof(uint32_t));
131AssertCompileMemberAlignment(VMXTRANSIENT, fVmcsFieldsRead, 8);
132AssertCompileMemberAlignment(VMXTRANSIENT, fVectoringPF, 8);
133AssertCompileMemberAlignment(VMXTRANSIENT, uExitReason, 8);
134AssertCompileMemberAlignment(VMXTRANSIENT, fEFlags, 8);
135AssertCompileMemberAlignment(VMXTRANSIENT, uExitQual, 8);
136AssertCompileMemberAlignment(VMXTRANSIENT, pVmcsInfo, 8);
137AssertCompileMemberAlignment(VMXTRANSIENT, uExitIntInfo, 8);
138AssertCompileMemberAlignment(VMXTRANSIENT, ExitInstrInfo, 8);
139AssertCompileMemberAlignment(VMXTRANSIENT, uIdtVectoringErrorCode, 8);
140AssertCompileMemberAlignment(VMXTRANSIENT, uGuestLinearAddr, 8);
141AssertCompileMemberAlignment(VMXTRANSIENT, uGuestPhysicalAddr, 8);
142AssertCompileMemberAlignment(VMXTRANSIENT, uEntryIntInfo, 8);
143AssertCompileMemberAlignment(VMXTRANSIENT, cbEntryInstr, 8);
144/** Pointer to VMX transient state. */
145typedef VMXTRANSIENT *PVMXTRANSIENT;
146/** Pointer to a const VMX transient state. */
147typedef const VMXTRANSIENT *PCVMXTRANSIENT;
148
149
150/**
151 * VMX statistics structure.
152 */
153typedef struct VMXSTATISTICS
154{
155 /* These two comes because they are accessed from assembly and we don't
156 want to detail all the stats in the assembly version of this structure. */
157 STAMCOUNTER StatVmxWriteHostRip;
158 STAMCOUNTER StatVmxWriteHostRsp;
159 STAMCOUNTER StatVmxVmLaunch;
160 STAMCOUNTER StatVmxVmResume;
161
162 STAMPROFILEADV StatEntry;
163 STAMPROFILEADV StatPreExit;
164 STAMPROFILEADV StatExitHandling;
165 STAMPROFILEADV StatExitIO;
166 STAMPROFILEADV StatExitMovCRx;
167 STAMPROFILEADV StatExitXcptNmi;
168 STAMPROFILEADV StatExitVmentry;
169 STAMPROFILEADV StatImportGuestState;
170 STAMPROFILEADV StatExportGuestState;
171 STAMPROFILEADV StatLoadGuestFpuState;
172 STAMPROFILEADV StatInGC;
173 STAMPROFILEADV StatPoke;
174 STAMPROFILEADV StatSpinPoke;
175 STAMPROFILEADV StatSpinPokeFailed;
176
177 STAMCOUNTER StatInjectInterrupt;
178 STAMCOUNTER StatInjectXcpt;
179 STAMCOUNTER StatInjectReflect;
180 STAMCOUNTER StatInjectConvertDF;
181 STAMCOUNTER StatInjectInterpret;
182 STAMCOUNTER StatInjectReflectNPF;
183
184 STAMCOUNTER StatExitAll;
185 STAMCOUNTER StatNestedExitAll;
186 STAMCOUNTER StatExitShadowNM;
187 STAMCOUNTER StatExitGuestNM;
188 STAMCOUNTER StatExitShadowPF; /**< Misleading, currently used for MMIO \#PFs as well. */
189 STAMCOUNTER StatExitShadowPFEM;
190 STAMCOUNTER StatExitGuestPF;
191 STAMCOUNTER StatExitGuestUD;
192 STAMCOUNTER StatExitGuestSS;
193 STAMCOUNTER StatExitGuestNP;
194 STAMCOUNTER StatExitGuestTS;
195 STAMCOUNTER StatExitGuestOF;
196 STAMCOUNTER StatExitGuestGP;
197 STAMCOUNTER StatExitGuestDE;
198 STAMCOUNTER StatExitGuestDF;
199 STAMCOUNTER StatExitGuestBR;
200 STAMCOUNTER StatExitGuestAC;
201 STAMCOUNTER StatExitGuestACSplitLock;
202 STAMCOUNTER StatExitGuestDB;
203 STAMCOUNTER StatExitGuestMF;
204 STAMCOUNTER StatExitGuestBP;
205 STAMCOUNTER StatExitGuestXF;
206 STAMCOUNTER StatExitGuestXcpUnk;
207 STAMCOUNTER StatExitDRxWrite;
208 STAMCOUNTER StatExitDRxRead;
209 STAMCOUNTER StatExitCR0Read;
210 STAMCOUNTER StatExitCR2Read;
211 STAMCOUNTER StatExitCR3Read;
212 STAMCOUNTER StatExitCR4Read;
213 STAMCOUNTER StatExitCR8Read;
214 STAMCOUNTER StatExitCR0Write;
215 STAMCOUNTER StatExitCR2Write;
216 STAMCOUNTER StatExitCR3Write;
217 STAMCOUNTER StatExitCR4Write;
218 STAMCOUNTER StatExitCR8Write;
219 STAMCOUNTER StatExitRdmsr;
220 STAMCOUNTER StatExitWrmsr;
221 STAMCOUNTER StatExitClts;
222 STAMCOUNTER StatExitXdtrAccess;
223 STAMCOUNTER StatExitLmsw;
224 STAMCOUNTER StatExitIOWrite;
225 STAMCOUNTER StatExitIORead;
226 STAMCOUNTER StatExitIOStringWrite;
227 STAMCOUNTER StatExitIOStringRead;
228 STAMCOUNTER StatExitIntWindow;
229 STAMCOUNTER StatExitExtInt;
230 STAMCOUNTER StatExitHostNmiInGC;
231 STAMCOUNTER StatExitHostNmiInGCIpi;
232 STAMCOUNTER StatExitPreemptTimer;
233 STAMCOUNTER StatExitTprBelowThreshold;
234 STAMCOUNTER StatExitTaskSwitch;
235 STAMCOUNTER StatExitApicAccess;
236 STAMCOUNTER StatExitReasonNpf;
237
238 STAMCOUNTER StatNestedExitReasonNpf;
239
240 STAMCOUNTER StatFlushPage;
241 STAMCOUNTER StatFlushPageManual;
242 STAMCOUNTER StatFlushPhysPageManual;
243 STAMCOUNTER StatFlushTlb;
244 STAMCOUNTER StatFlushTlbNstGst;
245 STAMCOUNTER StatFlushTlbManual;
246 STAMCOUNTER StatFlushTlbWorldSwitch;
247 STAMCOUNTER StatNoFlushTlbWorldSwitch;
248 STAMCOUNTER StatFlushEntire;
249 STAMCOUNTER StatFlushAsid;
250 STAMCOUNTER StatFlushNestedPaging;
251 STAMCOUNTER StatFlushTlbInvlpgVirt;
252 STAMCOUNTER StatFlushTlbInvlpgPhys;
253 STAMCOUNTER StatTlbShootdown;
254 STAMCOUNTER StatTlbShootdownFlush;
255
256 STAMCOUNTER StatSwitchPendingHostIrq;
257 STAMCOUNTER StatSwitchTprMaskedIrq;
258 STAMCOUNTER StatSwitchGuestIrq;
259 STAMCOUNTER StatSwitchHmToR3FF;
260 STAMCOUNTER StatSwitchVmReq;
261 STAMCOUNTER StatSwitchPgmPoolFlush;
262 STAMCOUNTER StatSwitchDma;
263 STAMCOUNTER StatSwitchExitToR3;
264 STAMCOUNTER StatSwitchLongJmpToR3;
265 STAMCOUNTER StatSwitchMaxResumeLoops;
266 STAMCOUNTER StatSwitchHltToR3;
267 STAMCOUNTER StatSwitchApicAccessToR3;
268 STAMCOUNTER StatSwitchPreempt;
269 STAMCOUNTER StatSwitchNstGstVmexit;
270
271 STAMCOUNTER StatTscParavirt;
272 STAMCOUNTER StatTscOffset;
273 STAMCOUNTER StatTscIntercept;
274
275 STAMCOUNTER StatDRxArmed;
276 STAMCOUNTER StatDRxContextSwitch;
277 STAMCOUNTER StatDRxIoCheck;
278
279 STAMCOUNTER StatExportMinimal;
280 STAMCOUNTER StatExportFull;
281 STAMCOUNTER StatLoadGuestFpu;
282 STAMCOUNTER StatExportHostState;
283
284 STAMCOUNTER StatVmxCheckBadRmSelBase;
285 STAMCOUNTER StatVmxCheckBadRmSelLimit;
286 STAMCOUNTER StatVmxCheckBadRmSelAttr;
287 STAMCOUNTER StatVmxCheckBadV86SelBase;
288 STAMCOUNTER StatVmxCheckBadV86SelLimit;
289 STAMCOUNTER StatVmxCheckBadV86SelAttr;
290 STAMCOUNTER StatVmxCheckRmOk;
291 STAMCOUNTER StatVmxCheckBadSel;
292 STAMCOUNTER StatVmxCheckBadRpl;
293 STAMCOUNTER StatVmxCheckPmOk;
294
295 STAMCOUNTER StatVmxPreemptionRecalcingDeadline;
296 STAMCOUNTER StatVmxPreemptionRecalcingDeadlineExpired;
297 STAMCOUNTER StatVmxPreemptionReusingDeadline;
298 STAMCOUNTER StatVmxPreemptionReusingDeadlineExpired;
299
300#ifdef VBOX_WITH_STATISTICS
301 STAMCOUNTER aStatExitReason[MAX_EXITREASON_STAT];
302 STAMCOUNTER aStatNestedExitReason[MAX_EXITREASON_STAT];
303 STAMCOUNTER aStatInjectedIrqs[256];
304 STAMCOUNTER aStatInjectedXcpts[X86_XCPT_LAST + 1];
305#endif
306#ifdef HM_PROFILE_EXIT_DISPATCH
307 STAMPROFILEADV StatExitDispatch;
308#endif
309} VMXSTATISTICS;
310/** Pointer to the VMX statistics. */
311typedef VMXSTATISTICS *PVMXSTATISTICS;
312/** Pointer to a const VMX statistics structure. */
313typedef const VMXSTATISTICS *PCVMXSTATISTICS;
314
315/** @} */
316
317/** @} */
318
319RT_C_DECLS_END
320
321#endif /* !VMM_INCLUDED_SRC_include_VMXInternal_h */
322
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