1 | /* $Id: CPUMInternal-armv8.h 101190 2023-09-20 11:51:34Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * CPUM - Internal header file, ARMv8 variant.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VMM_INCLUDED_SRC_include_CPUMInternal_armv8_h
|
---|
29 | #define VMM_INCLUDED_SRC_include_CPUMInternal_armv8_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
35 | # include <VBox/cdefs.h>
|
---|
36 | # include <VBox/types.h>
|
---|
37 | # include <VBox/vmm/stam.h>
|
---|
38 | #else
|
---|
39 | # pragma D depends_on library cpumctx.d
|
---|
40 | # pragma D depends_on library cpum.d
|
---|
41 |
|
---|
42 | /* Some fudging. */
|
---|
43 | typedef uint64_t STAMCOUNTER;
|
---|
44 | #endif
|
---|
45 |
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 | /** @defgroup grp_cpum_int Internals
|
---|
50 | * @ingroup grp_cpum
|
---|
51 | * @internal
|
---|
52 | * @{
|
---|
53 | */
|
---|
54 |
|
---|
55 | /** Use flags (CPUM::fUseFlags).
|
---|
56 | * @{ */
|
---|
57 | /** Set to indicate that we should save host DR0-7 and load the hypervisor debug
|
---|
58 | * registers in the raw-mode world switchers. (See CPUMRecalcHyperDRx.) */
|
---|
59 | #define CPUM_USE_DEBUG_REGS_HYPER RT_BIT(0)
|
---|
60 | /** Used in ring-0 to indicate that we have loaded the hypervisor debug
|
---|
61 | * registers. */
|
---|
62 | #define CPUM_USED_DEBUG_REGS_HYPER RT_BIT(1)
|
---|
63 | /** Used in ring-0 to indicate that we have loaded the guest debug
|
---|
64 | * registers (DR0-3 and maybe DR6) for direct use by the guest.
|
---|
65 | * DR7 (and AMD-V DR6) are handled via the VMCB. */
|
---|
66 | #define CPUM_USED_DEBUG_REGS_GUEST RT_BIT(2)
|
---|
67 | /** @} */
|
---|
68 |
|
---|
69 |
|
---|
70 | /** @name CPUM Saved State Version.
|
---|
71 | * @{ */
|
---|
72 | /** The current saved state version. */
|
---|
73 | #define CPUM_SAVED_STATE_VERSION 1
|
---|
74 | /** @} */
|
---|
75 |
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * CPU info
|
---|
79 | */
|
---|
80 | typedef struct CPUMINFO
|
---|
81 | {
|
---|
82 | /** The number of system register ranges (CPUMSSREGRANGE) in the array pointed to below. */
|
---|
83 | uint32_t cSysRegRanges;
|
---|
84 |
|
---|
85 | /** Pointer to the sysrem register ranges. */
|
---|
86 | R3PTRTYPE(PCPUMSYSREGRANGE) paSysRegRangesR3;
|
---|
87 |
|
---|
88 | /** System register ranges. */
|
---|
89 | CPUMSYSREGRANGE aSysRegRanges[128];
|
---|
90 | } CPUMINFO;
|
---|
91 | /** Pointer to a CPU info structure. */
|
---|
92 | typedef CPUMINFO *PCPUMINFO;
|
---|
93 | /** Pointer to a const CPU info structure. */
|
---|
94 | typedef CPUMINFO const *CPCPUMINFO;
|
---|
95 |
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * CPUM Data (part of VM)
|
---|
99 | */
|
---|
100 | typedef struct CPUM
|
---|
101 | {
|
---|
102 | /** The (more) portable CPUID level. */
|
---|
103 | uint8_t u8PortableCpuIdLevel;
|
---|
104 | /** Indicates that a state restore is pending.
|
---|
105 | * This is used to verify load order dependencies (PGM). */
|
---|
106 | bool fPendingRestore;
|
---|
107 | uint8_t abPadding0[6];
|
---|
108 |
|
---|
109 | /** Align to 64-byte boundary. */
|
---|
110 | uint8_t abPadding1[56];
|
---|
111 |
|
---|
112 | /** Host CPU feature information.
|
---|
113 | * Externaly visible via the VM structure, aligned on 64-byte boundrary. */
|
---|
114 | CPUMFEATURES HostFeatures;
|
---|
115 | /** Guest CPU feature information.
|
---|
116 | * Externaly visible via that VM structure, aligned with HostFeatures. */
|
---|
117 | CPUMFEATURES GuestFeatures;
|
---|
118 | /** Guest CPU info. */
|
---|
119 | CPUMINFO GuestInfo;
|
---|
120 | /** Host CPU ID registers. */
|
---|
121 | CPUMIDREGS HostIdRegs;
|
---|
122 | /** Guest CPU ID registers. */
|
---|
123 | CPUMIDREGS GuestIdRegs;
|
---|
124 |
|
---|
125 | /** @name System register statistics.
|
---|
126 | * @{ */
|
---|
127 | STAMCOUNTER cSysRegWrites;
|
---|
128 | STAMCOUNTER cSysRegWritesToIgnoredBits;
|
---|
129 | STAMCOUNTER cSysRegWritesRaiseExcp;
|
---|
130 | STAMCOUNTER cSysRegWritesUnknown;
|
---|
131 | STAMCOUNTER cSysRegReads;
|
---|
132 | STAMCOUNTER cSysRegReadsRaiseExcp;
|
---|
133 | STAMCOUNTER cSysRegReadsUnknown;
|
---|
134 | /** @} */
|
---|
135 | } CPUM;
|
---|
136 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
137 | AssertCompileMemberOffset(CPUM, HostFeatures, 64);
|
---|
138 | AssertCompileMemberOffset(CPUM, GuestFeatures, 112);
|
---|
139 | #endif
|
---|
140 | /** Pointer to the CPUM instance data residing in the shared VM structure. */
|
---|
141 | typedef CPUM *PCPUM;
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * CPUM Data (part of VMCPU)
|
---|
145 | */
|
---|
146 | typedef struct CPUMCPU
|
---|
147 | {
|
---|
148 | /** Guest context.
|
---|
149 | * Aligned on a 64-byte boundary. */
|
---|
150 | CPUMCTX Guest;
|
---|
151 |
|
---|
152 | /** Use flags.
|
---|
153 | * These flags indicates both what is to be used and what has been used. */
|
---|
154 | uint32_t fUseFlags;
|
---|
155 |
|
---|
156 | /** Changed flags.
|
---|
157 | * These flags indicates to REM (and others) which important guest
|
---|
158 | * registers which has been changed since last time the flags were cleared.
|
---|
159 | * See the CPUM_CHANGED_* defines for what we keep track of.
|
---|
160 | *
|
---|
161 | * @todo Obsolete, but will probably be refactored so keep it for reference. */
|
---|
162 | uint32_t fChanged;
|
---|
163 | } CPUMCPU;
|
---|
164 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
165 | /** @todo Compile time size/alignment assertions. */
|
---|
166 | #endif
|
---|
167 | /** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */
|
---|
168 | typedef CPUMCPU *PCPUMCPU;
|
---|
169 |
|
---|
170 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
171 | RT_C_DECLS_BEGIN
|
---|
172 |
|
---|
173 | # ifdef IN_RING3
|
---|
174 | DECLHIDDEN(int) cpumR3DbgInit(PVM pVM);
|
---|
175 | DECLHIDDEN(int) cpumR3SysRegStrictInitChecks(void);
|
---|
176 |
|
---|
177 | void cpumR3SaveCpuId(PVM pVM, PSSMHANDLE pSSM);
|
---|
178 | int cpumR3LoadCpuId(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion);
|
---|
179 |
|
---|
180 | DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
181 | DECLCALLBACK(void) cpumR3CpuFeatInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
182 |
|
---|
183 | # endif
|
---|
184 |
|
---|
185 | RT_C_DECLS_END
|
---|
186 | #endif /* !VBOX_FOR_DTRACE_LIB */
|
---|
187 |
|
---|
188 | /** @} */
|
---|
189 |
|
---|
190 | #endif /* !VMM_INCLUDED_SRC_include_CPUMInternal_armv8_h */
|
---|
191 |
|
---|