1 | ;; @file
|
---|
2 | ; CPUM - CPU Monitor, Assembly header file.
|
---|
3 | ;
|
---|
4 |
|
---|
5 | ;
|
---|
6 | ; Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
7 | ;
|
---|
8 | ; This file is part of VirtualBox base platform packages, as
|
---|
9 | ; available from https://www.virtualbox.org.
|
---|
10 | ;
|
---|
11 | ; This program is free software; you can redistribute it and/or
|
---|
12 | ; modify it under the terms of the GNU General Public License
|
---|
13 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
14 | ; License.
|
---|
15 | ;
|
---|
16 | ; This program is distributed in the hope that it will be useful, but
|
---|
17 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | ; General Public License for more details.
|
---|
20 | ;
|
---|
21 | ; You should have received a copy of the GNU General Public License
|
---|
22 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | ;
|
---|
24 | ; The contents of this file may alternatively be used under the terms
|
---|
25 | ; of the Common Development and Distribution License Version 1.0
|
---|
26 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | ; CDDL are applicable instead of those of the GPL.
|
---|
29 | ;
|
---|
30 | ; You may elect to license modified versions of this file under the
|
---|
31 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | ;
|
---|
33 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | ;
|
---|
35 |
|
---|
36 | %ifndef ___VBox_vmm_cpum_mac__
|
---|
37 | %define ___VBox_vmm_cpum_mac__
|
---|
38 |
|
---|
39 | %include "iprt/asmdefs.mac"
|
---|
40 |
|
---|
41 |
|
---|
42 | ;;
|
---|
43 | ; The volatile XSAVE components when VBOX_WITH_KERNEL_USING_XMM is active.
|
---|
44 | ; @note ASSUMED to be at the most 32-bit in width at the moment.
|
---|
45 | %ifdef VBOX_WITH_KERNEL_USING_XMM
|
---|
46 | %define CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI)
|
---|
47 | %endif
|
---|
48 |
|
---|
49 | ;;
|
---|
50 | ; CPUID leaf.
|
---|
51 | ; @remarks This structure is used by the patch manager and can only be extended
|
---|
52 | ; by adding to the end of it.
|
---|
53 | struc CPUMCPUIDLEAF
|
---|
54 | .uLeaf resd 1
|
---|
55 | .uSubLeaf resd 1
|
---|
56 | .fSubLeafMask resd 1
|
---|
57 | .uEax resd 1
|
---|
58 | .uEbx resd 1
|
---|
59 | .uEcx resd 1
|
---|
60 | .uEdx resd 1
|
---|
61 | .fFlags resd 1
|
---|
62 | endstruc
|
---|
63 | %define CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES RT_BIT_32(0)
|
---|
64 | %define CPUMCPUIDLEAF_F_CONTAINS_APIC_ID RT_BIT_32(1)
|
---|
65 | %define CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE RT_BIT_32(2)
|
---|
66 | %define CPUMCPUIDLEAF_F_CONTAINS_APIC RT_BIT_32(3)
|
---|
67 |
|
---|
68 |
|
---|
69 | ;;
|
---|
70 | ; For the default CPUID leaf value.
|
---|
71 | ; @remarks This is used by the patch manager and cannot be modified in any way.
|
---|
72 | struc CPUMCPUID
|
---|
73 | .uEax resd 1
|
---|
74 | .uEbx resd 1
|
---|
75 | .uEcx resd 1
|
---|
76 | .uEdx resd 1
|
---|
77 | endstruc
|
---|
78 |
|
---|
79 |
|
---|
80 | ;; @name Method used to deal with unknown CPUID leaves.
|
---|
81 | ;; @{
|
---|
82 | %define CPUMUNKNOWNCPUID_DEFAULTS 1
|
---|
83 | %define CPUMUNKNOWNCPUID_LAST_STD_LEAF 2
|
---|
84 | %define CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX 3
|
---|
85 | %define CPUMUNKNOWNCPUID_PASSTHRU 4
|
---|
86 | ;; @}
|
---|
87 |
|
---|
88 |
|
---|
89 | %define XSTATE_SIZE 8192
|
---|
90 |
|
---|
91 | ;; Note! Updates here must be reflected in CPUMInternal.mac too!
|
---|
92 | struc CPUMCTX
|
---|
93 | .eax resq 1
|
---|
94 | .ecx resq 1
|
---|
95 | .edx resq 1
|
---|
96 | .ebx resq 1
|
---|
97 | .esp resq 1
|
---|
98 | .ebp resq 1
|
---|
99 | .esi resq 1
|
---|
100 | .edi resq 1
|
---|
101 | .r8 resq 1
|
---|
102 | .r9 resq 1
|
---|
103 | .r10 resq 1
|
---|
104 | .r11 resq 1
|
---|
105 | .r12 resq 1
|
---|
106 | .r13 resq 1
|
---|
107 | .r14 resq 1
|
---|
108 | .r15 resq 1
|
---|
109 | .es.Sel resw 1
|
---|
110 | .es.PaddingSel resw 1
|
---|
111 | .es.ValidSel resw 1
|
---|
112 | .es.fFlags resw 1
|
---|
113 | .es.u64Base resq 1
|
---|
114 | .es.u32Limit resd 1
|
---|
115 | .es.Attr resd 1
|
---|
116 | .cs.Sel resw 1
|
---|
117 | .cs.PaddingSel resw 1
|
---|
118 | .cs.ValidSel resw 1
|
---|
119 | .cs.fFlags resw 1
|
---|
120 | .cs.u64Base resq 1
|
---|
121 | .cs.u32Limit resd 1
|
---|
122 | .cs.Attr resd 1
|
---|
123 | .ss.Sel resw 1
|
---|
124 | .ss.PaddingSel resw 1
|
---|
125 | .ss.ValidSel resw 1
|
---|
126 | .ss.fFlags resw 1
|
---|
127 | .ss.u64Base resq 1
|
---|
128 | .ss.u32Limit resd 1
|
---|
129 | .ss.Attr resd 1
|
---|
130 | .ds.Sel resw 1
|
---|
131 | .ds.PaddingSel resw 1
|
---|
132 | .ds.ValidSel resw 1
|
---|
133 | .ds.fFlags resw 1
|
---|
134 | .ds.u64Base resq 1
|
---|
135 | .ds.u32Limit resd 1
|
---|
136 | .ds.Attr resd 1
|
---|
137 | .fs.Sel resw 1
|
---|
138 | .fs.PaddingSel resw 1
|
---|
139 | .fs.ValidSel resw 1
|
---|
140 | .fs.fFlags resw 1
|
---|
141 | .fs.u64Base resq 1
|
---|
142 | .fs.u32Limit resd 1
|
---|
143 | .fs.Attr resd 1
|
---|
144 | .gs.Sel resw 1
|
---|
145 | .gs.PaddingSel resw 1
|
---|
146 | .gs.ValidSel resw 1
|
---|
147 | .gs.fFlags resw 1
|
---|
148 | .gs.u64Base resq 1
|
---|
149 | .gs.u32Limit resd 1
|
---|
150 | .gs.Attr resd 1
|
---|
151 | .ldtr.Sel resw 1
|
---|
152 | .ldtr.PaddingSel resw 1
|
---|
153 | .ldtr.ValidSel resw 1
|
---|
154 | .ldtr.fFlags resw 1
|
---|
155 | .ldtr.u64Base resq 1
|
---|
156 | .ldtr.u32Limit resd 1
|
---|
157 | .ldtr.Attr resd 1
|
---|
158 | .tr.Sel resw 1
|
---|
159 | .tr.PaddingSel resw 1
|
---|
160 | .tr.ValidSel resw 1
|
---|
161 | .tr.fFlags resw 1
|
---|
162 | .tr.u64Base resq 1
|
---|
163 | .tr.u32Limit resd 1
|
---|
164 | .tr.Attr resd 1
|
---|
165 | .eip resq 1
|
---|
166 | .eflags resq 1
|
---|
167 | .fInhibit resb 1
|
---|
168 | alignb 8
|
---|
169 | .uRipInhibitInt resq 1
|
---|
170 | .cr0 resq 1
|
---|
171 | .cr2 resq 1
|
---|
172 | .cr3 resq 1
|
---|
173 | .cr4 resq 1
|
---|
174 | .dr resq 8
|
---|
175 | .gdtrPadding resw 3
|
---|
176 | .gdtr resw 0
|
---|
177 | .gdtr.cbGdt resw 1
|
---|
178 | .gdtr.pGdt resq 1
|
---|
179 | .idtrPadding resw 3
|
---|
180 | .idtr resw 0
|
---|
181 | .idtr.cbIdt resw 1
|
---|
182 | .idtr.pIdt resq 1
|
---|
183 | .SysEnter.cs resb 8
|
---|
184 | .SysEnter.eip resb 8
|
---|
185 | .SysEnter.esp resb 8
|
---|
186 | .msrEFER resb 8
|
---|
187 | .msrSTAR resb 8
|
---|
188 | .msrPAT resb 8
|
---|
189 | .msrLSTAR resb 8
|
---|
190 | .msrCSTAR resb 8
|
---|
191 | .msrSFMASK resb 8
|
---|
192 | .msrKERNELGSBASE resb 8
|
---|
193 |
|
---|
194 | alignb 8
|
---|
195 | .fExtrn resq 1
|
---|
196 |
|
---|
197 | alignb 32
|
---|
198 | .aPaePdpes resq 4
|
---|
199 |
|
---|
200 | alignb 8
|
---|
201 | .aXcr resq 2
|
---|
202 | .fXStateMask resq 1
|
---|
203 | .fUsedFpuGuest resb 1
|
---|
204 | alignb 8
|
---|
205 | .aoffXState resw 64
|
---|
206 | alignb 256
|
---|
207 | .abXState resb 0x4000-0x300
|
---|
208 | .XState EQU .abXState
|
---|
209 |
|
---|
210 | alignb 4096
|
---|
211 | .hwvirt resb 0
|
---|
212 | .hwvirt.svm resb 0
|
---|
213 | .hwvirt.vmx resb 0
|
---|
214 |
|
---|
215 | .hwvirt.svm.Vmcb EQU .hwvirt.svm
|
---|
216 | .hwvirt.svm.abMsrBitmap EQU (.hwvirt.svm.Vmcb + 0x1000)
|
---|
217 | .hwvirt.svm.abIoBitmap EQU (.hwvirt.svm.abMsrBitmap + 0x2000)
|
---|
218 | .hwvirt.svm.uMsrHSavePa EQU (.hwvirt.svm.abIoBitmap + 0x3000) ; resq 1
|
---|
219 | .hwvirt.svm.GCPhysVmcb EQU (.hwvirt.svm.uMsrHSavePa + 8) ; resq 1
|
---|
220 | alignb 8
|
---|
221 | .hwvirt.svm.HostState EQU (.hwvirt.svm.GCPhysVmcb + 8) ; resb 184
|
---|
222 | .hwvirt.svm.uPrevPauseTick EQU (.hwvirt.svm.HostState + 184) ; resq 1
|
---|
223 | .hwvirt.svm.cPauseFilter EQU (.hwvirt.svm.uPrevPauseTick + 8) ; resw 1
|
---|
224 | .hwvirt.svm.cPauseFilterThreshold EQU (.hwvirt.svm.cPauseFilter + 2) ; resw 1
|
---|
225 | .hwvirt.svm.fInterceptEvents EQU (.hwvirt.svm.cPauseFilterThreshold + 2) ; resb 1
|
---|
226 |
|
---|
227 | .hwvirt.vmx.Vmcs resb 0x1000
|
---|
228 | .hwvirt.vmx.ShadowVmcs resb 0x1000
|
---|
229 | .hwvirt.vmx.abVmreadBitmap resb 0x1000
|
---|
230 | .hwvirt.vmx.abVmwriteBitmap resb 0x1000
|
---|
231 | .hwvirt.vmx.aEntryMsrLoadArea resb 0x2000
|
---|
232 | .hwvirt.vmx.aExitMsrStoreArea resb 0x2000
|
---|
233 | .hwvirt.vmx.aExitMsrLoadArea resb 0x2000
|
---|
234 | .hwvirt.vmx.abMsrBitmap resb 0x1000
|
---|
235 | .hwvirt.vmx.abIoBitmap resb 0x1000+0x1000
|
---|
236 | alignb 8
|
---|
237 | .hwvirt.vmx.GCPhysVmxon resq 1
|
---|
238 | .hwvirt.vmx.GCPhysVmcs resq 1
|
---|
239 | .hwvirt.vmx.GCPhysShadowVmcs resq 1
|
---|
240 | .hwvirt.vmx.enmDiag resd 1
|
---|
241 | .hwvirt.vmx.enmAbort resd 1
|
---|
242 | .hwvirt.vmx.uDiagAux resq 1
|
---|
243 | .hwvirt.vmx.uAbortAux resd 1
|
---|
244 | .hwvirt.vmx.fInVmxRootMode resb 1
|
---|
245 | .hwvirt.vmx.fInVmxNonRootMode resb 1
|
---|
246 | .hwvirt.vmx.fInterceptEvents resb 1
|
---|
247 | .hwvirt.vmx.fNmiUnblockingIret resb 1
|
---|
248 | .hwvirt.vmx.uFirstPauseLoopTick resq 1
|
---|
249 | .hwvirt.vmx.uPrevPauseTick resq 1
|
---|
250 | .hwvirt.vmx.uEntryTick resq 1
|
---|
251 | .hwvirt.vmx.offVirtApicWrite resw 1
|
---|
252 | .hwvirt.vmx.fVirtNmiBlocking resb 1
|
---|
253 | alignb 8
|
---|
254 | .hwvirt.vmx.Msrs resb 224
|
---|
255 |
|
---|
256 | alignb 8
|
---|
257 | .hwvirt.enmHwvirt resd 1
|
---|
258 | .hwvirt.fGif resb 1
|
---|
259 | alignb 4
|
---|
260 | .hwvirt.fSavedInhibit resd 1
|
---|
261 | alignb 64
|
---|
262 | endstruc
|
---|
263 |
|
---|
264 |
|
---|
265 | %define CPUMSELREG_FLAGS_VALID 0x0001
|
---|
266 | %define CPUMSELREG_FLAGS_STALE 0x0002
|
---|
267 | %define CPUMSELREG_FLAGS_VALID_MASK 0x0003
|
---|
268 |
|
---|
269 |
|
---|
270 | ;;
|
---|
271 | ; Guest MSR state.
|
---|
272 | struc CPUMCTXMSRS
|
---|
273 | .au64 resq 64
|
---|
274 | endstruc
|
---|
275 |
|
---|
276 |
|
---|
277 | %endif
|
---|
278 |
|
---|