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

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu/arm64/0047-target-arm-A64-add-support-for-1-src-CLS-insn.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 3716264c13b3ce89232862da1a86ae2d313cccce 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 47/49] target-arm: A64: add support for 1-src CLS insn
 
5
 
 
6
this patch adds support for the CLS instruction.
 
7
 
 
8
Signed-off-by: Claudio Fontana <claudio.fontana@linaro.org>
 
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
 
10
Reviewed-by: Richard Henderson <rth@twiddle.net>
 
11
---
 
12
 target-arm/helper-a64.c    | 10 ++++++++++
 
13
 target-arm/helper-a64.h    |  2 ++
 
14
 target-arm/translate-a64.c | 20 +++++++++++++++++++-
 
15
 3 files changed, 31 insertions(+), 1 deletion(-)
 
16
 
 
17
diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
 
18
index cccaac6..d3f7067 100644
 
19
--- a/target-arm/helper-a64.c
 
20
+++ b/target-arm/helper-a64.c
 
21
@@ -50,6 +50,16 @@ uint64_t HELPER(clz64)(uint64_t x)
 
22
     return clz64(x);
 
23
 }
 
24
 
 
25
+uint64_t HELPER(cls64)(uint64_t x)
 
26
+{
 
27
+    return clrsb64(x);
 
28
+}
 
29
+
 
30
+uint32_t HELPER(cls32)(uint32_t x)
 
31
+{
 
32
+    return clrsb32(x);
 
33
+}
 
34
+
 
35
 uint64_t HELPER(rbit64)(uint64_t x)
 
36
 {
 
37
     /* assign the correct byte position */
 
38
diff --git a/target-arm/helper-a64.h b/target-arm/helper-a64.h
 
39
index 9959139..a163a94 100644
 
40
--- a/target-arm/helper-a64.h
 
41
+++ b/target-arm/helper-a64.h
 
42
@@ -19,4 +19,6 @@
 
43
 DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 
44
 DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 
45
 DEF_HELPER_FLAGS_1(clz64, TCG_CALL_NO_RWG_SE, i64, i64)
 
46
+DEF_HELPER_FLAGS_1(cls64, TCG_CALL_NO_RWG_SE, i64, i64)
 
47
+DEF_HELPER_FLAGS_1(cls32, TCG_CALL_NO_RWG_SE, i32, i32)
 
48
 DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64)
 
49
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
 
50
index 2111bcd..2bb1795 100644
 
51
--- a/target-arm/translate-a64.c
 
52
+++ b/target-arm/translate-a64.c
 
53
@@ -1114,6 +1114,24 @@ static void handle_clz(DisasContext *s, unsigned int sf,
 
54
     }
 
55
 }
 
56
 
 
57
+static void handle_cls(DisasContext *s, unsigned int sf,
 
58
+                       unsigned int rn, unsigned int rd)
 
59
+{
 
60
+    TCGv_i64 tcg_rd, tcg_rn;
 
61
+    tcg_rd = cpu_reg(s, rd);
 
62
+    tcg_rn = cpu_reg(s, rn);
 
63
+
 
64
+    if (sf) {
 
65
+        gen_helper_cls64(tcg_rd, tcg_rn);
 
66
+    } else {
 
67
+        TCGv_i32 tcg_tmp32 = tcg_temp_new_i32();
 
68
+        tcg_gen_trunc_i64_i32(tcg_tmp32, tcg_rn);
 
69
+        gen_helper_cls32(tcg_tmp32, tcg_tmp32);
 
70
+        tcg_gen_extu_i32_i64(tcg_rd, tcg_tmp32);
 
71
+        tcg_temp_free_i32(tcg_tmp32);
 
72
+    }
 
73
+}
 
74
+
 
75
 static void handle_rbit(DisasContext *s, unsigned int sf,
 
76
                         unsigned int rn, unsigned int rd)
 
77
 {
 
78
@@ -1236,7 +1254,7 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn)
 
79
         handle_clz(s, sf, rn, rd);
 
80
         break;
 
81
     case 5: /* CLS */
 
82
-        unsupported_encoding(s, insn);
 
83
+        handle_cls(s, sf, rn, rd);
 
84
         break;
 
85
     }
 
86
 }
 
87
-- 
 
88
1.8.5.2
 
89