1
From 9a43acf1cad20eb16aa85657b28983e015d47d04 Mon Sep 17 00:00:00 2001
2
From: Alexander Graf <agraf@suse.de>
3
Date: Tue, 17 Dec 2013 19:42:33 +0000
4
Subject: [PATCH 32/49] target-arm: A64: add support for BR, BLR and RET insns
6
Implement BR, BLR and RET. This is all of the 'unconditional
7
branch (register)' instruction category except for ERET
8
and DPRS (which are system mode only).
10
Signed-off-by: Alexander Graf <agraf@suse.de>
11
[claudio: reimplemented on top of new decoder structure]
12
Signed-off-by: Claudio Fontana <claudio.fontana@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <rth@twiddle.net>
16
target-arm/translate-a64.c | 43 +++++++++++++++++++++++++++++++++++++++++--
17
1 file changed, 41 insertions(+), 2 deletions(-)
19
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
20
index ead5658..b694665 100644
21
--- a/target-arm/translate-a64.c
22
+++ b/target-arm/translate-a64.c
23
@@ -384,10 +384,49 @@ static void disas_exc(DisasContext *s, uint32_t insn)
24
unsupported_encoding(s, insn);
27
-/* Unconditional branch (register) */
28
+/* C3.2.7 Unconditional branch (register)
29
+ * 31 25 24 21 20 16 15 10 9 5 4 0
30
+ * +---------------+-------+-------+-------+------+-------+
31
+ * | 1 1 0 1 0 1 1 | opc | op2 | op3 | Rn | op4 |
32
+ * +---------------+-------+-------+-------+------+-------+
34
static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
36
- unsupported_encoding(s, insn);
37
+ unsigned int opc, op2, op3, rn, op4;
39
+ opc = extract32(insn, 21, 4);
40
+ op2 = extract32(insn, 16, 5);
41
+ op3 = extract32(insn, 10, 6);
42
+ rn = extract32(insn, 5, 5);
43
+ op4 = extract32(insn, 0, 5);
45
+ if (op4 != 0x0 || op3 != 0x0 || op2 != 0x1f) {
46
+ unallocated_encoding(s);
55
+ tcg_gen_movi_i64(cpu_reg(s, 30), s->pc);
60
+ unallocated_encoding(s);
62
+ unsupported_encoding(s, insn);
66
+ unallocated_encoding(s);
70
+ tcg_gen_mov_i64(cpu_pc, cpu_reg(s, rn));
71
+ s->is_jmp = DISAS_JUMP;
74
/* C3.2 Branches, exception generating and system instructions */