VirtualBox

source: vbox/trunk/src/VBox/VMM/include/CPUMInternal-armv8.h

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1/* $Id: CPUMInternal-armv8.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * CPUM - Internal header file, ARMv8 variant.
4 */
5
6/*
7 * Copyright (C) 2023-2024 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. */
43typedef 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 */
80typedef 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. */
92typedef CPUMINFO *PCPUMINFO;
93/** Pointer to a const CPU info structure. */
94typedef CPUMINFO const *CPCPUMINFO;
95
96
97/**
98 * CPUM Data (part of VM)
99 */
100typedef 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 /** The initial exception level (EL) to start the CPU after a reset,
108 * should be either ARMV8_AARCH64_EL_1 or ARMV8_AARCH64_EL_2 for nested virtualization. */
109 uint8_t bResetEl;
110
111 uint8_t abPadding0[5];
112
113 /** The reset value of the program counter. */
114 uint64_t u64ResetPc;
115
116 /** Align to 64-byte boundary. */
117 uint8_t abPadding1[48];
118
119 /** Host CPU feature information.
120 * Externaly visible via the VM structure, aligned on 64-byte boundrary. */
121 CPUMFEATURES HostFeatures;
122 /** Guest CPU feature information.
123 * Externaly visible via that VM structure, aligned with HostFeatures. */
124 CPUMFEATURES GuestFeatures;
125 /** Guest CPU info. */
126 CPUMINFO GuestInfo;
127 /** Host CPU ID registers. */
128 CPUMIDREGS HostIdRegs;
129 /** Guest CPU ID registers. */
130 CPUMIDREGS GuestIdRegs;
131
132 /** @name System register statistics.
133 * @{ */
134 STAMCOUNTER cSysRegWrites;
135 STAMCOUNTER cSysRegWritesToIgnoredBits;
136 STAMCOUNTER cSysRegWritesRaiseExcp;
137 STAMCOUNTER cSysRegWritesUnknown;
138 STAMCOUNTER cSysRegReads;
139 STAMCOUNTER cSysRegReadsRaiseExcp;
140 STAMCOUNTER cSysRegReadsUnknown;
141 /** @} */
142} CPUM;
143#ifndef VBOX_FOR_DTRACE_LIB
144AssertCompileMemberOffset(CPUM, HostFeatures, 64);
145AssertCompileMemberOffset(CPUM, GuestFeatures, 112);
146#endif
147/** Pointer to the CPUM instance data residing in the shared VM structure. */
148typedef CPUM *PCPUM;
149
150/**
151 * CPUM Data (part of VMCPU)
152 */
153typedef struct CPUMCPU
154{
155 /** Guest context.
156 * Aligned on a 64-byte boundary. */
157 CPUMCTX Guest;
158
159 /** Use flags.
160 * These flags indicates both what is to be used and what has been used. */
161 uint32_t fUseFlags;
162
163 /** Changed flags.
164 * These flags indicates to REM (and others) which important guest
165 * registers which has been changed since last time the flags were cleared.
166 * See the CPUM_CHANGED_* defines for what we keep track of.
167 *
168 * @todo Obsolete, but will probably be refactored so keep it for reference. */
169 uint32_t fChanged;
170} CPUMCPU;
171#ifndef VBOX_FOR_DTRACE_LIB
172/** @todo Compile time size/alignment assertions. */
173#endif
174/** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */
175typedef CPUMCPU *PCPUMCPU;
176
177#ifndef VBOX_FOR_DTRACE_LIB
178RT_C_DECLS_BEGIN
179
180# ifdef IN_RING3
181DECLHIDDEN(int) cpumR3DbgInit(PVM pVM);
182DECLHIDDEN(int) cpumR3SysRegStrictInitChecks(void);
183
184void cpumR3SaveCpuId(PVM pVM, PSSMHANDLE pSSM);
185int cpumR3LoadCpuId(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion);
186
187DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
188DECLCALLBACK(void) cpumR3CpuFeatInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
189
190# endif
191
192RT_C_DECLS_END
193#endif /* !VBOX_FOR_DTRACE_LIB */
194
195/** @} */
196
197#endif /* !VMM_INCLUDED_SRC_include_CPUMInternal_armv8_h */
198
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