1 | /** @file
|
---|
2 | * CPUM - CPU Monitor(/ Manager).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2023 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_armv8_h
|
---|
37 | #define VBOX_INCLUDED_vmm_cpum_armv8_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 |
|
---|
44 | RT_C_DECLS_BEGIN
|
---|
45 |
|
---|
46 | /** @defgroup grp_cpum The CPU Monitor / Manager API
|
---|
47 | * @ingroup grp_vmm
|
---|
48 | * @{
|
---|
49 | */
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * CPU features and quirks.
|
---|
53 | * This is mostly exploded CPUID info.
|
---|
54 | */
|
---|
55 | typedef struct CPUMFEATURES
|
---|
56 | {
|
---|
57 | /** The CPU vendor (CPUMCPUVENDOR). */
|
---|
58 | uint8_t enmCpuVendor;
|
---|
59 | /** The CPU family. */
|
---|
60 | uint8_t uFamily;
|
---|
61 | /** The CPU model. */
|
---|
62 | uint8_t uModel;
|
---|
63 | /** The CPU stepping. */
|
---|
64 | uint8_t uStepping;
|
---|
65 | /** The microarchitecture. */
|
---|
66 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
67 | CPUMMICROARCH enmMicroarch;
|
---|
68 | #else
|
---|
69 | uint32_t enmMicroarch;
|
---|
70 | #endif
|
---|
71 | /** The maximum physical address width of the CPU. */
|
---|
72 | uint8_t cMaxPhysAddrWidth;
|
---|
73 | /** The maximum linear address width of the CPU. */
|
---|
74 | uint8_t cMaxLinearAddrWidth;
|
---|
75 |
|
---|
76 | /** Padding to the required size to match CPUMFEATURES for x86/amd64. */
|
---|
77 | uint8_t abPadding[48 - 10];
|
---|
78 | } CPUMFEATURES;
|
---|
79 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
80 | AssertCompileSize(CPUMFEATURES, 48);
|
---|
81 | #endif
|
---|
82 | /** Pointer to a CPU feature structure. */
|
---|
83 | typedef CPUMFEATURES *PCPUMFEATURES;
|
---|
84 | /** Pointer to a const CPU feature structure. */
|
---|
85 | typedef CPUMFEATURES const *PCCPUMFEATURES;
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Chameleon wrapper structure for the host CPU features.
|
---|
89 | *
|
---|
90 | * This is used for the globally readable g_CpumHostFeatures variable, which is
|
---|
91 | * initialized once during VMMR0 load for ring-0 and during CPUMR3Init in
|
---|
92 | * ring-3. To reflect this immutability after load/init, we use this wrapper
|
---|
93 | * structure to switch it between const and non-const depending on the context.
|
---|
94 | * Only two files sees it as non-const (CPUMR0.cpp and CPUM.cpp).
|
---|
95 | */
|
---|
96 | typedef struct CPUHOSTFEATURES
|
---|
97 | {
|
---|
98 | CPUMFEATURES
|
---|
99 | #ifndef CPUM_WITH_NONCONST_HOST_FEATURES
|
---|
100 | const
|
---|
101 | #endif
|
---|
102 | s;
|
---|
103 | } CPUHOSTFEATURES;
|
---|
104 | /** Pointer to a const host CPU feature structure. */
|
---|
105 | typedef CPUHOSTFEATURES const *PCCPUHOSTFEATURES;
|
---|
106 |
|
---|
107 | /** Host CPU features.
|
---|
108 | * @note In ring-3, only valid after CPUMR3Init. In ring-0, valid after
|
---|
109 | * module init. */
|
---|
110 | extern CPUHOSTFEATURES g_CpumHostFeatures;
|
---|
111 |
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * CPU database entry.
|
---|
115 | */
|
---|
116 | typedef struct CPUMDBENTRY
|
---|
117 | {
|
---|
118 | /** The CPU name. */
|
---|
119 | const char *pszName;
|
---|
120 | /** The full CPU name. */
|
---|
121 | const char *pszFullName;
|
---|
122 | /** The CPU vendor (CPUMCPUVENDOR). */
|
---|
123 | uint8_t enmVendor;
|
---|
124 | /** The CPU family. */
|
---|
125 | uint8_t uFamily;
|
---|
126 | /** The CPU model. */
|
---|
127 | uint8_t uModel;
|
---|
128 | /** The CPU stepping. */
|
---|
129 | uint8_t uStepping;
|
---|
130 | /** The microarchitecture. */
|
---|
131 | CPUMMICROARCH enmMicroarch;
|
---|
132 | /** Scalable bus frequency used for reporting other frequencies. */
|
---|
133 | uint64_t uScalableBusFreq;
|
---|
134 | /** Flags - CPUMDB_F_XXX. */
|
---|
135 | uint32_t fFlags;
|
---|
136 | /** The maximum physical address with of the CPU. This should correspond to
|
---|
137 | * the value in CPUID leaf 0x80000008 when present. */
|
---|
138 | uint8_t cMaxPhysAddrWidth;
|
---|
139 | } CPUMDBENTRY;
|
---|
140 | /** Pointer to a const CPU database entry. */
|
---|
141 | typedef CPUMDBENTRY const *PCCPUMDBENTRY;
|
---|
142 |
|
---|
143 |
|
---|
144 | /** @name Changed flags.
|
---|
145 | * These flags are used to keep track of which important register that
|
---|
146 | * have been changed since last they were reset. The only one allowed
|
---|
147 | * to clear them is REM!
|
---|
148 | *
|
---|
149 | * @todo This is obsolete, but remains as it will be refactored for coordinating
|
---|
150 | * IEM and NEM/HM later. Probably.
|
---|
151 | * @{
|
---|
152 | */
|
---|
153 | #define CPUM_CHANGED_GLOBAL_TLB_FLUSH RT_BIT(0)
|
---|
154 | #define CPUM_CHANGED_ALL ( CPUM_CHANGED_GLOBAL_TLB_FLUSH )
|
---|
155 | /** @} */
|
---|
156 |
|
---|
157 | /** @} */
|
---|
158 | RT_C_DECLS_END
|
---|
159 |
|
---|
160 |
|
---|
161 | #endif /* !VBOX_INCLUDED_vmm_cpum_armv8_h */
|
---|
162 |
|
---|