~ubuntu-branches/ubuntu/vivid/qemu/vivid

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu/arm64/0052-target-arm-A64-add-support-for-ld-st-unsigned-imm.patch

  • Committer: Package Import Robot
  • Author(s): dann frazier
  • Date: 2014-02-11 15:41:53 UTC
  • Revision ID: package-import@ubuntu.com-20140211154153-2d001tf0ium08u81
Tags: 1.7.0+dfsg-3ubuntu2
* Backport changes to enable qemu-user-static support for aarch64
* debian/control: add ppc64el to Architectures
* debian/rules: only install qemu-system-aarch64 on arm64.
  Fixes a FTBFS  when built twice in a row on non-arm64 due to a stale
  debian/qemu-system-aarch64 directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 6149b73d6ebd878d1b3ca8f0a044acd306ab1367 Mon Sep 17 00:00:00 2001
 
2
From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>
 
3
Date: Mon, 23 Dec 2013 23:27:28 +0000
 
4
Subject: [PATCH 052/158] target-arm: A64: add support for ld/st unsigned imm
 
5
MIME-Version: 1.0
 
6
Content-Type: text/plain; charset=UTF-8
 
7
Content-Transfer-Encoding: 8bit
 
8
 
 
9
This adds support for the forms of ld/st with a 12 bit
 
10
unsigned immediate offset.
 
11
 
 
12
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
 
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
 
14
Reviewed-by: Richard Henderson <rth@twiddle.net>
 
15
---
 
16
 target-arm/translate-a64.c | 89 +++++++++++++++++++++++++++++++++++++++++++++-
 
17
 1 file changed, 88 insertions(+), 1 deletion(-)
 
18
 
 
19
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
 
20
index 0c3b994..0edcee1 100644
 
21
--- a/target-arm/translate-a64.c
 
22
+++ b/target-arm/translate-a64.c
 
23
@@ -901,10 +901,97 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn)
 
24
     }
 
25
 }
 
26
 
 
27
+/*
 
28
+ * C3.3.13 Load/store (unsigned immediate)
 
29
+ *
 
30
+ * 31 30 29   27  26 25 24 23 22 21        10 9     5
 
31
+ * +----+-------+---+-----+-----+------------+-------+------+
 
32
+ * |size| 1 1 1 | V | 0 1 | opc |   imm12    |  Rn   |  Rt  |
 
33
+ * +----+-------+---+-----+-----+------------+-------+------+
 
34
+ *
 
35
+ * For non-vector:
 
36
+ *   size: 00-> byte, 01 -> 16 bit, 10 -> 32bit, 11 -> 64bit
 
37
+ *   opc: 00 -> store, 01 -> loadu, 10 -> loads 64, 11 -> loads 32
 
38
+ * For vector:
 
39
+ *   size is opc<1>:size<1:0> so 100 -> 128 bit; 110 and 111 unallocated
 
40
+ *   opc<0>: 0 -> store, 1 -> load
 
41
+ * Rn: base address register (inc SP)
 
42
+ * Rt: target register
 
43
+ */
 
44
+static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn)
 
45
+{
 
46
+    int rt = extract32(insn, 0, 5);
 
47
+    int rn = extract32(insn, 5, 5);
 
48
+    unsigned int imm12 = extract32(insn, 10, 12);
 
49
+    bool is_vector = extract32(insn, 26, 1);
 
50
+    int size = extract32(insn, 30, 2);
 
51
+    int opc = extract32(insn, 22, 2);
 
52
+    unsigned int offset;
 
53
+
 
54
+    TCGv_i64 tcg_addr;
 
55
+
 
56
+    bool is_store;
 
57
+    bool is_signed = false;
 
58
+    bool is_extended = false;
 
59
+
 
60
+    if (is_vector) {
 
61
+        size |= (opc & 2) << 1;
 
62
+        if (size > 4) {
 
63
+            unallocated_encoding(s);
 
64
+            return;
 
65
+        }
 
66
+        is_store = !extract32(opc, 0, 1);
 
67
+    } else {
 
68
+        if (size == 3 && opc == 2) {
 
69
+            /* PRFM - prefetch */
 
70
+            return;
 
71
+        }
 
72
+        if (opc == 3 && size > 1) {
 
73
+            unallocated_encoding(s);
 
74
+            return;
 
75
+        }
 
76
+        is_store = (opc == 0);
 
77
+        is_signed = extract32(opc, 1, 1);
 
78
+        is_extended = (size < 3) && extract32(opc, 0, 1);
 
79
+    }
 
80
+
 
81
+    if (rn == 31) {
 
82
+        gen_check_sp_alignment(s);
 
83
+    }
 
84
+    tcg_addr = read_cpu_reg_sp(s, rn, 1);
 
85
+    offset = imm12 << size;
 
86
+    tcg_gen_addi_i64(tcg_addr, tcg_addr, offset);
 
87
+
 
88
+    if (is_vector) {
 
89
+        if (is_store) {
 
90
+            do_fp_st(s, rt, tcg_addr, size);
 
91
+        } else {
 
92
+            do_fp_ld(s, rt, tcg_addr, size);
 
93
+        }
 
94
+    } else {
 
95
+        TCGv_i64 tcg_rt = cpu_reg(s, rt);
 
96
+        if (is_store) {
 
97
+            do_gpr_st(s, tcg_rt, tcg_addr, size);
 
98
+        } else {
 
99
+            do_gpr_ld(s, tcg_rt, tcg_addr, size, is_signed, is_extended);
 
100
+        }
 
101
+    }
 
102
+}
 
103
+
 
104
 /* Load/store register (all forms) */
 
105
 static void disas_ldst_reg(DisasContext *s, uint32_t insn)
 
106
 {
 
107
-    unsupported_encoding(s, insn);
 
108
+    switch (extract32(insn, 24, 2)) {
 
109
+    case 0:
 
110
+        unsupported_encoding(s, insn);
 
111
+        break;
 
112
+    case 1:
 
113
+        disas_ldst_reg_unsigned_imm(s, insn);
 
114
+        break;
 
115
+    default:
 
116
+        unallocated_encoding(s);
 
117
+        break;
 
118
+    }
 
119
 }
 
120
 
 
121
 /* AdvSIMD load/store multiple structures */
 
122
-- 
 
123
1.9.rc1
 
124