1 | ;$Id: HMInternal.mac 87401 2021-01-23 02:45:29Z 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 |
|
---|
23 | struc VMXVMCSINFO
|
---|
24 | .pfnStartVM RTR0PTR_RES 1
|
---|
25 | .HCPhysEPTP RTHCPHYS_RES 1
|
---|
26 | .fVmcsState resd 1
|
---|
27 | .fShadowVmcsState resd 1
|
---|
28 | .idHostCpuState resd 1
|
---|
29 | .idHostCpuExec resd 1
|
---|
30 | .cEntryMsrLoad resd 1
|
---|
31 | .cExitMsrStore resd 1
|
---|
32 | .cExitMsrLoad resd 1
|
---|
33 |
|
---|
34 | .u32PinCtls resd 1
|
---|
35 | .u32ProcCtls resd 1
|
---|
36 | .u32ProcCtls2 resd 1
|
---|
37 | .u32EntryCtls resd 1
|
---|
38 | .u32ExitCtls resd 1
|
---|
39 | .u32XcptBitmap resd 1
|
---|
40 | .u32XcptPFMask resd 1
|
---|
41 | .u32XcptPFMatch resd 1
|
---|
42 |
|
---|
43 | alignb 8
|
---|
44 | .u64TscOffset resq 1
|
---|
45 | .u64VmcsLinkPtr resq 1
|
---|
46 | .u64Cr0Mask resq 1
|
---|
47 | .u64Cr4Mask resq 1
|
---|
48 |
|
---|
49 | .pvVmcs RTR0PTR_RES 1
|
---|
50 | .pvShadowVmcs RTR0PTR_RES 1
|
---|
51 | .pbVirtApic RTR0PTR_RES 1
|
---|
52 | .pvMsrBitmap RTR0PTR_RES 1
|
---|
53 | .pvGuestMsrLoad RTR0PTR_RES 1
|
---|
54 | .pvGuestMsrStore RTR0PTR_RES 1
|
---|
55 | .pvHostMsrLoad RTR0PTR_RES 1
|
---|
56 |
|
---|
57 | .fWasInRealMode resb 1
|
---|
58 | .fSwitchedTo64on32Obsolete resb 1
|
---|
59 | alignb 8
|
---|
60 | .RealMode.AttrCS resd 1
|
---|
61 | .RealMode.AttrDS resd 1
|
---|
62 | .RealMode.AttrES resd 1
|
---|
63 | .RealMode.AttrFS resd 1
|
---|
64 | .RealMode.AttrGS resd 1
|
---|
65 | .RealMode.AttrSS resd 1
|
---|
66 | .RealMode.Eflags resd 1 ; should be EFlags?
|
---|
67 | .RealMode.fRealOnV86Active resb 1
|
---|
68 |
|
---|
69 | alignb 8
|
---|
70 | .HCPhysVmcs RTHCPHYS_RES 1
|
---|
71 | .HCPhysShadowVmcs RTHCPHYS_RES 1
|
---|
72 | .HCPhysVirtApic RTHCPHYS_RES 1
|
---|
73 | .HCPhysMsrBitmap RTHCPHYS_RES 1
|
---|
74 | .HCPhysGuestMsrLoad RTHCPHYS_RES 1
|
---|
75 | .HCPhysGuestMsrStore RTHCPHYS_RES 1
|
---|
76 | .HCPhysHostMsrLoad RTHCPHYS_RES 1
|
---|
77 |
|
---|
78 | .hMemObj RTR0PTR_RES 1
|
---|
79 |
|
---|
80 | alignb 8
|
---|
81 | .au64LbrFromIpMsr resq 32
|
---|
82 | .au64LbrToIpMsr resq 32
|
---|
83 | .u64LbrTosMsr resq 1
|
---|
84 | endstruc
|
---|
85 |
|
---|
86 | %define VMX_RESTORE_HOST_SEL_DS 0001h ;RT_BIT(0)
|
---|
87 | %define VMX_RESTORE_HOST_SEL_ES 0002h ;RT_BIT(1)
|
---|
88 | %define VMX_RESTORE_HOST_SEL_FS 0004h ;RT_BIT(2)
|
---|
89 | %define VMX_RESTORE_HOST_SEL_GS 0008h ;RT_BIT(3)
|
---|
90 | %define VMX_RESTORE_HOST_SEL_TR 0010h ;RT_BIT(4)
|
---|
91 | %define VMX_RESTORE_HOST_GDTR 0020h ;RT_BIT(5)
|
---|
92 | %define VMX_RESTORE_HOST_IDTR 0040h ;RT_BIT(6)
|
---|
93 | %define VMX_RESTORE_HOST_GDT_READ_ONLY 0080h ;RT_BIT(7)
|
---|
94 | %define VMX_RESTORE_HOST_GDT_NEED_WRITABLE 0100h ;RT_BIT(8)
|
---|
95 | %define VMX_RESTORE_HOST_CAN_USE_WRFSBASE_AND_WRGSBASE 0200h ;RT_BIT(9)
|
---|
96 | %define VMX_RESTORE_HOST_REQUIRED 0400h ;RT_BIT(10) - must be the highest bit!
|
---|
97 | struc VMXRESTOREHOST
|
---|
98 | .uHostSelDS resw 1
|
---|
99 | .uHostSelES resw 1
|
---|
100 | .uHostSelFS resw 1
|
---|
101 | .HostGdtr resb 10
|
---|
102 | .uHostSelGS resw 1
|
---|
103 | .uHostSelTR resw 1
|
---|
104 | .abPadding0 resb 2
|
---|
105 | .HostGdtrRw resb 10
|
---|
106 | .abPadding1 resb 6
|
---|
107 | .HostIdtr resb 10
|
---|
108 | alignb 8
|
---|
109 | .uHostFSBase resq 1
|
---|
110 | .uHostGSBase resq 1
|
---|
111 | endstruc
|
---|
112 |
|
---|
113 | struc HMCPUVMX
|
---|
114 | .VmcsInfo resb VMXVMCSINFO_size
|
---|
115 | .VmcsInfoNstGst resb VMXVMCSINFO_size
|
---|
116 | .fSwitchedToNstGstVmcs resb 1
|
---|
117 | .fMergedNstGstCtls resb 1
|
---|
118 | .fCopiedNstGstToShadowVmcs resb 1
|
---|
119 | .fSwitchedNstGstFlushTlb resb 1
|
---|
120 |
|
---|
121 | alignb 8
|
---|
122 | .u64GstMsrApicBase resq 1
|
---|
123 |
|
---|
124 | .u64HostMsrLStar resq 1
|
---|
125 | .u64HostMsrStar resq 1
|
---|
126 | .u64HostMsrSfMask resq 1
|
---|
127 | .u64HostMsrKernelGsBase resq 1
|
---|
128 | .fLazyMsrs resd 1
|
---|
129 | .fUpdatedHostAutoMsrs resb 1
|
---|
130 | alignb 4
|
---|
131 | .fRestoreHostFlags resd 1
|
---|
132 | alignb 8
|
---|
133 | .RestoreHost resb VMXRESTOREHOST_size
|
---|
134 |
|
---|
135 | .LastError.idCurrentCpu resd 1
|
---|
136 | .LastError.idEnteredCpu resd 1
|
---|
137 | .LastError.HCPhysCurrentVmcs resq 1
|
---|
138 | .LastError.u32VmcsRev resd 1
|
---|
139 | .LastError.u32InstrError resd 1
|
---|
140 | .LastError.u32ExitReason resd 1
|
---|
141 | .LastError.u32GuestIntrState resd 1
|
---|
142 | endstruc
|
---|
143 |
|
---|
144 | struc HMCPUSVM
|
---|
145 | .pfnVMRun RTR0PTR_RES 1
|
---|
146 | .HCPhysVmcbHost RTHCPHYS_RES 1
|
---|
147 |
|
---|
148 | .hMemObjVmcbHost RTR0PTR_RES 1
|
---|
149 | .pvPadding RTR0PTR_RES 1 ; pointless padding
|
---|
150 |
|
---|
151 | .HCPhysVmcb RTHCPHYS_RES 1
|
---|
152 | .hMemObjVmcb RTR0PTR_RES 1
|
---|
153 | .pVmcb RTR0PTR_RES 1
|
---|
154 |
|
---|
155 | .HCPhysMsrBitmap RTHCPHYS_RES 1
|
---|
156 | .hMemObjMsrBitmap RTR0PTR_RES 1
|
---|
157 | .pvMsrBitmap RTR0PTR_RES 1
|
---|
158 |
|
---|
159 | .fSyncVTpr resb 1
|
---|
160 | .fEmulateLongModeSysEnterExit resb 1
|
---|
161 |
|
---|
162 | alignb 8
|
---|
163 | .u64HostTscAux resq 1
|
---|
164 |
|
---|
165 | .NstGstVmcbCache resb 40
|
---|
166 | endstruc
|
---|
167 |
|
---|
168 | struc HMCPU
|
---|
169 | .fCheckedTLBFlush resb 1
|
---|
170 | .fActive resb 1
|
---|
171 | .fLeaveDone resb 1
|
---|
172 | .fUsingHyperDR7 resb 1
|
---|
173 | .fForceTLBFlush resb 1
|
---|
174 | .fUseDebugLoop resb 1
|
---|
175 | .fUsingDebugLoop resb 1
|
---|
176 | .fDebugWantRdTscExit resb 1
|
---|
177 |
|
---|
178 | .fLoadSaveGuestXcr0 resb 1
|
---|
179 | .fGIMTrapXcptUD resb 1
|
---|
180 | .fTrapXcptGpForLovelyMesaDrv resb 1
|
---|
181 | .fSingleInstruction resb 1
|
---|
182 | .fClearTrapFlag resb 1
|
---|
183 | alignb 8
|
---|
184 |
|
---|
185 | .cWorldSwitchExits resd 1
|
---|
186 | .idLastCpu resd 1
|
---|
187 | .cTlbFlushes resd 1
|
---|
188 | .uCurrentAsid resd 1
|
---|
189 | .u32HMError resd 1
|
---|
190 | .rcLastExitToR3 resd 1
|
---|
191 | alignb 8
|
---|
192 | .fCtxChanged resq 1
|
---|
193 |
|
---|
194 | alignb 8
|
---|
195 | ;%if HMCPUVMX_size > HMCPUSVM_size
|
---|
196 | .u resb HMCPUVMX_size
|
---|
197 | ;%else
|
---|
198 | ; .u resb HMCPUSVM_size
|
---|
199 | ;%endif
|
---|
200 |
|
---|
201 | .Event.fPending resd 1
|
---|
202 | .Event.u32ErrCode resd 1
|
---|
203 | .Event.cbInstr resd 1
|
---|
204 | alignb 8
|
---|
205 | .Event.u64IntInfo resq 1
|
---|
206 | .Event.GCPtrFaultAddress RTGCPTR_RES 1
|
---|
207 |
|
---|
208 | .idEnteredCpu resd 1
|
---|
209 | .enmShadowMode resd 1
|
---|
210 | alignb 8
|
---|
211 | .aPdpes resq 4
|
---|
212 |
|
---|
213 | ; The remainer is disassembly state and statistics.
|
---|
214 | endstruc
|
---|
215 |
|
---|