1 | ;$Id: HMInternal.mac 87754 2021-02-13 17:44:31Z 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 VMX_VMCS_GUEST_FIELD_ES
|
---|
19 | %include "VBox/vmm/hm_vmx.mac" ; For VMXRESTOREHOST
|
---|
20 | %endif
|
---|
21 |
|
---|
22 | struc VMXVMCSINFOSHARED
|
---|
23 | .fWasInRealMode resb 1
|
---|
24 | alignb 8
|
---|
25 | .RealMode.AttrCS resd 1
|
---|
26 | .RealMode.AttrDS resd 1
|
---|
27 | .RealMode.AttrES resd 1
|
---|
28 | .RealMode.AttrFS resd 1
|
---|
29 | .RealMode.AttrGS resd 1
|
---|
30 | .RealMode.AttrSS resd 1
|
---|
31 | .RealMode.Eflags resd 1 ; should be EFlags?
|
---|
32 | .RealMode.fRealOnV86Active resb 1
|
---|
33 |
|
---|
34 | alignb 8
|
---|
35 | .au64LbrFromIpMsr resq 32
|
---|
36 | .au64LbrToIpMsr resq 32
|
---|
37 | .u64LbrTosMsr resq 1
|
---|
38 | endstruc
|
---|
39 |
|
---|
40 |
|
---|
41 | struc VMXVMCSINFO
|
---|
42 | .pShared RTR0PTR_RES 1
|
---|
43 |
|
---|
44 | .HCPhysEPTP RTHCPHYS_RES 1
|
---|
45 | .fVmcsState resd 1
|
---|
46 | .fShadowVmcsState resd 1
|
---|
47 | .idHostCpuState resd 1
|
---|
48 | .idHostCpuExec resd 1
|
---|
49 | .cEntryMsrLoad resd 1
|
---|
50 | .cExitMsrStore resd 1
|
---|
51 | .cExitMsrLoad resd 1
|
---|
52 |
|
---|
53 | .u32PinCtls resd 1
|
---|
54 | .u32ProcCtls resd 1
|
---|
55 | .u32ProcCtls2 resd 1
|
---|
56 | .u32EntryCtls resd 1
|
---|
57 | .u32ExitCtls resd 1
|
---|
58 | .u32XcptBitmap resd 1
|
---|
59 | .u32XcptPFMask resd 1
|
---|
60 | .u32XcptPFMatch resd 1
|
---|
61 |
|
---|
62 | alignb 8
|
---|
63 | .u64TscOffset resq 1
|
---|
64 | .u64VmcsLinkPtr resq 1
|
---|
65 | .u64Cr0Mask resq 1
|
---|
66 | .u64Cr4Mask resq 1
|
---|
67 | .uHostRip resq 1
|
---|
68 | .uHostRsp resq 1
|
---|
69 |
|
---|
70 | .pvVmcs RTR0PTR_RES 1
|
---|
71 | .pvShadowVmcs RTR0PTR_RES 1
|
---|
72 | .pbVirtApic RTR0PTR_RES 1
|
---|
73 | .pvMsrBitmap RTR0PTR_RES 1
|
---|
74 | .pvGuestMsrLoad RTR0PTR_RES 1
|
---|
75 | .pvGuestMsrStore RTR0PTR_RES 1
|
---|
76 | .pvHostMsrLoad RTR0PTR_RES 1
|
---|
77 |
|
---|
78 | alignb 8
|
---|
79 | .HCPhysVmcs RTHCPHYS_RES 1
|
---|
80 | .HCPhysShadowVmcs RTHCPHYS_RES 1
|
---|
81 | .HCPhysVirtApic RTHCPHYS_RES 1
|
---|
82 | .HCPhysMsrBitmap RTHCPHYS_RES 1
|
---|
83 | .HCPhysGuestMsrLoad RTHCPHYS_RES 1
|
---|
84 | .HCPhysGuestMsrStore RTHCPHYS_RES 1
|
---|
85 | .HCPhysHostMsrLoad RTHCPHYS_RES 1
|
---|
86 |
|
---|
87 | .hMemObj RTR0PTR_RES 1
|
---|
88 | endstruc
|
---|
89 |
|
---|
90 | %define VMX_RESTORE_HOST_SEL_DS 0001h ;RT_BIT(0)
|
---|
91 | %define VMX_RESTORE_HOST_SEL_ES 0002h ;RT_BIT(1)
|
---|
92 | %define VMX_RESTORE_HOST_SEL_FS 0004h ;RT_BIT(2)
|
---|
93 | %define VMX_RESTORE_HOST_SEL_GS 0008h ;RT_BIT(3)
|
---|
94 | %define VMX_RESTORE_HOST_SEL_TR 0010h ;RT_BIT(4)
|
---|
95 | %define VMX_RESTORE_HOST_GDTR 0020h ;RT_BIT(5)
|
---|
96 | %define VMX_RESTORE_HOST_IDTR 0040h ;RT_BIT(6)
|
---|
97 | %define VMX_RESTORE_HOST_GDT_READ_ONLY 0080h ;RT_BIT(7)
|
---|
98 | %define VMX_RESTORE_HOST_GDT_NEED_WRITABLE 0100h ;RT_BIT(8)
|
---|
99 | %define VMX_RESTORE_HOST_CAN_USE_WRFSBASE_AND_WRGSBASE 0200h ;RT_BIT(9)
|
---|
100 | %define VMX_RESTORE_HOST_REQUIRED 0400h ;RT_BIT(10) - must be the highest bit!
|
---|
101 | struc VMXRESTOREHOST
|
---|
102 | .uHostSelDS resw 1
|
---|
103 | .uHostSelES resw 1
|
---|
104 | .uHostSelFS resw 1
|
---|
105 | .HostGdtr resb 10
|
---|
106 | .uHostSelGS resw 1
|
---|
107 | .uHostSelTR resw 1
|
---|
108 | .uHostSelSS resw 1
|
---|
109 | .HostGdtrRw resb 10
|
---|
110 | .uHostSelCS resw 1
|
---|
111 | .abPadding1 resb 4
|
---|
112 | .HostIdtr resb 10
|
---|
113 | alignb 8
|
---|
114 | .uHostFSBase resq 1
|
---|
115 | .uHostGSBase resq 1
|
---|
116 | endstruc
|
---|
117 |
|
---|
118 | struc HMCPUVMX
|
---|
119 | .VmcsInfo resb VMXVMCSINFOSHARED_size
|
---|
120 | .VmcsInfoNstGst resb VMXVMCSINFOSHARED_size
|
---|
121 | .fSwitchedToNstGstVmcsCopyForRing3 resb 1
|
---|
122 | .fMergedNstGstCtls resb 1
|
---|
123 | .fCopiedNstGstToShadowVmcs resb 1
|
---|
124 | .fSwitchedNstGstFlushTlb resb 1
|
---|
125 |
|
---|
126 | alignb 8
|
---|
127 | .u64GstMsrApicBase resq 1
|
---|
128 |
|
---|
129 | .LastError.idCurrentCpu resd 1
|
---|
130 | .LastError.idEnteredCpu resd 1
|
---|
131 | .LastError.HCPhysCurrentVmcs resq 1
|
---|
132 | .LastError.u32VmcsRev resd 1
|
---|
133 | .LastError.u32InstrError resd 1
|
---|
134 | .LastError.u32ExitReason resd 1
|
---|
135 | .LastError.u32GuestIntrState resd 1
|
---|
136 | endstruc
|
---|
137 |
|
---|
138 | struc HMCPUSVM
|
---|
139 | .fEmulateLongModeSysEnterExit resb 1
|
---|
140 |
|
---|
141 | alignb 8
|
---|
142 | .NstGstVmcbCache resb 40
|
---|
143 | endstruc
|
---|
144 |
|
---|
145 | struc HMCPU
|
---|
146 | .fCheckedTLBFlush resb 1
|
---|
147 | .fActive resb 1
|
---|
148 | .fUseDebugLoop resb 1
|
---|
149 |
|
---|
150 | .fGIMTrapXcptUD resb 1
|
---|
151 | .fTrapXcptGpForLovelyMesaDrv resb 1
|
---|
152 | .fSingleInstruction resb 1
|
---|
153 | alignb 8
|
---|
154 |
|
---|
155 | .u32HMError resd 1
|
---|
156 | .rcLastExitToR3 resd 1
|
---|
157 | alignb 8
|
---|
158 | .fCtxChanged resq 1
|
---|
159 |
|
---|
160 | alignb 8
|
---|
161 | .vmx resb HMCPUVMX_size
|
---|
162 | alignb 8
|
---|
163 | .svm resb HMCPUSVM_size
|
---|
164 |
|
---|
165 | .Event.fPending resd 1
|
---|
166 | .Event.u32ErrCode resd 1
|
---|
167 | .Event.cbInstr resd 1
|
---|
168 | alignb 8
|
---|
169 | .Event.u64IntInfo resq 1
|
---|
170 | .Event.GCPtrFaultAddress RTGCPTR_RES 1
|
---|
171 |
|
---|
172 | .enmShadowMode resd 1
|
---|
173 | alignb 8
|
---|
174 | .aPdpes resq 4
|
---|
175 |
|
---|
176 | .StatVmxWriteHostRip resq 1
|
---|
177 | .StatVmxWriteHostRsp resq 1
|
---|
178 |
|
---|
179 | ; The remainer is disassembly state and statistics.
|
---|
180 | endstruc
|
---|
181 |
|
---|
182 | struc HMR0CPUVMX
|
---|
183 | .pfnStartVm RTR0PTR_RES 1
|
---|
184 | .uTscDeadline resq 1
|
---|
185 | .uTscDeadlineVersion resq 1
|
---|
186 |
|
---|
187 |
|
---|
188 | .VmcsInfo resb VMXVMCSINFO_size
|
---|
189 | .VmcsInfoNstGst resb VMXVMCSINFO_size
|
---|
190 | .fSwitchedToNstGstVmcs resb 1
|
---|
191 |
|
---|
192 | alignb 8
|
---|
193 | .u64HostMsrLStar resq 1
|
---|
194 | .u64HostMsrStar resq 1
|
---|
195 | .u64HostMsrSfMask resq 1
|
---|
196 | .u64HostMsrKernelGsBase resq 1
|
---|
197 | .fLazyMsrs resd 1
|
---|
198 | .fUpdatedHostAutoMsrs resb 1
|
---|
199 | alignb 4
|
---|
200 | .fRestoreHostFlags resd 1
|
---|
201 | alignb 8
|
---|
202 | .RestoreHost resb VMXRESTOREHOST_size
|
---|
203 | endstruc
|
---|
204 |
|
---|
205 | struc HMR0CPUSVM
|
---|
206 | .pfnVMRun RTR0PTR_RES 1
|
---|
207 |
|
---|
208 | alignb 8
|
---|
209 | .HCPhysVmcbHost RTHCPHYS_RES 1
|
---|
210 |
|
---|
211 | alignb 8
|
---|
212 | .hMemObjVmcbHost RTR0PTR_RES 1
|
---|
213 |
|
---|
214 | alignb 8
|
---|
215 | .HCPhysVmcb RTHCPHYS_RES 1
|
---|
216 | .hMemObjVmcb RTR0PTR_RES 1
|
---|
217 | .pVmcb RTR0PTR_RES 1
|
---|
218 |
|
---|
219 | alignb 8
|
---|
220 | .HCPhysMsrBitmap RTHCPHYS_RES 1
|
---|
221 | .hMemObjMsrBitmap RTR0PTR_RES 1
|
---|
222 | .pvMsrBitmap RTR0PTR_RES 1
|
---|
223 |
|
---|
224 | .fSyncVTpr resb 1
|
---|
225 |
|
---|
226 | alignb 8
|
---|
227 | .u64HostTscAux resq 1
|
---|
228 |
|
---|
229 | alignb 8
|
---|
230 | .DisState resb 0d8h
|
---|
231 | endstruc
|
---|
232 |
|
---|
233 | struc HMR0PERVCPU
|
---|
234 | .cWorldSwitchExits resd 1
|
---|
235 | .cTlbFlushes resd 1
|
---|
236 | .idLastCpu resd 1
|
---|
237 | .idEnteredCpu resd 1
|
---|
238 | .uCurrentAsid resd 1
|
---|
239 |
|
---|
240 | .fForceTLBFlush resb 1
|
---|
241 | .fLeaveDone resb 1
|
---|
242 | .fUsingHyperDR7 resb 1
|
---|
243 | .fUsingDebugLoop resb 1
|
---|
244 | .fDebugWantRdTscExit resb 1
|
---|
245 | .fLoadSaveGuestXcr0 resb 1
|
---|
246 | .fClearTrapFlag resb 1
|
---|
247 |
|
---|
248 | alignb 4
|
---|
249 | .fWorldSwitcher resd 1
|
---|
250 | .uTscExit resq 1
|
---|
251 |
|
---|
252 | alignb 8
|
---|
253 | .vmx resb HMR0CPUVMX_size
|
---|
254 | alignb 8
|
---|
255 | .svm resb HMR0CPUSVM_size
|
---|
256 | endstruc
|
---|
257 |
|
---|
258 | %define HM_WSF_IBPB_EXIT RT_BIT_32(0)
|
---|
259 | %define HM_WSF_IBPB_ENTRY RT_BIT_32(1)
|
---|
260 | %define HM_WSF_L1D_ENTRY RT_BIT_32(2)
|
---|
261 | %define HM_WSF_MDS_ENTRY RT_BIT_32(3)
|
---|
262 |
|
---|