From 5a23a1f020e95cbd6a3f270e971aa969271eed8a Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 20 Nov 2019 11:43:54 -0500 Subject: [PATCH] target/arm: Convert SETEND Backports commit 48c04a5dfaf2c08e00b659a22c502ec098999cf1 from qemu --- qemu/target/arm/a32-uncond.decode | 4 ++++ qemu/target/arm/translate.c | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/qemu/target/arm/a32-uncond.decode b/qemu/target/arm/a32-uncond.decode index de611e8a..32253b4f 100644 --- a/qemu/target/arm/a32-uncond.decode +++ b/qemu/target/arm/a32-uncond.decode @@ -24,6 +24,7 @@ &empty !extern &i !extern imm +&setend E # Branch with Link and Exchange @@ -50,3 +51,6 @@ DSB 1111 0101 0111 1111 1111 0000 0100 ---- DMB 1111 0101 0111 1111 1111 0000 0101 ---- ISB 1111 0101 0111 1111 1111 0000 0110 ---- SB 1111 0101 0111 1111 1111 0000 0111 0000 + +# Set Endianness +SETEND 1111 0001 0000 0001 0000 00 E:1 0 0000 0000 &setend diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index 4e3f9aa2..6e1cc6c1 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -10579,6 +10579,19 @@ static bool trans_CPS(DisasContext *s, arg_CPS *a) return true; } +static bool trans_SETEND(DisasContext *s, arg_SETEND *a) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + if (!ENABLE_ARCH_6) { + return false; + } + if (a->E != (s->be_data == MO_BE)) { + gen_helper_setend(tcg_ctx, tcg_ctx->cpu_env); + s->base.is_jmp = DISAS_UPDATE; + } + return true; +} + /* * Legacy decoder. */ @@ -10673,15 +10686,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) return; /* v7MP: Unallocated memory hint: must NOP */ } - if ((insn & 0x0ffffdff) == 0x01010000) { - ARCH(6); - /* setend */ - if (((insn >> 9) & 1) != !!(s->be_data == MO_BE)) { - gen_helper_setend(tcg_ctx, tcg_ctx->cpu_env); - s->base.is_jmp = DISAS_UPDATE; - } - return; - } else if ((insn & 0x0e000f00) == 0x0c000100) { + if ((insn & 0x0e000f00) == 0x0c000100) { if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { /* iWMMXt register transfer. */ if (extract32(s->c15_cpar, 1, 1)) {