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