VirtualBox

source: vbox/trunk/include/VBox/dis-armv8.h@ 107288

Last change on this file since 107288 was 106806, checked in by vboxsync, 3 months ago

Disassembler: Decode RCW compare and swap and RCW compare and swap pair instructions, bugref:10394 [missing file]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1/** @file
2 * DIS - The VirtualBox Disassembler.
3 */
4
5/*
6 * Copyright (C) 2023-2024 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_dis_armv8_h
37#define VBOX_INCLUDED_dis_armv8_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <VBox/types.h>
43#include <VBox/disopcode-armv8.h>
44#include <iprt/assert.h>
45
46
47RT_C_DECLS_BEGIN
48
49/** @addtogroup grp_dis VBox Disassembler
50 * @{ */
51
52/**
53 * The register type.
54 */
55typedef enum DISOPPARAMARMV8REGTYPE
56{
57 kDisOpParamArmV8RegType_Gpr_32Bit = 0,
58 kDisOpParamArmV8RegType_Gpr_64Bit,
59 kDisOpParamArmV8RegType_FpReg_Single,
60 kDisOpParamArmV8RegType_FpReg_Double,
61 kDisOpParamArmV8RegType_FpReg_Half,
62 kDisOpParamArmV8RegType_Simd_Scalar_8Bit,
63 kDisOpParamArmV8RegType_Simd_Scalar_16Bit,
64 kDisOpParamArmV8RegType_Simd_Scalar_32Bit,
65 kDisOpParamArmV8RegType_Simd_Scalar_64Bit,
66 kDisOpParamArmV8RegType_Simd_Scalar_128Bit,
67 kDisOpParamArmV8RegType_Simd_Vector,
68 kDisOpParamArmV8RegType_Simd_Vector_Group,
69 kDisOpParamArmV8RegType_Sp
70} DISOPPARAMARMV8REGTYPE;
71
72
73/**
74 * The vector register type.
75 */
76typedef enum DISOPPARAMARMV8VECREGTYPE
77{
78 kDisOpParamArmV8VecRegType_None = 0,
79 kDisOpParamArmV8VecRegType_8B,
80 kDisOpParamArmV8VecRegType_16B,
81 kDisOpParamArmV8VecRegType_4H,
82 kDisOpParamArmV8VecRegType_8H,
83 kDisOpParamArmV8VecRegType_2S,
84 kDisOpParamArmV8VecRegType_4S,
85 kDisOpParamArmV8VecRegType_1D,
86 kDisOpParamArmV8VecRegType_2D
87} DISOPPARAMARMV8VECREGTYPE;
88
89
90/**
91 * Register definition
92 */
93typedef struct
94{
95 /** The register type (DISOPPARAMARMV8REGTYPE). */
96 uint8_t enmRegType;
97 /** The register ID (not applicable for kDisOpParamArmV8RegType_Sp). */
98 uint8_t idReg;
99 /** Number of consecutive registers being accessed by this parameter starting at DISOPPARAMARMV8REG::idReg (mostly 1). */
100 uint8_t cRegs;
101 /** Vector register type (DISOPPARAMARMV8VECREGTYPE). */
102 uint8_t enmVecType;
103} DISOPPARAMARMV8REG;
104AssertCompileSize(DISOPPARAMARMV8REG, sizeof(uint32_t));
105/** Pointer to a disassembler GPR. */
106typedef DISOPPARAMARMV8REG *PDISOPPARAMARMV8REG;
107/** Pointer to a const disasssembler GPR. */
108typedef const DISOPPARAMARMV8REG *PCDISOPPARAMARMV8REG;
109
110
111/**
112 * Opcode parameter (operand) details.
113 */
114typedef struct
115{
116 /** Parameter type (Actually DISARMV8OPPARM). */
117 uint8_t enmType;
118 /** Any extension applied (DISARMV8OPPARMEXTEND). */
119 uint8_t enmExtend;
120 /** The operand. */
121 union
122 {
123 /** General register index (DISGREG_XXX), applicable if DISUSE_REG_GEN32
124 * or DISUSE_REG_GEN64 is set in fUse. */
125 DISOPPARAMARMV8REG Reg;
126 /** IPRT System register encoding. */
127 uint16_t idSysReg;
128 /** Conditional parameter - DISARMV8INSTRCOND */
129 uint8_t enmCond;
130 /** PState field (for MSR) - DISARMV8INSTRPSTATE. */
131 uint8_t enmPState;
132 } Op;
133 /** Register holding the offset. Applicable if DISUSE_INDEX is set in fUse. */
134 DISOPPARAMARMV8REG GprIndex;
135 /** Parameter size. */
136 uint8_t cb;
137 union
138 {
139 /** Offset from the base register. */
140 int32_t offBase;
141 /** Amount of bits to extend. */
142 uint8_t cExtend;
143 } u;
144} DIS_OP_PARAM_ARMV8_T;
145AssertCompile(sizeof(DIS_OP_PARAM_ARMV8_T) <= 16);
146/** Pointer to opcode parameter. */
147typedef DIS_OP_PARAM_ARMV8_T *PDIS_OP_PARAM_ARMV8_T;
148/** Pointer to opcode parameter. */
149typedef const DIS_OP_PARAM_ARMV8_T *PCDIS_OP_PARAM_ARMV8_T;
150
151
152/**
153 * The armv8 specific disassembler state and result.
154 */
155typedef struct
156{
157 /** Condition flag for the instruction - kArmv8InstrCond_Al if not conditional instruction. */
158 DISARMV8INSTRCOND enmCond;
159 /** Floating point type for floating point instructions. */
160 DISARMV8INSTRFPTYPE enmFpType;
161 /** Vector register type for advanced SIMD instructions. */
162 DISOPPARAMARMV8VECREGTYPE enmVecRegType;
163 /** Operand size (for loads/stores primarily). */
164 uint8_t cbOperand;
165} DIS_STATE_ARMV8_T;
166AssertCompile(sizeof(DIS_STATE_ARMV8_T) <= 32);
167
168
169/** @} */
170
171RT_C_DECLS_END
172
173#endif /* !VBOX_INCLUDED_dis_armv8_h */
174
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