[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 53/69] target/arm: Convert T16 branch and exchang
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v3 53/69] target/arm: Convert T16 branch and exchange |
Date: |
Wed, 28 Aug 2019 12:04:40 -0700 |
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
target/arm/translate.c | 70 +++++++++++++++++-------------------------
target/arm/t16.decode | 10 ++++++
2 files changed, 39 insertions(+), 41 deletions(-)
diff --git a/target/arm/translate.c b/target/arm/translate.c
index d4d7d99da8..cd39329e5c 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -8338,7 +8338,7 @@ static bool trans_BX(DisasContext *s, arg_BX *a)
if (!ENABLE_ARCH_4T) {
return false;
}
- gen_bx(s, load_reg(s, a->rm));
+ gen_bx_excret(s, load_reg(s, a->rm));
return true;
}
@@ -8365,6 +8365,32 @@ static bool trans_BLX_r(DisasContext *s, arg_BLX_r *a)
return true;
}
+/*
+ * BXNS/BLXNS: only exist for v8M with the security extensions,
+ * and always UNDEF if NonSecure. We don't implement these in
+ * the user-only mode either (in theory you can use them from
+ * Secure User mode but they are too tied in to system emulation).
+ */
+static bool trans_BXNS(DisasContext *s, arg_BXNS *a)
+{
+ if (!s->v8m_secure || IS_USER_ONLY) {
+ unallocated_encoding(s);
+ } else {
+ gen_bxns(s, a->rm);
+ }
+ return true;
+}
+
+static bool trans_BLXNS(DisasContext *s, arg_BLXNS *a)
+{
+ if (!s->v8m_secure || IS_USER_ONLY) {
+ unallocated_encoding(s);
+ } else {
+ gen_blxns(s, a->rm);
+ }
+ return true;
+}
+
static bool trans_CLZ(DisasContext *s, arg_CLZ *a)
{
TCGv_i32 tmp;
@@ -10733,49 +10759,11 @@ static void disas_thumb_insn(DisasContext *s,
uint32_t insn)
}
break;
case 3:
- {
/* 0b0100_0111_xxxx_xxxx
* - branch [and link] exchange thumb register
+ * In decodetree
*/
- bool link = insn & (1 << 7);
-
- if (insn & 3) {
- goto undef;
- }
- if (link) {
- ARCH(5);
- }
- if ((insn & 4)) {
- /* BXNS/BLXNS: only exists for v8M with the
- * security extensions, and always UNDEF if NonSecure.
- * We don't implement these in the user-only mode
- * either (in theory you can use them from Secure User
- * mode but they are too tied in to system emulation.)
- */
- if (!s->v8m_secure || IS_USER_ONLY) {
- goto undef;
- }
- if (link) {
- gen_blxns(s, rm);
- } else {
- gen_bxns(s, rm);
- }
- break;
- }
- /* BLX/BX */
- tmp = load_reg(s, rm);
- if (link) {
- val = (uint32_t)s->base.pc_next | 1;
- tmp2 = tcg_temp_new_i32();
- tcg_gen_movi_i32(tmp2, val);
- store_reg(s, 14, tmp2);
- gen_bx(s, tmp);
- } else {
- /* Only BX works as exception-return, not BLX */
- gen_bx_excret(s, tmp);
- }
- break;
- }
+ goto illegal_op;
}
break;
}
diff --git a/target/arm/t16.decode b/target/arm/t16.decode
index 0654275e68..edddbfb9b8 100644
--- a/target/arm/t16.decode
+++ b/target/arm/t16.decode
@@ -24,6 +24,7 @@
&s_rri_rot !extern s rn rd imm rot
&s_rrrr !extern s rd rn rm ra
&ri !extern rd imm
+&r !extern rm
&ldst_rr !extern p w u rn rt rm shimm shtype
&ldst_ri !extern p w u rn rt imm
&ldst_block !extern rn i b u w list
@@ -144,3 +145,12 @@ MOV_rxi 00100 ... ........ @arith_1i
%s
CMP_xri 00101 ... ........ @arith_1i s=1
ADD_rri 00110 ... ........ @arith_1i %s
SUB_rri 00111 ... ........ @arith_1i %s
+
+# Branch and exchange
+
+@branchr .... .... . rm:4 ... &r
+
+BX 0100 0111 0 .... 000 @branchr
+BLX_r 0100 0111 1 .... 000 @branchr
+BXNS 0100 0111 0 .... 100 @branchr
+BLXNS 0100 0111 1 .... 100 @branchr
--
2.17.1
- [Qemu-devel] [PATCH v3 69/69] target/arm: Inline gen_bx_im into callers, (continued)
- [Qemu-devel] [PATCH v3 69/69] target/arm: Inline gen_bx_im into callers, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 46/69] target/arm: Convert T16 data-processing (two low regs), Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 54/69] target/arm: Convert T16 add, compare, move (two high registers), Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 56/69] target/arm: Convert T16, extract, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 66/69] target/arm: Convert T16, Unconditional branch, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 62/69] target/arm: Convert T16, Conditional branches, Supervisor call, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 45/69] target/arm: Add skeleton for T16 decodetree, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 51/69] target/arm: Convert T16 add/sub (3 low, 2 low and imm), Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 52/69] target/arm: Convert T16 one low register and immediate, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 57/69] target/arm: Convert T16, Change processor state, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 53/69] target/arm: Convert T16 branch and exchange,
Richard Henderson <=
- [Qemu-devel] [PATCH v3 64/69] target/arm: Convert T16, shift immediate, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 58/69] target/arm: Convert T16, Reverse bytes, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 60/69] target/arm: Split gen_nop_hint, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 61/69] target/arm: Convert T16, push and pop, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 67/69] target/arm: Convert T16, long branches, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v3 65/69] target/arm: Convert T16, load (literal), Richard Henderson, 2019/08/28
- Re: [Qemu-devel] [PATCH v3 00/69] target/arm: Convert aa32 base isa to decodetree, no-reply, 2019/08/28