VirtualBox

source: vbox/trunk/include/VBox/vmm/cpum.mac@ 61776

Last change on this file since 61776 was 61776, checked in by vboxsync, 8 years ago

CPUM,APIC: Per-CPU APIC CPUID feature bit and MSR_IA32_APICBASE GP mask adjustments.

  • Changed the PDMAPICHLPR3::pfnChangeFeature to pfnSetFeatureLevel, removing the RC and R0 versions.
  • Only use pfnSetFeatureLevel from the APIC constructor to communicate to CPUM the max APIC feature level, not to globally flip CPUID[1].EDX[9].
  • Renamed APIC enmOriginalMode to enmMaxMode, changing the type of it and the corresponding config values to PDMAPICMODE. This makes the above simpler and eliminates two conversion functions. It also makes APICMODE private to the APIC again.
  • Introduced CPUMSetGuestCpuIdPerCpuApicFeature for the per-CPU APIC feature bit management.
  • Introduced CPUMCPUIDLEAF_F_CONTAINS_APIC which works same as CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE and CPUMCPUIDLEAF_F_CONTAINS_APIC_ID. Updated existing CPU profiles with this.
  • Made the patch manager helper function actually handle CPUMCPUIDLEAF_F_CONTAINS_APIC and CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE (the latter previously relied on CPUMSetGuestCpuIdFeature/CPUMClearGuestCpuIdFeature from CPUMSetGuestCR4).
  • Pushed CPUMSetGuestCpuIdFeature, CPUMGetGuestCpuIdFeature and CPUMClearGuestCpuIdFeature down to ring-3 only (now CPUMR3*). The latter two function are deprecated.
  • Added call to CPUMSetGuestCpuIdPerCpuApicFeature from load function just in case the APIC is disabled by the guest at the time of saving.
  • CPUMSetGuestCpuIdFeature ensures we've got a MSR_IA32_APICBASE register when enabling the APIC.
  • CPUMSetGuestCpuIdFeature adjust the MSR_IA32_APICBASE GP mask when enabling x2APIC so setting MSR_IA32_APICBASE_EXTD does not trap.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1;; @file
