VirtualBox

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

Last change on this file since 100746 was 99383, checked in by vboxsync, 20 months ago

VMM/ARMv8: Add ability to insert new system register ranges (based on the MSR machinery from x86/amd64), bugref:10387

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: CPUMInternal-armv8.h 99383 2023-04-13 11:02:06Z 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 /** Indicates that a state restore is pending.
103 * This is used to verify load order dependencies (PGM). */
104 bool fPendingRestore;
105 uint8_t abPadding0[7];
106
107 /** Guest CPU info. */
108 CPUMINFO GuestInfo;
109 /** @todo */
110
111 /** @name System register statistics.
112 * @{ */
113 STAMCOUNTER cSysRegWrites;
114 STAMCOUNTER cSysRegWritesToIgnoredBits;
115 STAMCOUNTER cSysRegWritesRaiseExcp;
116 STAMCOUNTER cSysRegWritesUnknown;
117 STAMCOUNTER cSysRegReads;
118 STAMCOUNTER cSysRegReadsRaiseExcp;
119 STAMCOUNTER cSysRegReadsUnknown;
120 /** @} */
121} CPUM;
122#ifndef VBOX_FOR_DTRACE_LIB
123/** @todo Compile time size/alignment assertions. */
124#endif
125/** Pointer to the CPUM instance data residing in the shared VM structure. */
126typedef CPUM *PCPUM;
127
128/**
129 * CPUM Data (part of VMCPU)
130 */
131typedef struct CPUMCPU
132{
133 /** Guest context.
134 * Aligned on a 64-byte boundary. */
135 CPUMCTX Guest;
136
137 /** Use flags.
138 * These flags indicates both what is to be used and what has been used. */
139 uint32_t fUseFlags;
140
141 /** Changed flags.
142 * These flags indicates to REM (and others) which important guest
143 * registers which has been changed since last time the flags were cleared.
144 * See the CPUM_CHANGED_* defines for what we keep track of.
145 *
146 * @todo Obsolete, but will probably be refactored so keep it for reference. */
147 uint32_t fChanged;
148} CPUMCPU;
149#ifndef VBOX_FOR_DTRACE_LIB
150/** @todo Compile time size/alignment assertions. */
151#endif
152/** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */
153typedef CPUMCPU *PCPUMCPU;
154
155#ifndef VBOX_FOR_DTRACE_LIB
156RT_C_DECLS_BEGIN
157
158# ifdef IN_RING3
159DECLHIDDEN(int) cpumR3DbgInit(PVM pVM);
160DECLHIDDEN(int) cpumR3SysRegStrictInitChecks(void);
161# endif
162
163RT_C_DECLS_END
164#endif /* !VBOX_FOR_DTRACE_LIB */
165
166/** @} */
167
168#endif /* !VMM_INCLUDED_SRC_include_CPUMInternal_armv8_h */
169
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