VirtualBox

source: vbox/trunk/include/VBox/vmm/cpum.h@ 107763

Last change on this file since 107763 was 107749, checked in by vboxsync, 6 weeks ago

VMM/CPUM: Pass thru more MSR_IA32_SPEC_CTRL related stuff to the guest. jiraref:VBP-947

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 68.8 KB
Line 
1/** @file
2 * CPUM - CPU Monitor(/ Manager).
3 */
4
5/*
6 * Copyright (C) 2006-2024 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_INCLUDED_vmm_cpum_h
37#define VBOX_INCLUDED_vmm_cpum_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <VBox/types.h>
43#include <VBox/vmm/cpumctx.h>
44#include <VBox/vmm/stam.h>
45#include <VBox/vmm/vmapi.h>
46#include <VBox/vmm/cpum-common.h>
47
48
49/** @defgroup grp_cpum The CPU Monitor / Manager API
50 * @ingroup grp_vmm
51 * @{
52 */
53
54/**
55 * CPU Vendor.
56 */
57typedef enum CPUMCPUVENDOR
58{
59 CPUMCPUVENDOR_INVALID = 0,
60 CPUMCPUVENDOR_INTEL,
61 CPUMCPUVENDOR_AMD,
62 CPUMCPUVENDOR_VIA,
63 CPUMCPUVENDOR_CYRIX,
64 CPUMCPUVENDOR_SHANGHAI,
65 CPUMCPUVENDOR_HYGON,
66 CPUMCPUVENDOR_APPLE, /**< ARM */
67 CPUMCPUVENDOR_UNKNOWN,
68 /** 32bit hackishness. */
69 CPUMCPUVENDOR_32BIT_HACK = 0x7fffffff
70} CPUMCPUVENDOR;
71
72
73/**
74 * CPU architecture.
75 */
76typedef enum CPUMARCH
77{
78 /** Invalid zero value. */
79 kCpumArch_Invalid = 0,
80 /** x86 based architecture (includes 64-bit). */
81 kCpumArch_X86,
82 /** ARM based architecture (includs both AArch32 and AArch64). */
83 kCpumArch_Arm,
84
85 /** @todo RiscV, Mips, ... ;). */
86
87 /*
88 * Unknown.
89 */
90 kCpumArch_Unknown,
91
92 kCpumArch_32BitHack = 0x7fffffff
93} CPUMARCH;
94
95
96/**
97 * CPU microarchitectures and in processor generations.
98 *
99 * @remarks The separation here is sometimes a little bit too finely grained,
100 * and the differences is more like processor generation than micro
101 * arch. This can be useful, so we'll provide functions for getting at
102 * more coarse grained info.
103 */
104typedef enum CPUMMICROARCH
105{
106 kCpumMicroarch_Invalid = 0,
107
108 /*
109 * x86 and AMD64 CPUs.
110 */
111
112 kCpumMicroarch_Intel_First,
113
114 kCpumMicroarch_Intel_8086 = kCpumMicroarch_Intel_First,
115 kCpumMicroarch_Intel_80186,
116 kCpumMicroarch_Intel_80286,
117 kCpumMicroarch_Intel_80386,
118 kCpumMicroarch_Intel_80486,
119 kCpumMicroarch_Intel_P5,
120
121 kCpumMicroarch_Intel_P6_Core_Atom_First,
122 kCpumMicroarch_Intel_P6 = kCpumMicroarch_Intel_P6_Core_Atom_First,
123 kCpumMicroarch_Intel_P6_II,
124 kCpumMicroarch_Intel_P6_III,
125
126 kCpumMicroarch_Intel_P6_M_Banias,
127 kCpumMicroarch_Intel_P6_M_Dothan,
128 kCpumMicroarch_Intel_Core_Yonah, /**< Core, also known as Enhanced Pentium M. */
129
130 kCpumMicroarch_Intel_Core2_First,
131 kCpumMicroarch_Intel_Core2_Merom = kCpumMicroarch_Intel_Core2_First, /**< 65nm, Merom/Conroe/Kentsfield/Tigerton */
132 kCpumMicroarch_Intel_Core2_Penryn, /**< 45nm, Penryn/Wolfdale/Yorkfield/Harpertown */
133 kCpumMicroarch_Intel_Core2_End,
134
135 kCpumMicroarch_Intel_Core7_First,
136 kCpumMicroarch_Intel_Core7_Nehalem = kCpumMicroarch_Intel_Core7_First,
137 kCpumMicroarch_Intel_Core7_Westmere,
138 kCpumMicroarch_Intel_Core7_SandyBridge,
139 kCpumMicroarch_Intel_Core7_IvyBridge,
140 kCpumMicroarch_Intel_Core7_Haswell,
141 kCpumMicroarch_Intel_Core7_Broadwell,
142 kCpumMicroarch_Intel_Core7_Skylake,
143 kCpumMicroarch_Intel_Core7_KabyLake,
144 kCpumMicroarch_Intel_Core7_CoffeeLake,
145 kCpumMicroarch_Intel_Core7_WhiskeyLake,
146 kCpumMicroarch_Intel_Core7_CascadeLake,
147 kCpumMicroarch_Intel_Core7_CannonLake, /**< Limited 10nm. */
148 kCpumMicroarch_Intel_Core7_CometLake, /**< 10th gen, 14nm desktop + high power mobile. */
149 kCpumMicroarch_Intel_Core7_IceLake, /**< 10th gen, 10nm mobile and some Xeons. Actually 'Sunny Cove' march. */
150 kCpumMicroarch_Intel_Core7_SunnyCove = kCpumMicroarch_Intel_Core7_IceLake,
151 kCpumMicroarch_Intel_Core7_RocketLake, /**< 11th gen, 14nm desktop + high power mobile. Aka 'Cypress Cove', backport of 'Willow Cove' to 14nm. */
152 kCpumMicroarch_Intel_Core7_CypressCove = kCpumMicroarch_Intel_Core7_RocketLake,
153 kCpumMicroarch_Intel_Core7_TigerLake, /**< 11th gen, 10nm mobile. Actually 'Willow Cove' march. */
154 kCpumMicroarch_Intel_Core7_WillowCove = kCpumMicroarch_Intel_Core7_TigerLake,
155 kCpumMicroarch_Intel_Core7_AlderLake, /**< 12th gen, 10nm all platforms(?). */
156 kCpumMicroarch_Intel_Core7_SapphireRapids, /**< 12th? gen, 10nm server? */
157 kCpumMicroarch_Intel_Core7_End,
158
159 kCpumMicroarch_Intel_Atom_First,
160 kCpumMicroarch_Intel_Atom_Bonnell = kCpumMicroarch_Intel_Atom_First,
161 kCpumMicroarch_Intel_Atom_Lincroft, /**< Second generation bonnell (44nm). */
162 kCpumMicroarch_Intel_Atom_Saltwell, /**< 32nm shrink of Bonnell. */
163 kCpumMicroarch_Intel_Atom_Silvermont, /**< 22nm */
164 kCpumMicroarch_Intel_Atom_Airmount, /**< 14nm */
165 kCpumMicroarch_Intel_Atom_Goldmont, /**< 14nm */
166 kCpumMicroarch_Intel_Atom_GoldmontPlus, /**< 14nm */
167 kCpumMicroarch_Intel_Atom_Unknown,
168 kCpumMicroarch_Intel_Atom_End,
169
170
171 kCpumMicroarch_Intel_Phi_First,
172 kCpumMicroarch_Intel_Phi_KnightsFerry = kCpumMicroarch_Intel_Phi_First,
173 kCpumMicroarch_Intel_Phi_KnightsCorner,
174 kCpumMicroarch_Intel_Phi_KnightsLanding,
175 kCpumMicroarch_Intel_Phi_KnightsHill,
176 kCpumMicroarch_Intel_Phi_KnightsMill,
177 kCpumMicroarch_Intel_Phi_End,
178
179 kCpumMicroarch_Intel_P6_Core_Atom_End,
180
181 kCpumMicroarch_Intel_NB_First,
182 kCpumMicroarch_Intel_NB_Willamette = kCpumMicroarch_Intel_NB_First, /**< 180nm */
183 kCpumMicroarch_Intel_NB_Northwood, /**< 130nm */
184 kCpumMicroarch_Intel_NB_Prescott, /**< 90nm */
185 kCpumMicroarch_Intel_NB_Prescott2M, /**< 90nm */
186 kCpumMicroarch_Intel_NB_CedarMill, /**< 65nm */
187 kCpumMicroarch_Intel_NB_Gallatin, /**< 90nm Xeon, Pentium 4 Extreme Edition ("Emergency Edition"). */
188 kCpumMicroarch_Intel_NB_Unknown,
189 kCpumMicroarch_Intel_NB_End,
190
191 kCpumMicroarch_Intel_Unknown,
192 kCpumMicroarch_Intel_End,
193
194 kCpumMicroarch_AMD_First,
195 kCpumMicroarch_AMD_Am286 = kCpumMicroarch_AMD_First,
196 kCpumMicroarch_AMD_Am386,
197 kCpumMicroarch_AMD_Am486,
198 kCpumMicroarch_AMD_Am486Enh, /**< Covers Am5x86 as well. */
199 kCpumMicroarch_AMD_K5,
200 kCpumMicroarch_AMD_K6,
201
202 kCpumMicroarch_AMD_K7_First,
203 kCpumMicroarch_AMD_K7_Palomino = kCpumMicroarch_AMD_K7_First,
204 kCpumMicroarch_AMD_K7_Spitfire,
205 kCpumMicroarch_AMD_K7_Thunderbird,
206 kCpumMicroarch_AMD_K7_Morgan,
207 kCpumMicroarch_AMD_K7_Thoroughbred,
208 kCpumMicroarch_AMD_K7_Barton,
209 kCpumMicroarch_AMD_K7_Unknown,
210 kCpumMicroarch_AMD_K7_End,
211
212 kCpumMicroarch_AMD_K8_First,
213 kCpumMicroarch_AMD_K8_130nm = kCpumMicroarch_AMD_K8_First, /**< 130nm Clawhammer, Sledgehammer, Newcastle, Paris, Odessa, Dublin */
214 kCpumMicroarch_AMD_K8_90nm, /**< 90nm shrink */
215 kCpumMicroarch_AMD_K8_90nm_DualCore, /**< 90nm with two cores. */
216 kCpumMicroarch_AMD_K8_90nm_AMDV, /**< 90nm with AMD-V (usually) and two cores (usually). */
217 kCpumMicroarch_AMD_K8_65nm, /**< 65nm shrink. */
218 kCpumMicroarch_AMD_K8_End,
219
220 kCpumMicroarch_AMD_K10,
221 kCpumMicroarch_AMD_K10_Lion,
222 kCpumMicroarch_AMD_K10_Llano,
223 kCpumMicroarch_AMD_Bobcat,
224 kCpumMicroarch_AMD_Jaguar,
225
226 kCpumMicroarch_AMD_15h_First,
227 kCpumMicroarch_AMD_15h_Bulldozer = kCpumMicroarch_AMD_15h_First,
228 kCpumMicroarch_AMD_15h_Piledriver,
229 kCpumMicroarch_AMD_15h_Steamroller, /**< Yet to be released, might have different family. */
230 kCpumMicroarch_AMD_15h_Excavator, /**< Yet to be released, might have different family. */
231 kCpumMicroarch_AMD_15h_Unknown,
232 kCpumMicroarch_AMD_15h_End,
233
234 kCpumMicroarch_AMD_16h_First,
235 kCpumMicroarch_AMD_16h_End,
236
237 kCpumMicroarch_AMD_Zen_First,
238 kCpumMicroarch_AMD_Zen_Ryzen = kCpumMicroarch_AMD_Zen_First,
239 kCpumMicroarch_AMD_Zen_End,
240
241 kCpumMicroarch_AMD_Unknown,
242 kCpumMicroarch_AMD_End,
243
244 kCpumMicroarch_Hygon_First,
245 kCpumMicroarch_Hygon_Dhyana = kCpumMicroarch_Hygon_First,
246 kCpumMicroarch_Hygon_Unknown,
247 kCpumMicroarch_Hygon_End,
248
249 kCpumMicroarch_VIA_First,
250 kCpumMicroarch_Centaur_C6 = kCpumMicroarch_VIA_First,
251 kCpumMicroarch_Centaur_C2,
252 kCpumMicroarch_Centaur_C3,
253 kCpumMicroarch_VIA_C3_M2,
254 kCpumMicroarch_VIA_C3_C5A, /**< 180nm Samuel - Cyrix III, C3, 1GigaPro. */
255 kCpumMicroarch_VIA_C3_C5B, /**< 150nm Samuel 2 - Cyrix III, C3, 1GigaPro, Eden ESP, XP 2000+. */
256 kCpumMicroarch_VIA_C3_C5C, /**< 130nm Ezra - C3, Eden ESP. */
257 kCpumMicroarch_VIA_C3_C5N, /**< 130nm Ezra-T - C3. */
258 kCpumMicroarch_VIA_C3_C5XL, /**< 130nm Nehemiah - C3, Eden ESP, Eden-N. */
259 kCpumMicroarch_VIA_C3_C5P, /**< 130nm Nehemiah+ - C3. */
260 kCpumMicroarch_VIA_C7_C5J, /**< 90nm Esther - C7, C7-D, C7-M, Eden, Eden ULV. */
261 kCpumMicroarch_VIA_Isaiah,
262 kCpumMicroarch_VIA_Unknown,
263 kCpumMicroarch_VIA_End,
264
265 kCpumMicroarch_Shanghai_First,
266 kCpumMicroarch_Shanghai_Wudaokou = kCpumMicroarch_Shanghai_First,
267 kCpumMicroarch_Shanghai_Unknown,
268 kCpumMicroarch_Shanghai_End,
269
270 kCpumMicroarch_Cyrix_First,
271 kCpumMicroarch_Cyrix_5x86 = kCpumMicroarch_Cyrix_First,
272 kCpumMicroarch_Cyrix_M1,
273 kCpumMicroarch_Cyrix_MediaGX,
274 kCpumMicroarch_Cyrix_MediaGXm,
275 kCpumMicroarch_Cyrix_M2,
276 kCpumMicroarch_Cyrix_Unknown,
277 kCpumMicroarch_Cyrix_End,
278
279 kCpumMicroarch_NEC_First,
280 kCpumMicroarch_NEC_V20 = kCpumMicroarch_NEC_First,
281 kCpumMicroarch_NEC_V30,
282 kCpumMicroarch_NEC_End,
283
284 /*
285 * ARM CPUs.
286 */
287 kCpumMicroarch_Apple_First,
288 kCpumMicroarch_Apple_M1 = kCpumMicroarch_Apple_First,
289 kCpumMicroarch_Apple_M2,
290 kCpumMicroarch_Apple_End,
291
292 /*
293 * Unknown.
294 */
295 kCpumMicroarch_Unknown,
296
297 kCpumMicroarch_32BitHack = 0x7fffffff
298} CPUMMICROARCH;
299
300
301/** Predicate macro for catching netburst CPUs. */
302#define CPUMMICROARCH_IS_INTEL_NETBURST(a_enmMicroarch) \
303 ((a_enmMicroarch) >= kCpumMicroarch_Intel_NB_First && (a_enmMicroarch) <= kCpumMicroarch_Intel_NB_End)
304
305/** Predicate macro for catching Core7 CPUs. */
306#define CPUMMICROARCH_IS_INTEL_CORE7(a_enmMicroarch) \
307 ((a_enmMicroarch) >= kCpumMicroarch_Intel_Core7_First && (a_enmMicroarch) <= kCpumMicroarch_Intel_Core7_End)
308
309/** Predicate macro for catching Core 2 CPUs. */
310#define CPUMMICROARCH_IS_INTEL_CORE2(a_enmMicroarch) \
311 ((a_enmMicroarch) >= kCpumMicroarch_Intel_Core2_First && (a_enmMicroarch) <= kCpumMicroarch_Intel_Core2_End)
312
313/** Predicate macro for catching Atom CPUs, Silvermont and upwards. */
314#define CPUMMICROARCH_IS_INTEL_SILVERMONT_PLUS(a_enmMicroarch) \
315 ((a_enmMicroarch) >= kCpumMicroarch_Intel_Atom_Silvermont && (a_enmMicroarch) <= kCpumMicroarch_Intel_Atom_End)
316
317/** Predicate macro for catching AMD Family OFh CPUs (aka K8). */
318#define CPUMMICROARCH_IS_AMD_FAM_0FH(a_enmMicroarch) \
319 ((a_enmMicroarch) >= kCpumMicroarch_AMD_K8_First && (a_enmMicroarch) <= kCpumMicroarch_AMD_K8_End)
320
321/** Predicate macro for catching AMD Family 10H CPUs (aka K10). */
322#define CPUMMICROARCH_IS_AMD_FAM_10H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_K10)
323
324/** Predicate macro for catching AMD Family 11H CPUs (aka Lion). */
325#define CPUMMICROARCH_IS_AMD_FAM_11H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_K10_Lion)
326
327/** Predicate macro for catching AMD Family 12H CPUs (aka Llano). */
328#define CPUMMICROARCH_IS_AMD_FAM_12H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_K10_Llano)
329
330/** Predicate macro for catching AMD Family 14H CPUs (aka Bobcat). */
331#define CPUMMICROARCH_IS_AMD_FAM_14H(a_enmMicroarch) ((a_enmMicroarch) == kCpumMicroarch_AMD_Bobcat)
332
333/** Predicate macro for catching AMD Family 15H CPUs (bulldozer and it's
334 * decendants). */
335#define CPUMMICROARCH_IS_AMD_FAM_15H(a_enmMicroarch) \
336 ((a_enmMicroarch) >= kCpumMicroarch_AMD_15h_First && (a_enmMicroarch) <= kCpumMicroarch_AMD_15h_End)
337
338/** Predicate macro for catching AMD Family 16H CPUs. */
339#define CPUMMICROARCH_IS_AMD_FAM_16H(a_enmMicroarch) \
340 ((a_enmMicroarch) >= kCpumMicroarch_AMD_16h_First && (a_enmMicroarch) <= kCpumMicroarch_AMD_16h_End)
341
342/** Predicate macro for catching AMD Zen Family CPUs. */
343#define CPUMMICROARCH_IS_AMD_FAM_ZEN(a_enmMicroarch) \
344 ((a_enmMicroarch) >= kCpumMicroarch_AMD_Zen_First && (a_enmMicroarch) <= kCpumMicroarch_AMD_Zen_End)
345
346/** Predicate macro for catching Apple (ARM) CPUs. */
347#define CPUMMICROARCH_IS_APPLE(a_enmMicroarch) \
348 ((a_enmMicroarch) >= kCpumMicroarch_Apple_First && (a_enmMicroarch) <= kCpumMicroarch_Apple_End)
349
350
351/**
352 * Common portion of the CPU feature structures.
353 */
354typedef struct CPUMFEATURESCOMMON
355{
356 /** The microarchitecture. */
357#ifndef VBOX_FOR_DTRACE_LIB
358 CPUMMICROARCH enmMicroarch;
359#else
360 uint32_t enmMicroarch;
361#endif
362 /** The CPU vendor (CPUMCPUVENDOR). */
363 uint8_t enmCpuVendor;
364 /** The maximum physical address width of the CPU. */
365 uint8_t cMaxPhysAddrWidth;
366 /** The maximum linear address width of the CPU. */
367 uint8_t cMaxLinearAddrWidth;
368} CPUMFEATURESCOMMON;
369
370/**
371 * CPU features and quirks for X86.
372 *
373 * This is mostly exploded CPUID info.
374 */
375typedef struct CPUMFEATURESX86
376{
377 /** The microarchitecture. */
378#ifndef VBOX_FOR_DTRACE_LIB
379 CPUMMICROARCH enmMicroarch;
380#else
381 uint32_t enmMicroarch;
382#endif
383 /** The CPU vendor (CPUMCPUVENDOR). */
384 uint8_t enmCpuVendor;
385 /** The maximum physical address width of the CPU. */
386 uint8_t cMaxPhysAddrWidth;
387 /** The maximum linear address width of the CPU. */
388 uint8_t cMaxLinearAddrWidth;
389
390 /** The CPU family. */
391 uint8_t uFamily;
392 /** The CPU model. */
393 uint8_t uModel;
394 /** The CPU stepping. */
395 uint8_t uStepping;
396 /** Max size of the extended state (or FPU state if no XSAVE). */
397 uint16_t cbMaxExtendedState;
398
399 /** Supports MSRs. */
400 uint32_t fMsr : 1;
401 /** Supports the page size extension (4/2 MB pages). */
402 uint32_t fPse : 1;
403 /** Supports 36-bit page size extension (4 MB pages can map memory above
404 * 4GB). */
405 uint32_t fPse36 : 1;
406 /** Supports physical address extension (PAE). */
407 uint32_t fPae : 1;
408 /** Supports page-global extension (PGE). */
409 uint32_t fPge : 1;
410 /** Page attribute table (PAT) support (page level cache control). */
411 uint32_t fPat : 1;
412 /** Supports the FXSAVE and FXRSTOR instructions. */
413 uint32_t fFxSaveRstor : 1;
414 /** Supports the XSAVE and XRSTOR instructions. */
415 uint32_t fXSaveRstor : 1;
416 /** Supports the XSAVEOPT instruction. */
417 uint32_t fXSaveOpt : 1;
418 /** The XSAVE/XRSTOR bit in CR4 has been set (only applicable for host!). */
419 uint32_t fOpSysXSaveRstor : 1;
420 /** Supports MMX. */
421 uint32_t fMmx : 1;
422 /** Supports AMD extensions to MMX instructions. */
423 uint32_t fAmdMmxExts : 1;
424 /** Supports SSE. */
425 uint32_t fSse : 1;
426 /** Supports SSE2. */
427 uint32_t fSse2 : 1;
428 /** Supports SSE3. */
429 uint32_t fSse3 : 1;
430 /** Supports SSSE3. */
431 uint32_t fSsse3 : 1;
432 /** Supports SSE4.1. */
433 uint32_t fSse41 : 1;
434 /** Supports SSE4.2. */
435 uint32_t fSse42 : 1;
436 /** Supports AVX. */
437 uint32_t fAvx : 1;
438 /** Supports AVX2. */
439 uint32_t fAvx2 : 1;
440 /** Supports AVX512 foundation. */
441 uint32_t fAvx512Foundation : 1;
442 /** Supports RDTSC. */
443 uint32_t fTsc : 1;
444 /** Intel SYSENTER/SYSEXIT support */
445 uint32_t fSysEnter : 1;
446 /** Supports MTRR. */
447 uint32_t fMtrr : 1;
448 /** First generation APIC. */
449 uint32_t fApic : 1;
450 /** Second generation APIC. */
451 uint32_t fX2Apic : 1;
452 /** Hypervisor present. */
453 uint32_t fHypervisorPresent : 1;
454 /** MWAIT & MONITOR instructions supported. */
455 uint32_t fMonitorMWait : 1;
456 /** MWAIT Extensions present. */
457 uint32_t fMWaitExtensions : 1;
458 /** Supports CMPXCHG8B. */
459 uint32_t fCmpXchg8b : 1;
460 /** Supports CMPXCHG16B in 64-bit mode. */
461 uint32_t fCmpXchg16b : 1;
462 /** Supports CLFLUSH. */
463 uint32_t fClFlush : 1;
464 /** Supports CLFLUSHOPT. */
465 uint32_t fClFlushOpt : 1;
466 /** Supports IA32_PRED_CMD.IBPB. */
467 uint32_t fIbpb : 1;
468 /** Supports IA32_SPEC_CTRL.IBRS. */
469 uint32_t fIbrs : 1;
470 /** Supports IA32_SPEC_CTRL.STIBP. */
471 uint32_t fStibp : 1;
472 /** Supports IA32_SPEC_CTRL.SSBD. */
473 uint32_t fSsbd : 1;
474 /** Supports IA32_SPEC_CTRL.PSFD. */
475 uint32_t fPsfd : 1;
476 /** Supports IA32_SPEC_CTRL.IPRED_DIS_U/S. */
477 uint32_t fIpredCtrl : 1;
478 /** Supports IA32_SPEC_CTRL.RRSBA_DIS_U/S. */
479 uint32_t fRrsbaCtrl : 1;
480 /** Supports IA32_SPEC_CTRL.DDPD_DIS_U. */
481 uint32_t fDdpdU : 1;
482 /** Supports IA32_SPEC_CTRL.BHI_S. */
483 uint32_t fBhiCtrl : 1;
484 /** Supports IA32_FLUSH_CMD. */
485 uint32_t fFlushCmd : 1;
486 /** Supports IA32_ARCH_CAP. */
487 uint32_t fArchCap : 1;
488 /** Supports IA32_CORE_CAP. */
489 uint32_t fCoreCap : 1;
490 /** Supports MD_CLEAR functionality (VERW, IA32_FLUSH_CMD). */
491 uint32_t fMdsClear : 1;
492 /** Whether susceptible to MXCSR configuration dependent timing (MCDT) behaviour. */
493 uint32_t fMcdtNo : 1;
494 /** Whether susceptible MONITOR/UMONITOR internal table capacity issues. */
495 uint32_t fMonitorMitgNo : 1;
496 /** Supports the UC-lock disable feature. */
497 uint32_t fUcLockDis : 1;
498 /** Supports PCID. */
499 uint32_t fPcid : 1;
500 /** Supports INVPCID. */
501 uint32_t fInvpcid : 1;
502 /** Supports read/write FSGSBASE instructions. */
503 uint32_t fFsGsBase : 1;
504 /** Supports BMI1 instructions (ANDN, BEXTR, BLSI, BLSMSK, BLSR, and TZCNT). */
505 uint32_t fBmi1 : 1;
506 /** Supports BMI2 instructions (BZHI, MULX, PDEP, PEXT, RORX, SARX, SHRX,
507 * and SHLX). */
508 uint32_t fBmi2 : 1;
509 /** Supports POPCNT instruction. */
510 uint32_t fPopCnt : 1;
511 /** Supports RDRAND instruction. */
512 uint32_t fRdRand : 1;
513 /** Supports RDSEED instruction. */
514 uint32_t fRdSeed : 1;
515 /** Supports Hardware Lock Elision (HLE). */
516 uint32_t fHle : 1;
517 /** Supports Restricted Transactional Memory (RTM - XBEGIN, XEND, XABORT). */
518 uint32_t fRtm : 1;
519 /** Supports PCLMULQDQ instruction. */
520 uint32_t fPclMul : 1;
521 /** Supports AES-NI (six AESxxx instructions). */
522 uint32_t fAesNi : 1;
523 /** Support MOVBE instruction. */
524 uint32_t fMovBe : 1;
525 /** Support SHA instructions. */
526 uint32_t fSha : 1;
527 /** Support ADX instructions. */
528 uint32_t fAdx : 1;
529 /** Supports FMA. */
530 uint32_t fFma : 1;
531 /** Supports F16C. */
532 uint32_t fF16c : 1;
533
534 /** Supports AMD 3DNow instructions. */
535 uint32_t f3DNow : 1;
536 /** Supports the 3DNow/AMD64 prefetch instructions (could be nops). */
537 uint32_t f3DNowPrefetch : 1;
538
539 /** AMD64: Supports long mode. */
540 uint32_t fLongMode : 1;
541 /** AMD64: SYSCALL/SYSRET support. */
542 uint32_t fSysCall : 1;
543 /** AMD64: No-execute page table bit. */
544 uint32_t fNoExecute : 1;
545 /** AMD64: Supports LAHF & SAHF instructions in 64-bit mode. */
546 uint32_t fLahfSahf : 1;
547 /** AMD64: Supports RDTSCP. */
548 uint32_t fRdTscP : 1;
549 /** AMD64: Supports MOV CR8 in 32-bit code (lock prefix hack). */
550 uint32_t fMovCr8In32Bit : 1;
551 /** AMD64: Supports XOP (similar to VEX3/AVX). */
552 uint32_t fXop : 1;
553 /** AMD64: Supports ABM, i.e. the LZCNT instruction. */
554 uint32_t fAbm : 1;
555 /** AMD64: Supports TBM (BEXTR, BLCFILL, BLCI, BLCIC, BLCMSK, BLCS,
556 * BLSFILL, BLSIC, T1MSKC, and TZMSK). */
557 uint32_t fTbm : 1;
558
559 /** Indicates that FPU instruction and data pointers may leak.
560 * This generally applies to recent AMD CPUs, where the FPU IP and DP pointer
561 * is only saved and restored if an exception is pending. */
562 uint32_t fLeakyFxSR : 1;
563
564 /** Supports VEX instruction encoding (AVX, BMI, etc.). */
565 uint32_t fVex : 1;
566
567 /** AMD64: Supports AMD SVM. */
568 uint32_t fSvm : 1;
569
570 /** Support for Intel VMX. */
571 uint32_t fVmx : 1;
572
573 /** Indicates that speculative execution control CPUID bits and MSRs are exposed.
574 * The details are different for Intel and AMD but both have similar
575 * functionality. */
576 uint32_t fSpeculationControl : 1;
577
578 /** @name MSR_IA32_ARCH_CAPABILITIES
579 * @remarks Only safe use after CPUM ring-0 init!
580 * @{ */
581 /** MSR_IA32_ARCH_CAPABILITIES[0]: RDCL_NO */
582 uint32_t fArchRdclNo : 1;
583 /** MSR_IA32_ARCH_CAPABILITIES[1]: IBRS_ALL */
584 uint32_t fArchIbrsAll : 1;
585 /** MSR_IA32_ARCH_CAPABILITIES[2]: RSB Alternate */
586 uint32_t fArchRsbOverride : 1;
587 /** MSR_IA32_ARCH_CAPABILITIES[3]: SKIP_L1DFL_VMENTRY */
588 uint32_t fArchVmmNeedNotFlushL1d : 1;
589 /** MSR_IA32_ARCH_CAPABILITIES[4]: SSB_NO - No Speculative Store Bypass */
590 uint32_t fArchSsbNo : 1;
591 /** MSR_IA32_ARCH_CAPABILITIES[5]: MDS_NO - No Microarchitecural Data Sampling */
592 uint32_t fArchMdsNo : 1;
593 /** MSR_IA32_ARCH_CAPABILITIES[6]: IF_PSCHANGE_MC_NO */
594 uint32_t fArchIfPschangeMscNo : 1;
595 /** MSR_IA32_ARCH_CAPABILITIES[7]: TSX_CTRL (MSR: IA32_TSX_CTRL_MSR[1:0]) */
596 uint32_t fArchTsxCtrl : 1;
597 /** MSR_IA32_ARCH_CAPABILITIES[8]: TAA_NO - No Transactional Synchronization
598 * Extensions Asynchronous Abort. */
599 uint32_t fArchTaaNo : 1;
600 /** MSR_IA32_ARCH_CAPABILITIES[10]: MISC_PACKAGE_CTRLS (MSR: IA32_UARCH_MISC_CTL) */
601 uint32_t fArchMiscPackageCtrls : 1;
602 /** MSR_IA32_ARCH_CAPABILITIES[11]: ENERGY_FILTERING_CTL (MSR: IA32_MISC_PACKAGE_CTLS[0]) */
603 uint32_t fArchEnergyFilteringCtl : 1;
604 /** MSR_IA32_ARCH_CAPABILITIES[12]: DOITM (MSR: IA32_UARCH_MISC_CTL[0]) */
605 uint32_t fArchDoitm : 1;
606 /** MSR_IA32_ARCH_CAPABILITIES[13]: SBDR_SSDP_NO - No Shared Buffers Data Read
607 * nor Sideband Stale Data Propagator issues. */
608 uint32_t fArchSbdrSsdpNo : 1;
609 /** MSR_IA32_ARCH_CAPABILITIES[14]: FBSDP_NO - Fill Buffer Stale Data Propagator */
610 uint32_t fArchFbsdpNo : 1;
611 /** MSR_IA32_ARCH_CAPABILITIES[15]: PSDP_NO - Primary Stale Data Propagator */
612 uint32_t fArchPsdpNo : 1;
613 /** MSR_IA32_ARCH_CAPABILITIES[17]: FB_CLEAR (VERW) */
614 uint32_t fArchFbClear : 1;
615 /** MSR_IA32_ARCH_CAPABILITIES[18]: FB_CLEAR_CTRL (MSR: IA32_MCU_OPT_CTRL[3]) */
616 uint32_t fArchFbClearCtrl : 1;
617 /** MSR_IA32_ARCH_CAPABILITIES[19]: RRSBA */
618 uint32_t fArchRrsba : 1;
619 /** MSR_IA32_ARCH_CAPABILITIES[20]: BHI_NO */
620 uint32_t fArchBhiNo : 1;
621 /** MSR_IA32_ARCH_CAPABILITIES[21]: XAPIC_DISABLE_STATUS (MSR: IA32_XAPIC_DISABLE_STATUS ) */
622 uint32_t fArchXapicDisableStatus : 1;
623 /** MSR_IA32_ARCH_CAPABILITIES[23]: OVERCLOCKING_STATUS (MSR: IA32_OVERCLOCKING STATUS) */
624 uint32_t fArchOverclockingStatus : 1;
625 /** MSR_IA32_ARCH_CAPABILITIES[24]: PBRSB_NO - No post-barrier Return Stack Buffer predictions */
626 uint32_t fArchPbrsbNo : 1;
627 /** MSR_IA32_ARCH_CAPABILITIES[25]: GDS_CTRL (MSR: IA32_MCU_OPT_CTRL[5:4]) */
628 uint32_t fArchGdsCtrl : 1;
629 /** MSR_IA32_ARCH_CAPABILITIES[26]: GDS_NO - No Gather Data Sampling */
630 uint32_t fArchGdsNo : 1;
631 /** MSR_IA32_ARCH_CAPABILITIES[27]: RFDS_NO - No Register File Data Sampling */
632 uint32_t fArchRfdsNo : 1;
633 /** MSR_IA32_ARCH_CAPABILITIES[28]: RFDS_CLEAR (VERW++) */
634 uint32_t fArchRfdsClear : 1;
635 /** MSR_IA32_ARCH_CAPABILITIES[29]: IGN_UMONITOR_SUPPORT (MSR: IA32_MCU_OPT_CTRL[6]) */
636 uint32_t fArchIgnUmonitorSupport : 1;
637 /** MSR_IA32_ARCH_CAPABILITIES[30]: MON_UMON_MITG_SUPPORT (MSR: IA32_MCU_OPT_CTRL[7]) */
638 uint32_t fArchMonUmonMitigSupport : 1;
639 /** @} */
640
641 /** Alignment padding / reserved for future use. */
642 uint32_t fPadding0 : 18;
643 uint32_t auPadding[3];
644
645 /** @name SVM
646 * @{ */
647 /** SVM: Supports Nested-paging. */
648 uint32_t fSvmNestedPaging : 1;
649 /** SVM: Support LBR (Last Branch Record) virtualization. */
650 uint32_t fSvmLbrVirt : 1;
651 /** SVM: Supports SVM lock. */
652 uint32_t fSvmSvmLock : 1;
653 /** SVM: Supports Next RIP save. */
654 uint32_t fSvmNextRipSave : 1;
655 /** SVM: Supports TSC rate MSR. */
656 uint32_t fSvmTscRateMsr : 1;
657 /** SVM: Supports VMCB clean bits. */
658 uint32_t fSvmVmcbClean : 1;
659 /** SVM: Supports Flush-by-ASID. */
660 uint32_t fSvmFlusbByAsid : 1;
661 /** SVM: Supports decode assist. */
662 uint32_t fSvmDecodeAssists : 1;
663 /** SVM: Supports Pause filter. */
664 uint32_t fSvmPauseFilter : 1;
665 /** SVM: Supports Pause filter threshold. */
666 uint32_t fSvmPauseFilterThreshold : 1;
667 /** SVM: Supports AVIC (Advanced Virtual Interrupt Controller). */
668 uint32_t fSvmAvic : 1;
669 /** SVM: Supports Virtualized VMSAVE/VMLOAD. */
670 uint32_t fSvmVirtVmsaveVmload : 1;
671 /** SVM: Supports VGIF (Virtual Global Interrupt Flag). */
672 uint32_t fSvmVGif : 1;
673 /** SVM: Supports GMET (Guest Mode Execute Trap Extension). */
674 uint32_t fSvmGmet : 1;
675 /** SVM: Supports AVIC in x2APIC mode. */
676 uint32_t fSvmX2Avic : 1;
677 /** SVM: Supports SSSCheck (SVM Supervisor Shadow Stack). */
678 uint32_t fSvmSSSCheck : 1;
679 /** SVM: Supports SPEC_CTRL virtualization. */
680 uint32_t fSvmSpecCtrl : 1;
681 /** SVM: Supports Read-Only Guest Page Table feature. */
682 uint32_t fSvmRoGpt : 1;
683 /** SVM: Supports HOST_MCE_OVERRIDE. */
684 uint32_t fSvmHostMceOverride : 1;
685 /** SVM: Supports TlbiCtl (INVLPGB/TLBSYNC in VMCB and TLBSYNC intercept). */
686 uint32_t fSvmTlbiCtl : 1;
687 /** SVM: Supports NMI virtualization. */
688 uint32_t fSvmVNmi : 1;
689 /** SVM: Supports IBS virtualizaiton. */
690 uint32_t fSvmIbsVirt : 1;
691 /** SVM: Supports Extended LVT AVIC access changes. */
692 uint32_t fSvmExtLvtAvicAccessChg : 1;
693 /** SVM: Supports Guest VMCB address check. */
694 uint32_t fSvmNstVirtVmcbAddrChk : 1;
695 /** SVM: Supports Bus Lock Threshold. */
696 uint32_t fSvmBusLockThreshold : 1;
697 /** SVM: Padding / reserved for future features (64 bits total w/ max ASID). */
698 uint32_t fSvmPadding0 : 7;
699 /** SVM: Maximum supported ASID. */
700 uint32_t uSvmMaxAsid;
701 /** @} */
702
703
704 /** VMX: Maximum physical address width. */
705 uint32_t cVmxMaxPhysAddrWidth : 8;
706
707 /** @name VMX basic controls.
708 * @{ */
709 /** VMX: Supports INS/OUTS VM-exit instruction info. */
710 uint32_t fVmxInsOutInfo : 1;
711 /** @} */
712
713 /** @name VMX Pin-based controls.
714 * @{ */
715 /** VMX: Supports external interrupt VM-exit. */
716 uint32_t fVmxExtIntExit : 1;
717 /** VMX: Supports NMI VM-exit. */
718 uint32_t fVmxNmiExit : 1;
719 /** VMX: Supports Virtual NMIs. */
720 uint32_t fVmxVirtNmi : 1;
721 /** VMX: Supports preemption timer. */
722 uint32_t fVmxPreemptTimer : 1;
723 /** VMX: Supports posted interrupts. */
724 uint32_t fVmxPostedInt : 1;
725 /** @} */
726
727 /** @name VMX Processor-based controls.
728 * @{ */
729 /** VMX: Supports Interrupt-window exiting. */
730 uint32_t fVmxIntWindowExit : 1;
731 /** VMX: Supports TSC offsetting. */
732 uint32_t fVmxTscOffsetting : 1;
733 /** VMX: Supports HLT exiting. */
734 uint32_t fVmxHltExit : 1;
735 /** VMX: Supports INVLPG exiting. */
736 uint32_t fVmxInvlpgExit : 1;
737 /** VMX: Supports MWAIT exiting. */
738 uint32_t fVmxMwaitExit : 1;
739 /** VMX: Supports RDPMC exiting. */
740 uint32_t fVmxRdpmcExit : 1;
741 /** VMX: Supports RDTSC exiting. */
742 uint32_t fVmxRdtscExit : 1;
743 /** VMX: Supports CR3-load exiting. */
744 uint32_t fVmxCr3LoadExit : 1;
745 /** VMX: Supports CR3-store exiting. */
746 uint32_t fVmxCr3StoreExit : 1;
747 /** VMX: Supports tertiary processor-based VM-execution controls. */
748 uint32_t fVmxTertiaryExecCtls : 1;
749 /** VMX: Supports CR8-load exiting. */
750 uint32_t fVmxCr8LoadExit : 1;
751 /** VMX: Supports CR8-store exiting. */
752 uint32_t fVmxCr8StoreExit : 1;
753 /** VMX: Supports TPR shadow. */
754 uint32_t fVmxUseTprShadow : 1;
755 /** VMX: Supports NMI-window exiting. */
756 uint32_t fVmxNmiWindowExit : 1;
757 /** VMX: Supports Mov-DRx exiting. */
758 uint32_t fVmxMovDRxExit : 1;
759 /** VMX: Supports Unconditional I/O exiting. */
760 uint32_t fVmxUncondIoExit : 1;
761 /** VMX: Supportgs I/O bitmaps. */
762 uint32_t fVmxUseIoBitmaps : 1;
763 /** VMX: Supports Monitor Trap Flag. */
764 uint32_t fVmxMonitorTrapFlag : 1;
765 /** VMX: Supports MSR bitmap. */
766 uint32_t fVmxUseMsrBitmaps : 1;
767 /** VMX: Supports MONITOR exiting. */
768 uint32_t fVmxMonitorExit : 1;
769 /** VMX: Supports PAUSE exiting. */
770 uint32_t fVmxPauseExit : 1;
771 /** VMX: Supports secondary processor-based VM-execution controls. */
772 uint32_t fVmxSecondaryExecCtls : 1;
773 /** @} */
774
775 /** @name VMX Secondary processor-based controls.
776 * @{ */
777 /** VMX: Supports virtualize-APIC access. */
778 uint32_t fVmxVirtApicAccess : 1;
779 /** VMX: Supports EPT (Extended Page Tables). */
780 uint32_t fVmxEpt : 1;
781 /** VMX: Supports descriptor-table exiting. */
782 uint32_t fVmxDescTableExit : 1;
783 /** VMX: Supports RDTSCP. */
784 uint32_t fVmxRdtscp : 1;
785 /** VMX: Supports virtualize-x2APIC mode. */
786 uint32_t fVmxVirtX2ApicMode : 1;
787 /** VMX: Supports VPID. */
788 uint32_t fVmxVpid : 1;
789 /** VMX: Supports WBIND exiting. */
790 uint32_t fVmxWbinvdExit : 1;
791 /** VMX: Supports Unrestricted guest. */
792 uint32_t fVmxUnrestrictedGuest : 1;
793 /** VMX: Supports APIC-register virtualization. */
794 uint32_t fVmxApicRegVirt : 1;
795 /** VMX: Supports virtual-interrupt delivery. */
796 uint32_t fVmxVirtIntDelivery : 1;
797 /** VMX: Supports Pause-loop exiting. */
798 uint32_t fVmxPauseLoopExit : 1;
799 /** VMX: Supports RDRAND exiting. */
800 uint32_t fVmxRdrandExit : 1;
801 /** VMX: Supports INVPCID. */
802 uint32_t fVmxInvpcid : 1;
803 /** VMX: Supports VM functions. */
804 uint32_t fVmxVmFunc : 1;
805 /** VMX: Supports VMCS shadowing. */
806 uint32_t fVmxVmcsShadowing : 1;
807 /** VMX: Supports RDSEED exiting. */
808 uint32_t fVmxRdseedExit : 1;
809 /** VMX: Supports PML. */
810 uint32_t fVmxPml : 1;
811 /** VMX: Supports EPT-violations \#VE. */
812 uint32_t fVmxEptXcptVe : 1;
813 /** VMX: Supports conceal VMX from PT. */
814 uint32_t fVmxConcealVmxFromPt : 1;
815 /** VMX: Supports XSAVES/XRSTORS. */
816 uint32_t fVmxXsavesXrstors : 1;
817 /** VMX: Supports PASID translation. */
818 uint32_t fVmxPasidTranslate : 1;
819 /** VMX: Supports mode-based execute control for EPT. */
820 uint32_t fVmxModeBasedExecuteEpt : 1;
821 /** VMX: Supports sub-page write permissions for EPT. */
822 uint32_t fVmxSppEpt : 1;
823 /** VMX: Supports Intel PT to output guest-physical addresses for EPT. */
824 uint32_t fVmxPtEpt : 1;
825 /** VMX: Supports TSC scaling. */
826 uint32_t fVmxUseTscScaling : 1;
827 /** VMX: Supports TPAUSE, UMONITOR, or UMWAIT. */
828 uint32_t fVmxUserWaitPause : 1;
829 /** VMX: Supports PCONFIG. */
830 uint32_t fVmxPconfig : 1;
831 /** VMX: Supports enclave (ENCLV) exiting. */
832 uint32_t fVmxEnclvExit : 1;
833 /** VMX: Supports VMM bus-lock detection. */
834 uint32_t fVmxBusLockDetect : 1;
835 /** VMX: Supports instruction timeout. */
836 uint32_t fVmxInstrTimeout : 1;
837 /** @} */
838
839 /** @name VMX Tertiary processor-based controls.
840 * @{ */
841 /** VMX: Supports LOADIWKEY exiting. */
842 uint32_t fVmxLoadIwKeyExit : 1;
843 /** VMX: Supports hypervisor-managed linear address translation (HLAT). */
844 uint32_t fVmxHlat : 1;
845 /** VMX: Supports EPT paging-write control. */
846 uint32_t fVmxEptPagingWrite : 1;
847 /** VMX: Supports Guest-paging verification. */
848 uint32_t fVmxGstPagingVerify : 1;
849 /** VMX: Supports IPI virtualization. */
850 uint32_t fVmxIpiVirt : 1;
851 /** VMX: Supports virtualize IA32_SPEC_CTRL. */
852 uint32_t fVmxVirtSpecCtrl : 1;
853 /** @} */
854
855 /** @name VMX VM-entry controls.
856 * @{ */
857 /** VMX: Supports load-debug controls on VM-entry. */
858 uint32_t fVmxEntryLoadDebugCtls : 1;
859 /** VMX: Supports IA32e mode guest. */
860 uint32_t fVmxIa32eModeGuest : 1;
861 /** VMX: Supports load guest EFER MSR on VM-entry. */
862 uint32_t fVmxEntryLoadEferMsr : 1;
863 /** VMX: Supports load guest PAT MSR on VM-entry. */
864 uint32_t fVmxEntryLoadPatMsr : 1;
865 /** @} */
866
867 /** @name VMX VM-exit controls.
868 * @{ */
869 /** VMX: Supports save debug controls on VM-exit. */
870 uint32_t fVmxExitSaveDebugCtls : 1;
871 /** VMX: Supports host-address space size. */
872 uint32_t fVmxHostAddrSpaceSize : 1;
873 /** VMX: Supports acknowledge external interrupt on VM-exit. */
874 uint32_t fVmxExitAckExtInt : 1;
875 /** VMX: Supports save guest PAT MSR on VM-exit. */
876 uint32_t fVmxExitSavePatMsr : 1;
877 /** VMX: Supports load hsot PAT MSR on VM-exit. */
878 uint32_t fVmxExitLoadPatMsr : 1;
879 /** VMX: Supports save guest EFER MSR on VM-exit. */
880 uint32_t fVmxExitSaveEferMsr : 1;
881 /** VMX: Supports load host EFER MSR on VM-exit. */
882 uint32_t fVmxExitLoadEferMsr : 1;
883 /** VMX: Supports save VMX preemption timer on VM-exit. */
884 uint32_t fVmxSavePreemptTimer : 1;
885 /** VMX: Supports secondary VM-exit controls. */
886 uint32_t fVmxSecondaryExitCtls : 1;
887 /** @} */
888
889 /** @name VMX Miscellaneous data.
890 * @{ */
891 /** VMX: Supports storing EFER.LMA into IA32e-mode guest field on VM-exit. */
892 uint32_t fVmxExitSaveEferLma : 1;
893 /** VMX: Whether Intel PT (Processor Trace) is supported in VMX mode or not. */
894 uint32_t fVmxPt : 1;
895 /** VMX: Supports VMWRITE to any valid VMCS field incl. read-only fields, otherwise
896 * VMWRITE cannot modify read-only VM-exit information fields. */
897 uint32_t fVmxVmwriteAll : 1;
898 /** VMX: Supports injection of software interrupts, ICEBP on VM-entry for zero
899 * length instructions. */
900 uint32_t fVmxEntryInjectSoftInt : 1;
901 /** @} */
902
903 /** VMX: Padding / reserved for future features. */
904 uint32_t fVmxPadding0 : 7;
905 /** VMX: Padding / reserved for future, making it a total of 128 bits. */
906 uint32_t fVmxPadding1;
907} CPUMFEATURESX86;
908#ifndef VBOX_FOR_DTRACE_LIB
909AssertCompileSize(CPUMFEATURESX86, 64);
910AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, enmCpuVendor, CPUMFEATURESX86, enmCpuVendor);
911AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, enmMicroarch, CPUMFEATURESX86, enmMicroarch);
912AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, cMaxPhysAddrWidth, CPUMFEATURESX86, cMaxPhysAddrWidth);
913AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, cMaxLinearAddrWidth, CPUMFEATURESX86, cMaxLinearAddrWidth);
914#endif
915
916/**
917 * CPU features and quirks for ARMv8.
918 *
919 * This is mostly exploded CPU feature register info.
920 */
921typedef struct CPUMFEATURESARMV8
922{
923 /** The microarchitecture. */
924#ifndef VBOX_FOR_DTRACE_LIB
925 CPUMMICROARCH enmMicroarch;
926#else
927 uint32_t enmMicroarch;
928#endif
929 /** The CPU vendor (CPUMCPUVENDOR). */
930 uint8_t enmCpuVendor;
931 /** The maximum physical address width of the CPU. */
932 uint8_t cMaxPhysAddrWidth;
933 /** The maximum linear address width of the CPU. */
934 uint8_t cMaxLinearAddrWidth;
935
936 /** The CPU implementer value (from MIDR_EL1). */
937 uint8_t uImplementeter;
938 /** The CPU part number (from MIDR_EL1). */
939 uint16_t uPartNum;
940 /** The CPU variant (from MIDR_EL1). */
941 uint8_t uVariant;
942 /** The CPU revision (from MIDR_EL1). */
943 uint8_t uRevision;
944
945 /** @name Granule sizes supported.
946 * @{ */
947 /** 4KiB translation granule size supported. */
948 uint32_t fTGran4K : 1;
949 /** 16KiB translation granule size supported. */
950 uint32_t fTGran16K : 1;
951 /** 64KiB translation granule size supported. */
952 uint32_t fTGran64K : 1;
953 /** @} */
954
955 /** @name pre-2020 Architecture Extensions.
956 * @{ */
957 /** Supports Advanced SIMD Extension (FEAT_AdvSIMD). */
958 uint32_t fAdvSimd : 1;
959 /** Supports Advanced SIMD AES instructions (FEAT_AES). */
960 uint32_t fAes : 1;
961 /** Supports Advanced SIMD PMULL instructions (FEAT_PMULL). */
962 uint32_t fPmull : 1;
963 /** Supports CP15Disable2 (FEAT_CP15DISABLE2). */
964 uint32_t fCp15Disable2 : 1;
965 /** Supports Cache Speculation Variant 2 (FEAT_CSV2). */
966 uint32_t fCsv2 : 1;
967 /** Supports Cache Speculation Variant 2, version 1.1 (FEAT_CSV2_1p1). */
968 uint32_t fCsv21p1 : 1;
969 /** Supports Cache Speculation Variant 2, version 1.2 (FEAT_CSV2_1p2). */
970 uint32_t fCsv21p2 : 1;
971 /** Supports Cache Speculation Variant 3 (FEAT_CSV3). */
972 uint32_t fCsv3 : 1;
973 /** Supports Data Gahtering Hint (FEAT_DGH). */
974 uint32_t fDgh : 1;
975 /** Supports Double Lock (FEAT_DoubleLock). */
976 uint32_t fDoubleLock : 1;
977 /** Supports Enhanced Translation Synchronization (FEAT_ETS2). */
978 uint32_t fEts2 : 1;
979 /** Supports Floating Point Extensions (FEAT_FP). */
980 uint32_t fFp : 1;
981 /** Supports IVIPT Extensions (FEAT_IVIPT). */
982 uint32_t fIvipt : 1;
983 /** Supports PC Sample-based Profiling Extension (FEAT_PCSRv8). */
984 uint32_t fPcsrV8 : 1;
985 /** Supports Speculation Restrictions instructions (FEAT_SPECRES). */
986 uint32_t fSpecres : 1;
987 /** Supports Reliability, Availability, and Serviceability (RAS) Extension (FEAT_RAS). */
988 uint32_t fRas : 1;
989 /** Supports Speculation Barrier (FEAT_SB). */
990 uint32_t fSb : 1;
991 /** Supports Advanced SIMD SHA1 instructions (FEAT_SHA1). */
992 uint32_t fSha1 : 1;
993 /** Supports Advanced SIMD SHA256 instructions (FEAT_SHA256). */
994 uint32_t fSha256 : 1;
995 /** Supports Speculation Store Bypass Safe (FEAT_SSBS). */
996 uint32_t fSsbs : 1;
997 /** Supports MRS and MSR instructions for Speculation Store Bypass Safe version 2 (FEAT_SSBS2). */
998 uint32_t fSsbs2 : 1;
999 /** Supports CRC32 instructions (FEAT_CRC32). */
1000 uint32_t fCrc32 : 1;
1001 /** Supports Intermediate chacing of trnslation table walks (FEAT_nTLBPA). */
1002 uint32_t fNTlbpa : 1;
1003 /** Supports debug with VHE (FEAT_Debugv8p1). */
1004 uint32_t fDebugV8p1 : 1;
1005 /** Supports Hierarchical permission disables in translation tables (FEAT_HPDS). */
1006 uint32_t fHpds : 1;
1007 /** Supports Limited ordering regions (FEAT_LOR). */
1008 uint32_t fLor : 1;
1009 /** Supports Lare Systems Extensons (FEAT_LSE). */
1010 uint32_t fLse : 1;
1011 /** Supports Privileged access never (FEAT_PAN). */
1012 uint32_t fPan : 1;
1013 /** Supports Armv8.1 PMU extensions (FEAT_PMUv3p1). */
1014 uint32_t fPmuV3p1 : 1;
1015 /** Supports Advanced SIMD rouding double multiply accumulate instructions (FEAT_RDM). */
1016 uint32_t fRdm : 1;
1017 /** Supports hardware management of the Access flag and dirty state (FEAT_HAFDBS). */
1018 uint32_t fHafdbs : 1;
1019 /** Supports Virtualization Host Extensions (FEAT_VHE). */
1020 uint32_t fVhe : 1;
1021 /** Supports 16-bit VMID (FEAT_VMID16). */
1022 uint32_t fVmid16 : 1;
1023 /** Supports AArch32 BFloat16 instructions (FEAT_AA32BF16). */
1024 uint32_t fAa32Bf16 : 1;
1025 /** Supports AArch32 Hierarchical permission disables (FEAT_AA32HPD). */
1026 uint32_t fAa32Hpd : 1;
1027 /** Supports AArch32 Int8 matrix multiplication instructions (FEAT_AA32I8MM). */
1028 uint32_t fAa32I8mm : 1;
1029 /** Supports AT S1E1R and AT S1E1W instruction variants affected by PSTATE.PAN (FEAT_PAN2). */
1030 uint32_t fPan2 : 1;
1031 /** Supports AArch64 BFloat16 instructions (FEAT_BF16). */
1032 uint32_t fBf16 : 1;
1033 /** Supports DC CVADP instruction (FEAT_DPB2). */
1034 uint32_t fDpb2 : 1;
1035 /** Supports DC VAP instruction (FEAT_DPB). */
1036 uint32_t fDpb : 1;
1037 /** Supports Debug v8.2 (FEAT_Debugv8p2). */
1038 uint32_t fDebugV8p2 : 1;
1039 /** Supports Advanced SIMD dot product instructions (FEAT_DotProd). */
1040 uint32_t fDotProd : 1;
1041 /** Supports Enhanced Virtualization Traps (FEAT_EVT). */
1042 uint32_t fEvt : 1;
1043 /** Supports Single precision Matrix Multiplication (FEAT_F32MM). */
1044 uint32_t fF32mm : 1;
1045 /** Supports Double precision Matrix Multiplication (FEAT_F64MM). */
1046 uint32_t fF64mm : 1;
1047 /** Supports Floating-point half precision multiplication instructions (FEAT_FHM). */
1048 uint32_t fFhm : 1;
1049 /** Supports Half-precision floating point data processing (FEAT_FP16). */
1050 uint32_t fFp16 : 1;
1051 /** Supports AArch64 Int8 matrix multiplication instructions (FEAT_I8MM). */
1052 uint32_t fI8mm : 1;
1053 /** Supports Implicit Error Synchronization event (FEAT_IESB). */
1054 uint32_t fIesb : 1;
1055 /** Supports Large PA and IPA support (FEAT_LPA). */
1056 uint32_t fLpa : 1;
1057 /** Supports AArch32 Load/Store Multiple instructions atomicity and ordering controls (FEAT_LSMAOC). */
1058 uint32_t fLsmaoc : 1;
1059 /** Supports Large VA support (FEAT_LVA). */
1060 uint32_t fLva : 1;
1061 /** Supports Memory Partitioning and Monitoring Extension (FEAT_MPAM). */
1062 uint32_t fMpam : 1;
1063 /** Supports PC Sample-based Profiling Extension, version 8.2 (FEAT_PCSRv8p2). */
1064 uint32_t fPcsrV8p2 : 1;
1065 /** Supports Advanced SIMD SHA3 instructions (FEAT_SHA3). */
1066 uint32_t fSha3 : 1;
1067 /** Supports Advanced SIMD SHA512 instructions (FEAT_SHA512). */
1068 uint32_t fSha512 : 1;
1069 /** Supports Advanced SIMD SM3 instructions (FEAT_SM3). */
1070 uint32_t fSm3 : 1;
1071 /** Supports Advanced SIMD SM4 instructions (FEAT_SM4). */
1072 uint32_t fSm4 : 1;
1073 /** Supports Statistical Profiling Extension (FEAT_SPE). */
1074 uint32_t fSpe : 1;
1075 /** Supports Scalable Vector Extension (FEAT_SVE). */
1076 uint32_t fSve : 1;
1077 /** Supports Translation Table Common not private translations (FEAT_TTCNP). */
1078 uint32_t fTtcnp : 1;
1079 /** Supports Hierarchical permission disables, version 2 (FEAT_HPDS2). */
1080 uint32_t fHpds2 : 1;
1081 /** Supports Translation table stage 2 Unprivileged Execute-never (FEAT_XNX). */
1082 uint32_t fXnx : 1;
1083 /** Supports Unprivileged Access Override control (FEAT_UAO). */
1084 uint32_t fUao : 1;
1085 /** Supports VMID-aware PIPT instruction cache (FEAT_VPIPT). */
1086 uint32_t fVpipt : 1;
1087 /** Supports Extended cache index (FEAT_CCIDX). */
1088 uint32_t fCcidx : 1;
1089 /** Supports Floating-point complex number instructions (FEAT_FCMA). */
1090 uint32_t fFcma : 1;
1091 /** Supports Debug over Powerdown (FEAT_DoPD). */
1092 uint32_t fDopd : 1;
1093 /** Supports Enhanced pointer authentication (FEAT_EPAC). */
1094 uint32_t fEpac : 1;
1095 /** Supports Faulting on AUT* instructions (FEAT_FPAC). */
1096 uint32_t fFpac : 1;
1097 /** Supports Faulting on combined pointer euthentication instructions (FEAT_FPACCOMBINE). */
1098 uint32_t fFpacCombine : 1;
1099 /** Supports JavaScript conversion instructions (FEAT_JSCVT). */
1100 uint32_t fJscvt : 1;
1101 /** Supports Load-Acquire RCpc instructions (FEAT_LRCPC). */
1102 uint32_t fLrcpc : 1;
1103 /** Supports Nexted Virtualization (FEAT_NV). */
1104 uint32_t fNv : 1;
1105 /** Supports QARMA5 pointer authentication algorithm (FEAT_PACQARMA5). */
1106 uint32_t fPacQarma5 : 1;
1107 /** Supports implementation defined pointer authentication algorithm (FEAT_PACIMP). */
1108 uint32_t fPacImp : 1;
1109 /** Supports Pointer authentication (FEAT_PAuth). */
1110 uint32_t fPAuth : 1;
1111 /** Supports Enhancements to pointer authentication (FEAT_PAuth2). */
1112 uint32_t fPAuth2 : 1;
1113 /** Supports Statistical Profiling Extensions version 1.1 (FEAT_SPEv1p1). */
1114 uint32_t fSpeV1p1 : 1;
1115 /** Supports Activity Monitor Extension, version 1 (FEAT_AMUv1). */
1116 uint32_t fAmuV1 : 1;
1117 /** Supports Generic Counter Scaling (FEAT_CNTSC). */
1118 uint32_t fCntsc : 1;
1119 /** Supports Debug v8.4 (FEAT_Debugv8p4). */
1120 uint32_t fDebugV8p4 : 1;
1121 /** Supports Double Fault Extension (FEAT_DoubleFault). */
1122 uint32_t fDoubleFault : 1;
1123 /** Supports Data Independent Timing instructions (FEAT_DIT). */
1124 uint32_t fDit : 1;
1125 /** Supports Condition flag manipulation isntructions (FEAT_FlagM). */
1126 uint32_t fFlagM : 1;
1127 /** Supports ID space trap handling (FEAT_IDST). */
1128 uint32_t fIdst : 1;
1129 /** Supports Load-Acquire RCpc instructions version 2 (FEAT_LRCPC2). */
1130 uint32_t fLrcpc2 : 1;
1131 /** Supports Large Sytem Extensions version 2 (FEAT_LSE2). */
1132 uint32_t fLse2 : 1;
1133 /** Supports Enhanced nested virtualization support (FEAT_NV2). */
1134 uint32_t fNv2 : 1;
1135 /** Supports Armv8.4 PMU Extensions (FEAT_PMUv3p4). */
1136 uint32_t fPmuV3p4 : 1;
1137 /** Supports RAS Extension v1.1 (FEAT_RASv1p1). */
1138 uint32_t fRasV1p1 : 1;
1139 /** Supports RAS Extension v1.1 System Architecture (FEAT_RASSAv1p1). */
1140 uint32_t fRassaV1p1 : 1;
1141 /** Supports Stage 2 forced Write-Back (FEAT_S2FWB). */
1142 uint32_t fS2Fwb : 1;
1143 /** Supports Secure El2 (FEAT_SEL2). */
1144 uint32_t fSecEl2 : 1;
1145 /** Supports TLB invalidate instructions on Outer Shareable domain (FEAT_TLBIOS). */
1146 uint32_t fTlbios : 1;
1147 /** Supports TLB invalidate range instructions (FEAT_TLBIRANGE). */
1148 uint32_t fTlbirange : 1;
1149 /** Supports Self-hosted Trace Extensions (FEAT_TRF). */
1150 uint32_t fTrf : 1;
1151 /** Supports Translation Table Level (FEAT_TTL). */
1152 uint32_t fTtl : 1;
1153 /** Supports Translation table break-before-make levels (FEAT_BBM). */
1154 uint32_t fBbm : 1;
1155 /** Supports Small translation tables (FEAT_TTST). */
1156 uint32_t fTtst : 1;
1157 /** Supports Branch Target Identification (FEAT_BTI). */
1158 uint32_t fBti : 1;
1159 /** Supports Enhancements to flag manipulation instructions (FEAT_FlagM2). */
1160 uint32_t fFlagM2 : 1;
1161 /** Supports Context synchronization and exception handling (FEAT_ExS). */
1162 uint32_t fExs : 1;
1163 /** Supports Preenting EL0 access to halves of address maps (FEAT_E0PD). */
1164 uint32_t fE0Pd : 1;
1165 /** Supports Floating-point to integer instructions (FEAT_FRINTTS). */
1166 uint32_t fFrintts : 1;
1167 /** Supports Guest translation granule size (FEAT_GTG). */
1168 uint32_t fGtg : 1;
1169 /** Supports Instruction-only Memory Tagging Extension (FEAT_MTE). */
1170 uint32_t fMte : 1;
1171 /** Supports memory Tagging Extension version 2 (FEAT_MTE2). */
1172 uint32_t fMte2 : 1;
1173 /** Supports Armv8.5 PMU Extensions (FEAT_PMUv3p5). */
1174 uint32_t fPmuV3p5 : 1;
1175 /** Supports Random number generator (FEAT_RNG). */
1176 uint32_t fRng : 1;
1177 /** Supports AMU Extensions version 1.1 (FEAT_AMUv1p1). */
1178 uint32_t fAmuV1p1 : 1;
1179 /** Supports Enhanced Counter Virtualization (FEAT_ECV). */
1180 uint32_t fEcv : 1;
1181 /** Supports Fine Grain Traps (FEAT_FGT). */
1182 uint32_t fFgt : 1;
1183 /** Supports Memory Partitioning and Monitoring version 0.1 (FEAT_MPAMv0p1). */
1184 uint32_t fMpamV0p1 : 1;
1185 /** Supports Memory Partitioning and Monitoring version 1.1 (FEAT_MPAMv1p1). */
1186 uint32_t fMpamV1p1 : 1;
1187 /** Supports Multi-threaded PMU Extensions (FEAT_MTPMU). */
1188 uint32_t fMtPmu : 1;
1189 /** Supports Delayed Trapping of WFE (FEAT_TWED). */
1190 uint32_t fTwed : 1;
1191 /** Supports Embbedded Trace Macrocell version 4 (FEAT_ETMv4). */
1192 uint32_t fEtmV4 : 1;
1193 /** Supports Embbedded Trace Macrocell version 4.1 (FEAT_ETMv4p1). */
1194 uint32_t fEtmV4p1 : 1;
1195 /** Supports Embbedded Trace Macrocell version 4.2 (FEAT_ETMv4p2). */
1196 uint32_t fEtmV4p2 : 1;
1197 /** Supports Embbedded Trace Macrocell version 4.3 (FEAT_ETMv4p3). */
1198 uint32_t fEtmV4p3 : 1;
1199 /** Supports Embbedded Trace Macrocell version 4.4 (FEAT_ETMv4p4). */
1200 uint32_t fEtmV4p4 : 1;
1201 /** Supports Embbedded Trace Macrocell version 4.5 (FEAT_ETMv4p5). */
1202 uint32_t fEtmV4p5 : 1;
1203 /** Supports Embbedded Trace Macrocell version 4.6 (FEAT_ETMv4p6). */
1204 uint32_t fEtmV4p6 : 1;
1205 /** Supports Generic Interrupt Controller version 3 (FEAT_GICv3). */
1206 uint32_t fGicV3 : 1;
1207 /** Supports Generic Interrupt Controller version 3.1 (FEAT_GICv3p1). */
1208 uint32_t fGicV3p1 : 1;
1209 /** Supports Trapping Non-secure EL1 writes to ICV_DIR (FEAT_GICv3_TDIR). */
1210 uint32_t fGicV3Tdir : 1;
1211 /** Supports Generic Interrupt Controller version 4 (FEAT_GICv4). */
1212 uint32_t fGicV4 : 1;
1213 /** Supports Generic Interrupt Controller version 4.1 (FEAT_GICv4p1). */
1214 uint32_t fGicV4p1 : 1;
1215 /** Supports PMU extension, version 3 (FEAT_PMUv3). */
1216 uint32_t fPmuV3 : 1;
1217 /** Supports Embedded Trace Extension (FEAT_ETE). */
1218 uint32_t fEte : 1;
1219 /** Supports Embedded Trace Extension, version 1.1 (FEAT_ETEv1p1). */
1220 uint32_t fEteV1p1 : 1;
1221 /** Supports Embedded Trace Extension, version 1.2 (FEAT_ETEv1p2). */
1222 uint32_t fEteV1p2 : 1;
1223 /** Supports Scalable Vector Extension version 2 (FEAT_SVE2). */
1224 uint32_t fSve2 : 1;
1225 /** Supports Scalable Vector AES instructions (FEAT_SVE_AES). */
1226 uint32_t fSveAes : 1;
1227 /** Supports Scalable Vector PMULL instructions (FEAT_SVE_PMULL128). */
1228 uint32_t fSvePmull128 : 1;
1229 /** Supports Scalable Vector Bit Permutes instructions (FEAT_SVE_BitPerm). */
1230 uint32_t fSveBitPerm : 1;
1231 /** Supports Scalable Vector SHA3 instructions (FEAT_SVE_SHA3). */
1232 uint32_t fSveSha3 : 1;
1233 /** Supports Scalable Vector SM4 instructions (FEAT_SVE_SM4). */
1234 uint32_t fSveSm4 : 1;
1235 /** Supports Transactional Memory Extension (FEAT_TME). */
1236 uint32_t fTme : 1;
1237 /** Supports Trace Buffer Extension (FEAT_TRBE). */
1238 uint32_t fTrbe : 1;
1239 /** Supports Scalable Matrix Extension (FEAT_SME). */
1240 uint32_t fSme : 1;
1241 /** @} */
1242
1243 /** @name 2020 Architecture Extensions.
1244 * @{ */
1245 /** Supports Alternate floating-point behavior (FEAT_AFP). */
1246 uint32_t fAfp : 1;
1247 /** Supports HCRX_EL2 register (FEAT_HCX). */
1248 uint32_t fHcx : 1;
1249 /** Supports Larger phsical address for 4KiB and 16KiB translation granules (FEAT_LPA2). */
1250 uint32_t fLpa2 : 1;
1251 /** Supports 64 byte loads and stores without return (FEAT_LS64). */
1252 uint32_t fLs64 : 1;
1253 /** Supports 64 byte stores with return (FEAT_LS64_V). */
1254 uint32_t fLs64V : 1;
1255 /** Supports 64 byte EL0 stores with return (FEAT_LS64_ACCDATA). */
1256 uint32_t fLs64Accdata : 1;
1257 /** Supports MTE Asymmetric Fault Handling (FEAT_MTE3). */
1258 uint32_t fMte3 : 1;
1259 /** Supports SCTLR_ELx.EPAN (FEAT_PAN3). */
1260 uint32_t fPan3 : 1;
1261 /** Supports Armv8.7 PMU extensions (FEAT_PMUv3p7). */
1262 uint32_t fPmuV3p7 : 1;
1263 /** Supports Increased precision of Reciprocal Extimate and Reciprocal Square Root Estimate (FEAT_RPRES). */
1264 uint32_t fRpres : 1;
1265 /** Supports Realm Management Extension (FEAT_RME). */
1266 uint32_t fRme : 1;
1267 /** Supports Full A64 instruction set support in Streaming SVE mode (FEAT_SME_FA64). */
1268 uint32_t fSmeFA64 : 1;
1269 /** Supports Double-precision floating-point outer product instructions (FEAT_SME_F64F64). */
1270 uint32_t fSmeF64F64 : 1;
1271 /** Supports 16-bit to 64-bit integer widening outer product instructions (FEAT_SME_I16I64). */
1272 uint32_t fSmeI16I64 : 1;
1273 /** Supports Statistical Profiling Extensions version 1.2 (FEAT_SPEv1p2). */
1274 uint32_t fSpeV1p2 : 1;
1275 /** Supports AArch64 Extended BFloat16 instructions (FEAT_EBF16). */
1276 uint32_t fEbf16 : 1;
1277 /** Supports WFE and WFI instructions with timeout (FEAT_WFxT). */
1278 uint32_t fWfxt : 1;
1279 /** Supports XS attribute (FEAT_XS). */
1280 uint32_t fXs : 1;
1281 /** Supports branch Record Buffer Extension (FEAT_BRBE). */
1282 uint32_t fBrbe : 1;
1283 /** @} */
1284
1285 /** @name 2021 Architecture Extensions.
1286 * @{ */
1287 /** Supports Control for cache maintenance permission (FEAT_CMOW). */
1288 uint32_t fCmow : 1;
1289 /** Supports PAC algorithm enhancement (FEAT_CONSTPACFIELD). */
1290 uint32_t fConstPacField : 1;
1291 /** Supports Debug v8.8 (FEAT_Debugv8p8). */
1292 uint32_t fDebugV8p8 : 1;
1293 /** Supports Hinted conditional branches (FEAT_HBC). */
1294 uint32_t fHbc : 1;
1295 /** Supports Setting of MDCR_EL2.HPMN to zero (FEAT_HPMN0). */
1296 uint32_t fHpmn0 : 1;
1297 /** Supports Non-Maskable Interrupts (FEAT_NMI). */
1298 uint32_t fNmi : 1;
1299 /** Supports GIC Non-Maskable Interrupts (FEAT_GICv3_NMI). */
1300 uint32_t fGicV3Nmi : 1;
1301 /** Supports Standardization of memory operations (FEAT_MOPS). */
1302 uint32_t fMops : 1;
1303 /** Supports Pointer authentication - QARMA3 algorithm (FEAT_PACQARMA3). */
1304 uint32_t fPacQarma3 : 1;
1305 /** Supports Event counting threshold (FEAT_PMUv3_TH). */
1306 uint32_t fPmuV3Th : 1;
1307 /** Supports Armv8.8 PMU extensions (FEAT_PMUv3p8). */
1308 uint32_t fPmuV3p8 : 1;
1309 /** Supports 64-bit external interface to the Performance Monitors (FEAT_PMUv3_EXT64). */
1310 uint32_t fPmuV3Ext64 : 1;
1311 /** Supports 32-bit external interface to the Performance Monitors (FEAT_PMUv3_EXT32). */
1312 uint32_t fPmuV3Ext32 : 1;
1313 /** Supports External interface to the Performance Monitors (FEAT_PMUv3_EXT). */
1314 uint32_t fPmuV3Ext : 1;
1315 /** Supports Trapping support for RNDR/RNDRRS (FEAT_RNG_TRAP). */
1316 uint32_t fRngTrap : 1;
1317 /** Supports Statistical Profiling Extension version 1.3 (FEAT_SPEv1p3). */
1318 uint32_t fSpeV1p3 : 1;
1319 /** Supports EL0 use of IMPLEMENTATION DEFINEd functionality (FEAT_TIDCP1). */
1320 uint32_t fTidcp1 : 1;
1321 /** Supports Branch Record Buffer Extension version 1.1 (FEAT_BRBEv1p1). */
1322 uint32_t fBrbeV1p1 : 1;
1323 /** @} */
1324
1325 /** @name 2022 Architecture Extensions.
1326 * @{ */
1327 /** Supports Address Breakpoint Linking Extenions (FEAT_ABLE). */
1328 uint32_t fAble : 1;
1329 /** Supports Asynchronous Device error exceptions (FEAT_ADERR). */
1330 uint32_t fAderr : 1;
1331 /** Supports Memory Attribute Index Enhancement (FEAT_AIE). */
1332 uint32_t fAie : 1;
1333 /** Supports Asynchronous Normal error exception (FEAT_ANERR). */
1334 uint32_t fAnerr : 1;
1335 /** Supports Breakpoint Mismatch and Range Extension (FEAT_BWE). */
1336 uint32_t fBwe : 1;
1337 /** Supports Clear Branch History instruction (FEAT_CLRBHB). */
1338 uint32_t fClrBhb : 1;
1339 /** Supports Check Feature Status (FEAT_CHK). */
1340 uint32_t fChk : 1;
1341 /** Supports Common Short Sequence Compression instructions (FEAT_CSSC). */
1342 uint32_t fCssc : 1;
1343 /** Supports Cache Speculation Variant 2 version 3 (FEAT_CSV2_3). */
1344 uint32_t fCsv2v3 : 1;
1345 /** Supports 128-bit Translation Tables, 56 bit PA (FEAT_D128). */
1346 uint32_t fD128 : 1;
1347 /** Supports Debug v8.9 (FEAT_Debugv8p9). */
1348 uint32_t fDebugV8p9 : 1;
1349 /** Supports Enhancements to the Double Fault Extension (FEAT_DoubleFault2). */
1350 uint32_t fDoubleFault2 : 1;
1351 /** Supports Exception based Event Profiling (FEAT_EBEP). */
1352 uint32_t fEbep : 1;
1353 /** Supports Exploitative control using branch history information (FEAT_ECBHB). */
1354 uint32_t fEcBhb : 1;
1355 /** Supports for EDHSR (FEAT_EDHSR). */
1356 uint32_t fEdhsr : 1;
1357 /** Supports Embedded Trace Extension version 1.3 (FEAT_ETEv1p3). */
1358 uint32_t fEteV1p3 : 1;
1359 /** Supports Fine-grained traps 2 (FEAT_FGT2). */
1360 uint32_t fFgt2 : 1;
1361 /** Supports Guarded Control Stack Extension (FEAT_GCS). */
1362 uint32_t fGcs : 1;
1363 /** Supports Hardware managed Access Flag for Table descriptors (FEAT_HAFT). */
1364 uint32_t fHaft : 1;
1365 /** Supports Instrumentation Extension (FEAT_ITE). */
1366 uint32_t fIte : 1;
1367 /** Supports Load-Acquire RCpc instructions version 3 (FEAT_LRCPC3). */
1368 uint32_t fLrcpc3 : 1;
1369 /** Supports 128-bit atomics (FEAT_LSE128). */
1370 uint32_t fLse128 : 1;
1371 /** Supports 56-bit VA (FEAT_LVA3). */
1372 uint32_t fLva3 : 1;
1373 /** Supports Memory Encryption Contexts (FEAT_MEC). */
1374 uint32_t fMec : 1;
1375 /** Supports Enhanced Memory Tagging Extension (FEAT_MTE4). */
1376 uint32_t fMte4 : 1;
1377 /** Supports Canoncial Tag checking for untagged memory (FEAT_MTE_CANONCIAL_TAGS). */
1378 uint32_t fMteCanonicalTags : 1;
1379 /** Supports FAR_ELx on a Tag Check Fault (FEAT_MTE_TAGGED_FAR). */
1380 uint32_t fMteTaggedFar : 1;
1381 /** Supports Store only Tag checking (FEAT_MTE_STORE_ONLY). */
1382 uint32_t fMteStoreOnly : 1;
1383 /** Supports Memory tagging with Address tagging disabled (FEAT_MTE_NO_ADDRESS_TAGS). */
1384 uint32_t fMteNoAddressTags : 1;
1385 /** Supports Memory tagging asymmetric faults (FEAT_MTE_ASYM_FAULT). */
1386 uint32_t fMteAsymFault : 1;
1387 /** Supports Memory Tagging asynchronous faulting (FEAT_MTE_ASYNC). */
1388 uint32_t fMteAsync : 1;
1389 /** Supports Allocation tag access permission (FEAT_MTE_PERM_S1). */
1390 uint32_t fMtePermS1 : 1;
1391 /** Supports Armv8.9 PC Sample-based Profiling Extension (FEAT_PCSRv8p9). */
1392 uint32_t fPcsrV8p9 : 1;
1393 /** Supports Permission model enhancements (FEAT_S1PIE). */
1394 uint32_t fS1Pie : 1;
1395 /** Supports Permission model enhancements (FEAT_S2PIE). */
1396 uint32_t fS2Pie : 1;
1397 /** Supports Permission model enhancements (FEAT_S1POE). */
1398 uint32_t fS1Poe : 1;
1399 /** Supports Permission model enhancements (FEAT_S2POE). */
1400 uint32_t fS2Poe : 1;
1401 /** Supports Physical Fault Address Registers (FEAT_PFAR). */
1402 uint32_t fPfar : 1;
1403 /** Supports Armv8.9 PMU extensions (FEAT_PMUv3p9). */
1404 uint32_t fPmuV3p9 : 1;
1405 /** Supports PMU event edge detection (FEAT_PMUv3_EDGE). */
1406 uint32_t fPmuV3Edge : 1;
1407 /** Supports Fixed-function instruction counter (FEAT_PMUv3_ICNTR). */
1408 uint32_t fPmuV3Icntr : 1;
1409 /** Supports PMU Snapshot Extension (FEAT_PMUv3_SS). */
1410 uint32_t fPmuV3Ss : 1;
1411 /** Supports SLC traget for PRFM instructions (FEAT_PRFMSLC). */
1412 uint32_t fPrfmSlc : 1;
1413 /** Supports RAS version 2 (FEAT_RASv2). */
1414 uint32_t fRasV2 : 1;
1415 /** Supports RAS version 2 System Architecture (FEAT_RASSAv2). */
1416 uint32_t fRasSaV2 : 1;
1417 /** Supports for Range Prefetch Memory instruction (FEAT_RPRFM). */
1418 uint32_t fRprfm : 1;
1419 /** Supports extensions to SCTLR_ELx (FEAT_SCTLR2). */
1420 uint32_t fSctlr2 : 1;
1421 /** Supports Synchronous Exception-based Event Profiling (FEAT_SEBEP). */
1422 uint32_t fSebep : 1;
1423 /** Supports non-widening half-precision FP16 to FP16 arithmetic for SME2.1 (FEAT_SME_F16F16). */
1424 uint32_t fSmeF16F16 : 1;
1425 /** Supports Scalable Matrix Extension version 2 (FEAT_SME2). */
1426 uint32_t fSme2 : 1;
1427 /** Supports Scalable Matrix Extension version 2.1 (FEAT_SME2p1). */
1428 uint32_t fSme2p1 : 1;
1429 /** Supports Enhanced speculation restriction instructions (FEAT_SPECRES2). */
1430 uint32_t fSpecres2 : 1;
1431 /** Supports System Performance Monitors Extension (FEAT_SPMU). */
1432 uint32_t fSpmu : 1;
1433 /** Supports Statistical profiling Extension version 1.4 (FEAT_SPEv1p4). */
1434 uint32_t fSpeV1p4 : 1;
1435 /** Supports Call Return Branch Records (FEAT_SPE_CRR). */
1436 uint32_t fSpeCrr : 1;
1437 /** Supports Data Source Filtering (FEAT_SPE_FDS). */
1438 uint32_t fSpeFds : 1;
1439 /** Supports Scalable Vector Extension version SVE2.1 (FEAT_SVE2p1). */
1440 uint32_t fSve2p1 : 1;
1441 /** Supports Non-widening BFloat16 to BFloat16 arithmetic for SVE (FEAT_SVE_B16B16). */
1442 uint32_t fSveB16B16 : 1;
1443 /** Supports 128-bit System instructions (FEAT_SYSINSTR128). */
1444 uint32_t fSysInstr128 : 1;
1445 /** Supports 128-bit System registers (FEAT_SYSREG128). */
1446 uint32_t fSysReg128 : 1;
1447 /** Supports Extension to TCR_ELx (FEAT_TCR2). */
1448 uint32_t fTcr2 : 1;
1449 /** Supports Translation Hardening Extension (FEAT_THE). */
1450 uint32_t fThe : 1;
1451 /** Supports Trace Buffer external mode (FEAT_TRBE_EXT). */
1452 uint32_t fTrbeExt : 1;
1453 /** Supports Trace Buffer MPAM extension (FEAT_TRBE_MPAM). */
1454 uint32_t fTrbeMpam : 1;
1455 /** @} */
1456
1457 /** Padding to the required size to match CPUMFEATURESX86. */
1458 uint32_t auPadding[5];
1459} CPUMFEATURESARMV8;
1460#ifndef VBOX_FOR_DTRACE_LIB
1461AssertCompileSize(CPUMFEATURESARMV8, 64);
1462AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, enmMicroarch, CPUMFEATURESARMV8, enmMicroarch);
1463AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, enmCpuVendor, CPUMFEATURESARMV8, enmCpuVendor);
1464AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, cMaxPhysAddrWidth, CPUMFEATURESARMV8, cMaxPhysAddrWidth);
1465AssertCompileMembersAtSameOffset(CPUMFEATURESCOMMON, cMaxLinearAddrWidth, CPUMFEATURESARMV8, cMaxLinearAddrWidth);
1466#endif
1467
1468
1469/**
1470 * Chameleon wrapper structure for the host CPU features.
1471 *
1472 * This is used for the globally readable g_CpumHostFeatures variable, which is
1473 * initialized once during VMMR0 load for ring-0 and during CPUMR3Init in
1474 * ring-3. To reflect this immutability after load/init, we use this wrapper
1475 * structure to switch it between const and non-const depending on the context.
1476 * Only two files sees it as non-const (CPUMR0.cpp and CPUM.cpp).
1477 */
1478typedef union CPUHOSTFEATURES
1479{
1480 /** Fields common to all CPU types. */
1481 CPUMFEATURESCOMMON Common;
1482 /** The host specific structure. */
1483#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
1484 CPUMFEATURESX86
1485#elif defined(RT_ARCH_ARM64)
1486 CPUMFEATURESARMV8
1487#else
1488# error "port me"
1489#endif
1490#ifndef CPUM_WITH_NONCONST_HOST_FEATURES
1491 const
1492#endif
1493 s;
1494} CPUHOSTFEATURES;
1495#ifndef VBOX_FOR_DTRACE_LIB
1496AssertCompileSize(CPUHOSTFEATURES, 64);
1497#endif
1498/** Pointer to a const host CPU feature structure. */
1499typedef CPUHOSTFEATURES const *PCCPUHOSTFEATURES;
1500
1501/** Host CPU features.
1502 * @note In ring-3, only valid after CPUMR3Init. In ring-0, valid after
1503 * module init. */
1504extern CPUHOSTFEATURES g_CpumHostFeatures;
1505
1506
1507/** The target CPU feature structure.
1508 * @todo this should have a chameleon wrapper as well (ring-0). */
1509#ifndef VBOX_VMM_TARGET_ARMV8
1510typedef CPUMFEATURESX86 CPUMFEATURES;
1511#else
1512typedef CPUMFEATURESARMV8 CPUMFEATURES;
1513#endif
1514/** Pointer to a CPU feature structure. */
1515typedef CPUMFEATURES *PCPUMFEATURES;
1516/** Pointer to a const CPU feature structure. */
1517typedef CPUMFEATURES const *PCCPUMFEATURES;
1518
1519
1520
1521/**
1522 * ARMv8 CPU ID registers.
1523 */
1524typedef struct CPUMARMV8IDREGS
1525{
1526 /** Content of the ID_AA64PFR0_EL1 register. */
1527 uint64_t u64RegIdAa64Pfr0El1;
1528 /** Content of the ID_AA64PFR1_EL1 register. */
1529 uint64_t u64RegIdAa64Pfr1El1;
1530 /** Content of the ID_AA64DFR0_EL1 register. */
1531 uint64_t u64RegIdAa64Dfr0El1;
1532 /** Content of the ID_AA64DFR1_EL1 register. */
1533 uint64_t u64RegIdAa64Dfr1El1;
1534 /** Content of the ID_AA64AFR0_EL1 register. */
1535 uint64_t u64RegIdAa64Afr0El1;
1536 /** Content of the ID_AA64AFR1_EL1 register. */
1537 uint64_t u64RegIdAa64Afr1El1;
1538 /** Content of the ID_AA64ISAR0_EL1 register. */
1539 uint64_t u64RegIdAa64Isar0El1;
1540 /** Content of the ID_AA64ISAR1_EL1 register. */
1541 uint64_t u64RegIdAa64Isar1El1;
1542 /** Content of the ID_AA64ISAR2_EL1 register. */
1543 uint64_t u64RegIdAa64Isar2El1;
1544 /** Content of the ID_AA64MMFR0_EL1 register. */
1545 uint64_t u64RegIdAa64Mmfr0El1;
1546 /** Content of the ID_AA64MMFR1_EL1 register. */
1547 uint64_t u64RegIdAa64Mmfr1El1;
1548 /** Content of the ID_AA64MMFR2_EL1 register. */
1549 uint64_t u64RegIdAa64Mmfr2El1;
1550 /** Content of the CLIDR_EL1 register. */
1551 uint64_t u64RegClidrEl1;
1552 /** Content of the CTR_EL0 register. */
1553 uint64_t u64RegCtrEl0;
1554 /** Content of the DCZID_EL0 register. */
1555 uint64_t u64RegDczidEl0;
1556 /** @todo we need MIDR_EL1 here, possibly also MPIDR_EL1 and REVIDR_EL1. */
1557} CPUMARMV8IDREGS;
1558/** Pointer to CPU ID registers. */
1559typedef CPUMARMV8IDREGS *PCPUMARMV8IDREGS;
1560/** Pointer to a const CPU ID registers structure. */
1561typedef CPUMARMV8IDREGS const *PCCPUMARMV8IDREGS;
1562
1563
1564/*
1565 * Include the target specific header.
1566 * This uses several of the above types, so it must be postponed till here.
1567 */
1568#ifndef VBOX_VMM_TARGET_ARMV8
1569# include <VBox/vmm/cpum-x86-amd64.h>
1570#else
1571# include <VBox/vmm/cpum-armv8.h>
1572#endif
1573
1574
1575
1576RT_C_DECLS_BEGIN
1577
1578#ifndef VBOX_FOR_DTRACE_LIB
1579
1580VMMDECL(void) CPUMSetChangedFlags(PVMCPU pVCpu, uint32_t fChangedAdd);
1581VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVMCPU pVCpu);
1582VMMDECL(CPUMMODE) CPUMGetGuestMode(PVMCPU pVCpu);
1583VMMDECL(uint32_t) CPUMGetGuestCodeBits(PVMCPU pVCpu);
1584VMMDECL(DISCPUMODE) CPUMGetGuestDisMode(PVMCPU pVCpu);
1585
1586/** @name Guest Register Getters.
1587 * @{ */
1588VMMDECL(uint64_t) CPUMGetGuestFlatPC(PVMCPU pVCpu);
1589VMMDECL(uint64_t) CPUMGetGuestFlatSP(PVMCPU pVCpu);
1590VMMDECL(CPUMCPUVENDOR) CPUMGetGuestCpuVendor(PVM pVM);
1591VMMDECL(CPUMARCH) CPUMGetGuestArch(PCVM pVM);
1592VMMDECL(CPUMMICROARCH) CPUMGetGuestMicroarch(PCVM pVM);
1593VMMDECL(void) CPUMGetGuestAddrWidths(PCVM pVM, uint8_t *pcPhysAddrWidth, uint8_t *pcLinearAddrWidth);
1594/** @} */
1595
1596/** @name Misc Guest Predicate Functions.
1597 * @{ */
1598VMMDECL(bool) CPUMIsGuestIn64BitCode(PCVMCPU pVCpu);
1599/** @} */
1600
1601VMMDECL(CPUMCPUVENDOR) CPUMGetHostCpuVendor(PVM pVM);
1602VMMDECL(CPUMARCH) CPUMGetHostArch(PCVM pVM);
1603VMMDECL(CPUMMICROARCH) CPUMGetHostMicroarch(PCVM pVM);
1604
1605VMMDECL(const char *) CPUMMicroarchName(CPUMMICROARCH enmMicroarch);
1606VMMDECL(const char *) CPUMCpuVendorName(CPUMCPUVENDOR enmVendor);
1607
1608VMMDECL(CPUMCPUVENDOR) CPUMCpuIdDetectX86VendorEx(uint32_t uEAX, uint32_t uEBX, uint32_t uECX, uint32_t uEDX);
1609#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
1610VMMDECL(int) CPUMCpuIdCollectLeavesFromX86Host(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves);
1611VMM_INT_DECL(void) CPUMCpuIdApplyX86HostArchCapabilities(PVMCC pVM, bool fHasArchCap, uint64_t fHostArchVal);
1612#endif
1613#if defined(RT_ARCH_ARM64)
1614VMMDECL(int) CPUMCpuIdCollectIdRegistersFromArmV8Host(PCPUMARMV8IDREGS pIdRegs);
1615#endif
1616
1617#ifdef IN_RING3
1618/** @defgroup grp_cpum_r3 The CPUM ring-3 API
1619 * @{
1620 */
1621
1622VMMR3DECL(int) CPUMR3Init(PVM pVM);
1623VMMR3DECL(int) CPUMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
1624VMMR3DECL(void) CPUMR3LogCpuIdAndMsrFeatures(PVM pVM);
1625VMMR3DECL(void) CPUMR3Relocate(PVM pVM);
1626VMMR3DECL(int) CPUMR3Term(PVM pVM);
1627VMMR3DECL(void) CPUMR3Reset(PVM pVM);
1628VMMR3DECL(void) CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
1629VMMDECL(bool) CPUMR3IsStateRestorePending(PVM pVM);
1630
1631VMMR3DECL(uint32_t) CPUMR3DbGetEntries(void);
1632/** Pointer to CPUMR3DbGetEntries. */
1633typedef DECLCALLBACKPTR(uint32_t, PFNCPUMDBGETENTRIES, (void));
1634VMMR3DECL(PCCPUMDBENTRY) CPUMR3DbGetEntryByIndex(uint32_t idxCpuDb);
1635/** Pointer to CPUMR3DbGetEntryByIndex. */
1636typedef DECLCALLBACKPTR(PCCPUMDBENTRY, PFNCPUMDBGETENTRYBYINDEX, (uint32_t idxCpuDb));
1637VMMR3DECL(PCCPUMDBENTRY) CPUMR3DbGetEntryByName(const char *pszName);
1638/** Pointer to CPUMR3DbGetEntryByName. */
1639typedef DECLCALLBACKPTR(PCCPUMDBENTRY, PFNCPUMDBGETENTRYBYNAME, (const char *pszName));
1640
1641VMMR3_INT_DECL(void) CPUMR3NemActivateGuestDebugState(PVMCPUCC pVCpu);
1642VMMR3_INT_DECL(void) CPUMR3NemActivateHyperDebugState(PVMCPUCC pVCpu);
1643/** @} */
1644#endif /* IN_RING3 */
1645
1646#endif /* !VBOX_FOR_DTRACE_LIB */
1647/** @} */
1648RT_C_DECLS_END
1649
1650
1651#endif /* !VBOX_INCLUDED_vmm_cpum_h */
1652
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