VirtualBox

source: vbox/trunk/include/VBox/vmm/cpumctx-armv8.h@ 98955

Last change on this file since 98955 was 98955, checked in by vboxsync, 23 months ago

include/VBox/vmm: Refactor cpumctx.h into an architecture dependent header and architecture independent header, bugref:10387

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
Line 
1/** @file
2 * CPUM - CPU Monitor(/ Manager), Context Structures for the ARMv8 emulation/virtualization.
3 */
4
5/*
6 * Copyright (C) 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_cpumctx_armv8_h
37#define VBOX_INCLUDED_vmm_cpumctx_armv8_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#ifndef VBOX_FOR_DTRACE_LIB
43# include <VBox/types.h>
44#else
45# pragma D depends_on library arm.d
46#endif
47
48
49RT_C_DECLS_BEGIN
50
51/** @defgroup grp_cpum_ctx The CPUM Context Structures
52 * @ingroup grp_cpum
53 * @{
54 */
55
56/** A general register (union). */
57typedef union CPUMCTXGREG
58{
59 /** X<n> register view. */
60 uint64_t x;
61 /** 32-bit W<n>view. */
62 uint32_t w;
63} CPUMCTXGREG;
64#ifndef VBOX_FOR_DTRACE_LIB
65AssertCompileSize(CPUMCTXGREG, 8);
66#endif
67
68
69/**
70 * V<n> register union.
71 */
72typedef union CPUMCTXVREG
73{
74 /** V Register view. */
75 RTUINT128U v;
76 /** 8-bit view. */
77 uint8_t au8[16];
78 /** 16-bit view. */
79 uint16_t au16[8];
80 /** 32-bit view. */
81 uint32_t au32[4];
82 /** 64-bit view. */
83 uint64_t au64[2];
84 /** Signed 8-bit view. */
85 int8_t ai8[16];
86 /** Signed 16-bit view. */
87 int16_t ai16[8];
88 /** Signed 32-bit view. */
89 int32_t ai32[4];
90 /** Signed 64-bit view. */
91 int64_t ai64[2];
92 /** 128-bit view. (yeah, very helpful) */
93 uint128_t au128[1];
94 /** Single precision floating point view. */
95 RTFLOAT32U ar32[4];
96 /** Double precision floating point view. */
97 RTFLOAT64U ar64[2];
98} CPUMCTXVREG;
99#ifndef VBOX_FOR_DTRACE_LIB
100AssertCompileSize(CPUMCTXVREG, 16);
101#endif
102/** Pointer to an V<n> register state. */
103typedef CPUMCTXVREG *PCPUMCTXVREG;
104/** Pointer to a const V<n> register state. */
105typedef CPUMCTXVREG const *PCCPUMCTXVREG;
106
107
108/**
109 * A system level register.
110 */
111typedef union CPUMCTXSYSREG
112{
113 /** 64-bit view. */
114 uint64_t u64;
115 /** 32-bit view. */
116 uint32_t u32;
117} CPUMCTXSYSREG;
118#ifndef VBOX_FOR_DTRACE_LIB
119AssertCompileSize(CPUMCTXSYSREG, 8);
120#endif
121
122
123/**
124 * CPU context.
125 */
126typedef struct CPUMCTX
127{
128 /** The general purpose register array view. */
129 CPUMCTXGREG aGRegs[31];
130 /** The NEON SIMD & FP register array view. */
131 CPUMCTXVREG aVRegs[32];
132 /** The stack registers (EL0, EL1). */
133 CPUMCTXSYSREG aSpReg[2];
134 /** The program counter. */
135 CPUMCTXSYSREG Pc;
136 /** The SPSR (Saved Program Status Register) (EL1 only). */
137 CPUMCTXSYSREG Spsr;
138 /** The ELR (Exception Link Register) (EL1 only). */
139 CPUMCTXSYSREG Elr;
140
141
142 /** Floating point control register. */
143 uint64_t fpcr;
144 /** Floating point status register. */
145 uint64_t fpsr;
146
147 /** Externalized state tracker, CPUMCTX_EXTRN_XXX. */
148 uint64_t fExtrn;
149
150} CPUMCTX;
151
152
153#ifndef VBOX_FOR_DTRACE_LIB
154AssertCompileSizeAlignment(CPUMCTX, 64);
155AssertCompileSizeAlignment(CPUMCTX, 32);
156AssertCompileSizeAlignment(CPUMCTX, 16);
157AssertCompileSizeAlignment(CPUMCTX, 8);
158#endif /* !VBOX_FOR_DTRACE_LIB */
159
160
161/** @name CPUMCTX_EXTRN_XXX
162 * Used for parts of the CPUM state that is externalized and needs fetching
163 * before use.
164 *
165 * @{ */
166/** External state keeper: Invalid. */
167#define CPUMCTX_EXTRN_KEEPER_INVALID UINT64_C(0x0000000000000000)
168/** External state keeper: NEM. */
169#define CPUMCTX_EXTRN_KEEPER_NEM UINT64_C(0x0000000000000001)
170/** External state keeper mask. */
171#define CPUMCTX_EXTRN_KEEPER_MASK UINT64_C(0x0000000000000003)
172
173/** The PC register value is kept externally. */
174#define CPUMCTX_EXTRN_PC UINT64_C(0x0000000000000004)
175/** The SPSR register values are kept externally. */
176#define CPUMCTX_EXTRN_SPSR UINT64_C(0x0000000000000008)
177/** The ELR register values are kept externally. */
178#define CPUMCTX_EXTRN_ELR UINT64_C(0x0000000000000010)
179/** The SP register values are kept externally. */
180#define CPUMCTX_EXTRN_SP UINT64_C(0x0000000000000020)
181
182/** The X0 register value is kept externally. */
183#define CPUMCTX_EXTRN_X0 UINT64_C(0x0000000000000040)
184/** The X0 register value is kept externally. */
185#define CPUMCTX_EXTRN_X1 UINT64_C(0x0000000000000080)
186/** The X0 register value is kept externally. */
187#define CPUMCTX_EXTRN_X2 UINT64_C(0x0000000000000100)
188/** The X0 register value is kept externally. */
189#define CPUMCTX_EXTRN_X3 UINT64_C(0x0000000000000200)
190/** The LR (X30) register value is kept externally. */
191#define CPUMCTX_EXTRN_LR UINT64_C(0x0000000000000400)
192/** The FP (X29) register value is kept externally. */
193#define CPUMCTX_EXTRN_FP UINT64_C(0x0000000000000800)
194/** The X4 through X28 register values are kept externally. */
195#define CPUMCTX_EXTRN_X4_X28 UINT64_C(0x0000000000001000)
196/** General purpose registers mask. */
197#define CPUMCTX_EXTRN_GPRS_MASK UINT64_C(0x0000000000001fc0)
198
199/** The NEON SIMD & FP registers V0 through V31 are kept externally. */
200#define CPUMCTX_EXTRN_V0_V31 UINT64_C(0x0000000000002000)
201/** The FPCR (Floating Point Control Register) is kept externally. */
202#define CPUMCTX_EXTRN_FPCR UINT64_C(0x0000000000004000)
203/** The FPSR (Floating Point Status Register) is kept externally. */
204#define CPUMCTX_EXTRN_FCSR UINT64_C(0x0000000000008000)
205
206/** Mask of bits the keepers can use for state tracking. */
207#define CPUMCTX_EXTRN_KEEPER_STATE_MASK UINT64_C(0xffff000000000000)
208
209/** All CPUM state bits, not including keeper specific ones. */
210#define CPUMCTX_EXTRN_ALL UINT64_C(0x00000ffffffffffc)
211/** All CPUM state bits, including keeper specific ones. */
212#define CPUMCTX_EXTRN_ABSOLUTELY_ALL UINT64_C(0xfffffffffffffffc)
213/** @} */
214
215/** @} */
216
217RT_C_DECLS_END
218
219#endif /* !VBOX_INCLUDED_vmm_cpumctx_armv8_h */
220
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