2; CPUM - CPU Monitor, Assembly header file.
3;
4
5;
6; Copyright (C) 2006-2015 Oracle Corporation
7;
8; This file is part of VirtualBox Open Source Edition (OSE), as
9; available from http://www.virtualbox.org. This file is free software;
10; you can redistribute it and/or modify it under the terms of the GNU
11; General Public License (GPL) as published by the Free Software
12; Foundation, in version 2 as it comes in the "COPYING" file of the
13; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15;
16; The contents of this file may alternatively be used under the terms
17; of the Common Development and Distribution License Version 1.0
18; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19; VirtualBox OSE distribution, in which case the provisions of the
20; CDDL are applicable instead of those of the GPL.
21;
22; You may elect to license modified versions of this file under the
23; terms and conditions of either the GPL or the CDDL or both.
24;
25
26%ifndef ___VBox_vmm_cpum_mac__
27%define ___VBox_vmm_cpum_mac__
28
29%include "iprt/asmdefs.mac"
30
31
32;;
33; The volatile XSAVE components when VBOX_WITH_KERNEL_USING_XMM is active.
34; @note ASSUMED to be at the most 32-bit in width at the moment.
35%ifdef VBOX_WITH_KERNEL_USING_XMM
36 %define CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI)
37%endif
38
39;;
40; CPUID leaf.
41; @remarks This structure is used by the patch manager and can only be extended
42; by adding to the end of it.
43struc CPUMCPUIDLEAF
44 .uLeaf resd 1
45 .uSubLeaf resd 1
46 .fSubLeafMask resd 1
47 .uEax resd 1
48 .uEbx resd 1
49 .uEcx resd 1
50 .uEdx resd 1
51 .fFlags resd 1
52endstruc
53%define CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES RT_BIT_32(0)
54%define CPUMCPUIDLEAF_F_CONTAINS_APIC_ID RT_BIT_32(1)
55%define CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE RT_BIT_32(2)
56%define CPUMCPUIDLEAF_F_CONTAINS_APIC RT_BIT_32(3)
57
58
59;;
60; For the default CPUID leaf value.
61; @remarks This is used by the patch manager and cannot be modified in any way.
62struc CPUMCPUID
63 .uEax resd 1
64 .uEbx resd 1
65 .uEcx resd 1
66 .uEdx resd 1
67endstruc
68
69
70;; @name Method used to deal with unknown CPUID leaves.
71;; @{
72%define CPUMUNKNOWNCPUID_DEFAULTS 1
73%define CPUMUNKNOWNCPUID_LAST_STD_LEAF 2
74%define CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX 3
75%define CPUMUNKNOWNCPUID_PASSTHRU 4
76;; @}
77
78
79;;
80; Registers frame.
81; This is used internally in TRPM, VMMSwitcher_GuestToHost_GuestCtx
82; and other places.
83struc CPUMCTXCORE
84 .eax resq 1
85 .ecx resq 1
86 .edx resq 1
87 .ebx resq 1
88 .esp resq 1
89 .ebp resq 1
90 .esi resq 1
91 .edi resq 1
92 .r8 resq 1
93 .r9 resq 1
94 .r10 resq 1
95 .r11 resq 1
96 .r12 resq 1
97 .r13 resq 1
98 .r14 resq 1
99 .r15 resq 1
100 .es.Sel resw 1
101 .es.PaddingSel resw 1
102 .es.ValidSel resw 1
103 .es.fFlags resw 1
104 .es.u64Base resq 1
105 .es.u32Limit resd 1
106 .es.Attr resd 1
107 .cs.Sel resw 1
108 .cs.PaddingSel resw 1
109 .cs.ValidSel resw 1
110 .cs.fFlags resw 1
111 .cs.u64Base resq 1
112 .cs.u32Limit resd 1
113 .cs.Attr resd 1
114 .ss.Sel resw 1
115 .ss.PaddingSel resw 1
116 .ss.ValidSel resw 1
117 .ss.fFlags resw 1
118 .ss.u64Base resq 1
119 .ss.u32Limit resd 1
120 .ss.Attr resd 1
121 .ds.Sel resw 1
122 .ds.PaddingSel resw 1
123 .ds.ValidSel resw 1
124 .ds.fFlags resw 1
125 .ds.u64Base resq 1
126 .ds.u32Limit resd 1
127 .ds.Attr resd 1
128 .fs.Sel resw 1
129 .fs.PaddingSel resw 1
130 .fs.ValidSel resw 1
131 .fs.fFlags resw 1
132 .fs.u64Base resq 1
133 .fs.u32Limit resd 1
134 .fs.Attr resd 1
135 .gs.Sel resw 1
136 .gs.PaddingSel resw 1
137 .gs.ValidSel resw 1
138 .gs.fFlags resw 1
139 .gs.u64Base resq 1
140 .gs.u32Limit resd 1
141 .gs.Attr resd 1
142 .eip resq 1
143 .eflags resq 1
144endstruc
145
146
147%define XSTATE_SIZE 8192
148
149struc CPUMCTX
150 .eax resq 1
151 .ecx resq 1
152 .edx resq 1
153 .ebx resq 1
154 .esp resq 1
155 .ebp resq 1
156 .esi resq 1
157 .edi resq 1
158 .r8 resq 1
159 .r9 resq 1
160 .r10 resq 1
161 .r11 resq 1
162 .r12 resq 1
163 .r13 resq 1
164 .r14 resq 1
165 .r15 resq 1
166 .es.Sel resw 1
167 .es.PaddingSel resw 1
168 .es.ValidSel resw 1
169 .es.fFlags resw 1
170 .es.u64Base resq 1
171 .es.u32Limit resd 1
172 .es.Attr resd 1
173 .cs.Sel resw 1
174 .cs.PaddingSel resw 1
175 .cs.ValidSel resw 1
176 .cs.fFlags resw 1
177 .cs.u64Base resq 1
178 .cs.u32Limit resd 1
179 .cs.Attr resd 1
180 .ss.Sel resw 1
181 .ss.PaddingSel resw 1
182 .ss.ValidSel resw 1
183 .ss.fFlags resw 1
184 .ss.u64Base resq 1
185 .ss.u32Limit resd 1
186 .ss.Attr resd 1
187 .ds.Sel resw 1
188 .ds.PaddingSel resw 1
189 .ds.ValidSel resw 1
190 .ds.fFlags resw 1
191 .ds.u64Base resq 1
192 .ds.u32Limit resd 1
193 .ds.Attr resd 1
194 .fs.Sel resw 1
195 .fs.PaddingSel resw 1
196 .fs.ValidSel resw 1
197 .fs.fFlags resw 1
198 .fs.u64Base resq 1
199 .fs.u32Limit resd 1
200 .fs.Attr resd 1
201 .gs.Sel resw 1
202 .gs.PaddingSel resw 1
203 .gs.ValidSel resw 1
204 .gs.fFlags resw 1
205 .gs.u64Base resq 1
206 .gs.u32Limit resd 1
207 .gs.Attr resd 1
208 .eip resq 1
209 .eflags resq 1
210 .cr0 resq 1
211 .cr2 resq 1
212 .cr3 resq 1
213 .cr4 resq 1
214 .dr resq 8
215 .gdtrPadding resw 3
216 .gdtr resw 0
217 .gdtr.cbGdt resw 1
218 .gdtr.pGdt resq 1
219 .idtrPadding resw 3
220 .idtr resw 0
221 .idtr.cbIdt resw 1
222 .idtr.pIdt resq 1
223 .ldtr.Sel resw 1
224 .ldtr.PaddingSel resw 1
225 .ldtr.ValidSel resw 1
226 .ldtr.fFlags resw 1
227 .ldtr.u64Base resq 1
228 .ldtr.u32Limit resd 1
229 .ldtr.Attr resd 1
230 .tr.Sel resw 1
231 .tr.PaddingSel resw 1
232 .tr.ValidSel resw 1
233 .tr.fFlags resw 1
234 .tr.u64Base resq 1
235 .tr.u32Limit resd 1
236 .tr.Attr resd 1
237 .SysEnter.cs resb 8
238 .SysEnter.eip resb 8
239 .SysEnter.esp resb 8
240 .msrEFER resb 8
241 .msrSTAR resb 8
242 .msrPAT resb 8
243 .msrLSTAR resb 8
244 .msrCSTAR resb 8
245 .msrSFMASK resb 8
246 .msrKERNELGSBASE resb 8
247 .msrApicBase resb 8
248 alignb 8
249 .aXcr resq 2
250 .fXStateMask resq 1
251 .pXStateR0 RTR0PTR_RES 1
252 .pXStateR3 RTR3PTR_RES 1
253 .pXStateRC RTRCPTR_RES 1
254 .aoffXState resw 64
255 alignb 64
256endstruc
257
258
259%define CPUMSELREG_FLAGS_VALID 0x0001
260%define CPUMSELREG_FLAGS_STALE 0x0002
261%define CPUMSELREG_FLAGS_VALID_MASK 0x0003
262
263
264;;
265; Guest MSR state.
266struc CPUMCTXMSRS
267 .au64 resq 64
268endstruc
269
270
271%endif
272
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