VirtualBox

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

Last change on this file since 104298 was 101549, checked in by vboxsync, 14 months ago

VMM/Armv8: Allow configuring the program counter reset value, bugref:10528

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