[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/20] target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetre
From: |
Peter Maydell |
Subject: |
[PATCH 06/20] target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetree |
Date: |
Fri, 2 Jun 2023 16:52:09 +0100 |
Convert MSR (reg), MRS, SYS, SYSL to decodetree. For QEMU these are
all essentially the same instruction (system register access).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/tcg/a64.decode | 8 ++++++++
target/arm/tcg/translate-a64.c | 32 +++++---------------------------
2 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode
index a645dac8d26..e1a120ea4c0 100644
--- a/target/arm/tcg/a64.decode
+++ b/target/arm/tcg/a64.decode
@@ -207,3 +207,11 @@ MSR_i_TCO 1101 0101 0000 0 011 0100 .... 100 11111
@msr_i
MSR_i_DAIFSET 1101 0101 0000 0 011 0100 .... 110 11111 @msr_i
MSR_i_DAIFCLEAR 1101 0101 0000 0 011 0100 .... 111 11111 @msr_i
MSR_i_SVCR 1101 0101 0000 0 011 0100 0 mask:2 imm:1 011 11111
+
+# MRS, MSR (register), SYS, SYSL. These are all essentially the
+# same instruction as far as QEMU is concerned.
+# NB: op0 is bits [20:19], but op0=0b00 is other insns, so we have
+# to hand-decode it.
+SYS 1101 0101 00 l:1 01 op1:3 crn:4 crm:4 op2:3 rt:5 op0=1
+SYS 1101 0101 00 l:1 10 op1:3 crn:4 crm:4 op2:3 rt:5 op0=2
+SYS 1101 0101 00 l:1 11 op1:3 crn:4 crm:4 op2:3 rt:5 op0=3
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index bdc1ee18cdc..8e4d3676992 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -2070,7 +2070,7 @@ static void gen_sysreg_undef(DisasContext *s, bool isread,
* These are all essentially the same insn in 'read' and 'write'
* versions, with varying op0 fields.
*/
-static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
+static void handle_sys(DisasContext *s, bool isread,
unsigned int op0, unsigned int op1, unsigned int op2,
unsigned int crn, unsigned int crm, unsigned int rt)
{
@@ -2254,28 +2254,10 @@ static void handle_sys(DisasContext *s, uint32_t insn,
bool isread,
}
}
-/* System
- * 31 22 21 20 19 18 16 15 12 11 8 7 5 4 0
- * +---------------------+---+-----+-----+-------+-------+-----+------+
- * | 1 1 0 1 0 1 0 1 0 0 | L | op0 | op1 | CRn | CRm | op2 | Rt |
- * +---------------------+---+-----+-----+-------+-------+-----+------+
- */
-static void disas_system(DisasContext *s, uint32_t insn)
+static bool trans_SYS(DisasContext *s, arg_SYS *a)
{
- unsigned int l, op0, op1, crn, crm, op2, rt;
- l = extract32(insn, 21, 1);
- op0 = extract32(insn, 19, 2);
- op1 = extract32(insn, 16, 3);
- crn = extract32(insn, 12, 4);
- crm = extract32(insn, 8, 4);
- op2 = extract32(insn, 5, 3);
- rt = extract32(insn, 0, 5);
-
- if (op0 == 0) {
- unallocated_encoding(s);
- return;
- }
- handle_sys(s, insn, l, op0, op1, op2, crn, crm, rt);
+ handle_sys(s, a->l, a->op0, a->op1, a->op2, a->crn, a->crm, a->rt);
+ return true;
}
/* Exception generation
@@ -2382,11 +2364,7 @@ static void disas_b_exc_sys(DisasContext *s, uint32_t
insn)
switch (extract32(insn, 25, 7)) {
case 0x6a: /* Exception generation / System */
if (insn & (1 << 24)) {
- if (extract32(insn, 22, 2) == 0) {
- disas_system(s, insn);
- } else {
- unallocated_encoding(s);
- }
+ unallocated_encoding(s);
} else {
disas_exc(s, insn);
}
--
2.34.1
- [PATCH 02/20] target/arm: Convert hint instruction space to decodetree, (continued)
- [PATCH 02/20] target/arm: Convert hint instruction space to decodetree, Peter Maydell, 2023/06/02
- [PATCH 01/20] target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics, Peter Maydell, 2023/06/02
- [PATCH 03/20] target/arm: Convert barrier insns to decodetree, Peter Maydell, 2023/06/02
- [PATCH 04/20] target/arm: Convert CFINV, XAFLAG and AXFLAG to decodetree, Peter Maydell, 2023/06/02
- [PATCH 05/20] target/arm: Convert MSR (immediate) to decodetree, Peter Maydell, 2023/06/02
- [PATCH 06/20] target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetree,
Peter Maydell <=
- [PATCH 07/20] target/arm: Convert exception generation instructions to decodetree, Peter Maydell, 2023/06/02
- [PATCH 08/20] target/arm: Convert load/store exclusive and ordered to decodetree, Peter Maydell, 2023/06/02
- [PATCH 09/20] target/arm: Convert LDXP, STXP, CASP, CAS to decodetree, Peter Maydell, 2023/06/02
- [PATCH 10/20] target/arm: Convert load reg (literal) group to decodetree, Peter Maydell, 2023/06/02
- [PATCH 12/20] target/arm: Convert ld/st reg+imm9 insns to decodetree, Peter Maydell, 2023/06/02