~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to debian/patches/arm64/0042-target-arm-A64-add-support-for-1-src-data-processing.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-02-04 12:13:08 UTC
  • mfrom: (10.1.45 sid)
  • Revision ID: package-import@ubuntu.com-20140204121308-1xq92lrfs75agw2g
Tags: 1.7.0+dfsg-3ubuntu1~ppa1
* Merge 1.7.0+dfsg-3 from debian.  Remaining changes:
  - debian/patches/ubuntu:
    * expose-vmx_qemu64cpu.patch
    * linaro (omap3) and arm64 patches
    * ubuntu/target-ppc-add-stubs-for-kvm-breakpoints: fix FTBFS
      on ppc
    * ubuntu/CVE-2013-4377.patch: fix denial of service via virtio
  - debian/qemu-system-x86.modprobe: set kvm_intel nested=1 options
  - debian/control:
    * add arm64 to Architectures
    * add qemu-common and qemu-system-aarch64 packages
  - debian/qemu-system-common.install: add debian/tmp/usr/lib
  - debian/qemu-system-common.preinst: add kvm group
  - debian/qemu-system-common.postinst: remove acl placed by udev,
    and add udevadm trigger.
  - qemu-system-x86.links: add eepro100.rom, remove pxe-virtio,
    pxe-e1000 and pxe-rtl8139.
  - add qemu-system-x86.qemu-kvm.upstart and .default
  - qemu-user-static.postinst-in: remove arm64 binfmt
  - debian/rules:
    * allow parallel build
    * add aarch64 to system_targets and sys_systems
    * add qemu-kvm-spice links
    * install qemu-system-x86.modprobe
  - add debian/qemu-system-common.links for OVMF.fd link
* Remove kvm-img, kvm-nbd, kvm-ifup and kvm-ifdown symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 3b99d6442034bd674560ff92aa173bdc8a3d3aa9 Mon Sep 17 00:00:00 2001
2
 
From: Claudio Fontana <claudio.fontana@linaro.org>
3
 
Date: Tue, 17 Dec 2013 19:42:35 +0000
4
 
Subject: [PATCH 42/49] target-arm: A64: add support for 1-src data processing
5
 
 and CLZ
6
 
 
7
 
This patch adds support for decoding 1-src data processing insns,
8
 
and the first user, C5.6.40 CLZ (count leading zeroes).
9
 
 
10
 
Signed-off-by: Claudio Fontana <claudio.fontana@linaro.org>
11
 
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
 
Reviewed-by: Richard Henderson <rth@twiddle.net>
13
 
---
14
 
 target-arm/helper-a64.c    |  5 +++++
15
 
 target-arm/helper-a64.h    |  1 +
16
 
 target-arm/translate-a64.c | 52 ++++++++++++++++++++++++++++++++++++++++++++--
17
 
 3 files changed, 56 insertions(+), 2 deletions(-)
18
 
 
19
 
diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
20
 
index abb98c0..e4c5346 100644
21
 
--- a/target-arm/helper-a64.c
22
 
+++ b/target-arm/helper-a64.c
23
 
@@ -44,3 +44,8 @@ int64_t HELPER(sdiv64)(int64_t num, int64_t den)
24
 
     }
25
 
     return num / den;
26
 
 }
27
 
+
28
 
+uint64_t HELPER(clz64)(uint64_t x)
29
 
+{
30
 
+    return clz64(x);
31
 
+}
32
 
diff --git a/target-arm/helper-a64.h b/target-arm/helper-a64.h
33
 
index e0d6506..b10b6c3 100644
34
 
--- a/target-arm/helper-a64.h
35
 
+++ b/target-arm/helper-a64.h
36
 
@@ -18,3 +18,4 @@
37
 
  */
38
 
 DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
39
 
 DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
40
 
+DEF_HELPER_FLAGS_1(clz64, TCG_CALL_NO_RWG_SE, i64, i64)
41
 
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
42
 
index acf30c3..e5481da 100644
43
 
--- a/target-arm/translate-a64.c
44
 
+++ b/target-arm/translate-a64.c
45
 
@@ -1044,10 +1044,58 @@ static void disas_cond_select(DisasContext *s, uint32_t insn)
46
 
     }
47
 
 }
48
 
 
49
 
-/* Data-processing (1 source) */
50
 
+static void handle_clz(DisasContext *s, unsigned int sf,
51
 
+                       unsigned int rn, unsigned int rd)
52
 
+{
53
 
+    TCGv_i64 tcg_rd, tcg_rn;
54
 
+    tcg_rd = cpu_reg(s, rd);
55
 
+    tcg_rn = cpu_reg(s, rn);
56
 
+
57
 
+    if (sf) {
58
 
+        gen_helper_clz64(tcg_rd, tcg_rn);
59
 
+    } else {
60
 
+        TCGv_i32 tcg_tmp32 = tcg_temp_new_i32();
61
 
+        tcg_gen_trunc_i64_i32(tcg_tmp32, tcg_rn);
62
 
+        gen_helper_clz(tcg_tmp32, tcg_tmp32);
63
 
+        tcg_gen_extu_i32_i64(tcg_rd, tcg_tmp32);
64
 
+        tcg_temp_free_i32(tcg_tmp32);
65
 
+    }
66
 
+}
67
 
+
68
 
+/* C3.5.7 Data-processing (1 source)
69
 
+ *   31  30  29  28             21 20     16 15    10 9    5 4    0
70
 
+ * +----+---+---+-----------------+---------+--------+------+------+
71
 
+ * | sf | 1 | S | 1 1 0 1 0 1 1 0 | opcode2 | opcode |  Rn  |  Rd  |
72
 
+ * +----+---+---+-----------------+---------+--------+------+------+
73
 
+ */
74
 
 static void disas_data_proc_1src(DisasContext *s, uint32_t insn)
75
 
 {
76
 
-    unsupported_encoding(s, insn);
77
 
+    unsigned int sf, opcode, rn, rd;
78
 
+
79
 
+    if (extract32(insn, 29, 1) || extract32(insn, 16, 5)) {
80
 
+        unallocated_encoding(s);
81
 
+        return;
82
 
+    }
83
 
+
84
 
+    sf = extract32(insn, 31, 1);
85
 
+    opcode = extract32(insn, 10, 6);
86
 
+    rn = extract32(insn, 5, 5);
87
 
+    rd = extract32(insn, 0, 5);
88
 
+
89
 
+    switch (opcode) {
90
 
+    case 0: /* RBIT */
91
 
+    case 1: /* REV16 */
92
 
+    case 2: /* REV32 */
93
 
+    case 3: /* REV64 */
94
 
+        unsupported_encoding(s, insn);
95
 
+        break;
96
 
+    case 4: /* CLZ */
97
 
+        handle_clz(s, sf, rn, rd);
98
 
+        break;
99
 
+    case 5: /* CLS */
100
 
+        unsupported_encoding(s, insn);
101
 
+        break;
102
 
+    }
103
 
 }
104
 
 
105
 
 static void handle_div(DisasContext *s, bool is_signed, unsigned int sf,
106
 
1.8.5.2
107