[99241] | 1 | /** @file
|
---|
| 2 | * DIS - The VirtualBox Disassembler.
|
---|
| 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_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 |
|
---|
| 47 | RT_C_DECLS_BEGIN
|
---|
| 48 |
|
---|
| 49 | /** @addtogroup grp_dis VBox Disassembler
|
---|
| 50 | * @{ */
|
---|
[105848] | 51 | /**
|
---|
| 52 | * GPR definition
|
---|
| 53 | */
|
---|
| 54 | typedef struct
|
---|
| 55 | {
|
---|
| 56 | /** Flag whether this is a 32-bit or 64-bit register. */
|
---|
[105850] | 57 | bool f32Bit : 1;
|
---|
[105848] | 58 | /** The register index. */
|
---|
[105850] | 59 | RT_GCC_EXTENSION uint8_t idGpr : 7;
|
---|
[105848] | 60 | } DISOPPARAMARMV8REG;
|
---|
| 61 | AssertCompileSize(DISOPPARAMARMV8REG, sizeof(uint8_t));
|
---|
| 62 | /** Pointer to a disassembler GPR. */
|
---|
| 63 | typedef DISOPPARAMARMV8REG *PDISOPPARAMARMV8REG;
|
---|
| 64 | /** Pointer to a const disasssembler GPR. */
|
---|
| 65 | typedef const DISOPPARAMARMV8REG *PCDISOPPARAMARMV8REG;
|
---|
[99241] | 66 |
|
---|
[105848] | 67 |
|
---|
[99241] | 68 | /**
|
---|
| 69 | * Opcode parameter (operand) details.
|
---|
| 70 | */
|
---|
[101539] | 71 | typedef struct
|
---|
[99241] | 72 | {
|
---|
[105848] | 73 | /** Parameter type (Actually DISARMV8OPPARM). */
|
---|
| 74 | uint8_t enmType;
|
---|
| 75 | /** Any extension applied (DISARMV8OPPARMEXTEND). */
|
---|
| 76 | uint8_t enmExtend;
|
---|
[99319] | 77 | /** The register operand. */
|
---|
| 78 | union
|
---|
| 79 | {
|
---|
| 80 | /** General register index (DISGREG_XXX), applicable if DISUSE_REG_GEN32
|
---|
| 81 | * or DISUSE_REG_GEN64 is set in fUse. */
|
---|
[105848] | 82 | DISOPPARAMARMV8REG Gpr;
|
---|
[105731] | 83 | /** IPRT System register encoding. */
|
---|
[105848] | 84 | uint16_t idSysReg;
|
---|
| 85 | /**
|
---|
| 86 | * Conditional parameter (not a register I know but this saves us struct size and
|
---|
| 87 | * and these never occur at the same time, might get renamed if everything is done).
|
---|
| 88 | *
|
---|
| 89 | * DISARMV8INSTRCOND
|
---|
| 90 | */
|
---|
| 91 | uint8_t enmCond;
|
---|
[99319] | 92 | } Reg;
|
---|
[105848] | 93 | /** Register holding the offset. Applicable if DISUSE_INDEX is set in fUse. */
|
---|
| 94 | DISOPPARAMARMV8REG GprIndex;
|
---|
[99241] | 95 | /** Parameter size. */
|
---|
[105848] | 96 | uint8_t cb;
|
---|
[105779] | 97 | union
|
---|
| 98 | {
|
---|
[105785] | 99 | /** Offset from the base register. */
|
---|
[105848] | 100 | int16_t offBase;
|
---|
| 101 | /** Amount of bits to extend. */
|
---|
| 102 | uint8_t cExtend;
|
---|
[105794] | 103 | } u;
|
---|
[101539] | 104 | } DIS_OP_PARAM_ARMV8_T;
|
---|
| 105 | AssertCompile(sizeof(DIS_OP_PARAM_ARMV8_T) <= 16);
|
---|
[99241] | 106 | /** Pointer to opcode parameter. */
|
---|
[101539] | 107 | typedef DIS_OP_PARAM_ARMV8_T *PDIS_OP_PARAM_ARMV8_T;
|
---|
[99241] | 108 | /** Pointer to opcode parameter. */
|
---|
[101539] | 109 | typedef const DIS_OP_PARAM_ARMV8_T *PCDIS_OP_PARAM_ARMV8_T;
|
---|
[99241] | 110 |
|
---|
| 111 |
|
---|
| 112 | /**
|
---|
| 113 | * The armv8 specific disassembler state and result.
|
---|
| 114 | */
|
---|
[101539] | 115 | typedef struct
|
---|
[99241] | 116 | {
|
---|
[105737] | 117 | /** Condition flag for the instruction - kArmv8InstrCond_Al if not conditional instruction. */
|
---|
[105738] | 118 | DISARMV8INSTRCOND enmCond;
|
---|
[105815] | 119 | /** Operand size (for loads/stores primarily). */
|
---|
| 120 | uint8_t cbOperand;
|
---|
[101539] | 121 | } DIS_STATE_ARMV8_T;
|
---|
| 122 | AssertCompile(sizeof(DIS_STATE_ARMV8_T) <= 32);
|
---|
[99241] | 123 |
|
---|
| 124 |
|
---|
| 125 | /** @} */
|
---|
| 126 |
|
---|
| 127 | RT_C_DECLS_END
|
---|
| 128 |
|
---|
| 129 | #endif /* !VBOX_INCLUDED_dis_armv8_h */
|
---|
| 130 |
|
---|