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

« back to all changes in this revision

Viewing changes to debian/patches/arm64/0045-target-arm-A64-add-support-for-bitfield-insns.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 d3b0b46e22de9f2b8855232d792c4e8568016205 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 45/49] target-arm: A64: add support for bitfield insns
5
 
 
6
 
This patch implements the C3.4.2 Bitfield instructions:
7
 
SBFM, BFM, UBFM.
8
 
 
9
 
Signed-off-by: Claudio Fontana <claudio.fontana@linaro.org>
10
 
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
 
Reviewed-by: Richard Henderson <rth@twiddle.net>
12
 
---
13
 
 target-arm/translate-a64.c | 56 ++++++++++++++++++++++++++++++++++++++++++++--
14
 
 1 file changed, 54 insertions(+), 2 deletions(-)
15
 
 
16
 
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
17
 
index 3c702a9..2111bcd 100644
18
 
--- a/target-arm/translate-a64.c
19
 
+++ b/target-arm/translate-a64.c
20
 
@@ -698,10 +698,62 @@ static void disas_movw_imm(DisasContext *s, uint32_t insn)
21
 
     unsupported_encoding(s, insn);
22
 
 }
23
 
 
24
 
-/* Bitfield */
25
 
+/* C3.4.2 Bitfield
26
 
+ *   31  30 29 28         23 22  21  16 15  10 9    5 4    0
27
 
+ * +----+-----+-------------+---+------+------+------+------+
28
 
+ * | sf | opc | 1 0 0 1 1 0 | N | immr | imms |  Rn  |  Rd  |
29
 
+ * +----+-----+-------------+---+------+------+------+------+
30
 
+ */
31
 
 static void disas_bitfield(DisasContext *s, uint32_t insn)
32
 
 {
33
 
-    unsupported_encoding(s, insn);
34
 
+    unsigned int sf, n, opc, ri, si, rn, rd, bitsize, pos, len;
35
 
+    TCGv_i64 tcg_rd, tcg_tmp;
36
 
+
37
 
+    sf = extract32(insn, 31, 1);
38
 
+    opc = extract32(insn, 29, 2);
39
 
+    n = extract32(insn, 22, 1);
40
 
+    ri = extract32(insn, 16, 6);
41
 
+    si = extract32(insn, 10, 6);
42
 
+    rn = extract32(insn, 5, 5);
43
 
+    rd = extract32(insn, 0, 5);
44
 
+    bitsize = sf ? 64 : 32;
45
 
+
46
 
+    if (sf != n || ri >= bitsize || si >= bitsize || opc > 2) {
47
 
+        unallocated_encoding(s);
48
 
+        return;
49
 
+    }
50
 
+
51
 
+    tcg_rd = cpu_reg(s, rd);
52
 
+    tcg_tmp = read_cpu_reg(s, rn, sf);
53
 
+
54
 
+    /* OPTME: probably worth recognizing common cases of ext{8,16,32}{u,s} */
55
 
+
56
 
+    if (opc != 1) { /* SBFM or UBFM */
57
 
+        tcg_gen_movi_i64(tcg_rd, 0);
58
 
+    }
59
 
+
60
 
+    /* do the bit move operation */
61
 
+    if (si >= ri) {
62
 
+        /* Wd<s-r:0> = Wn<s:r> */
63
 
+        tcg_gen_shri_i64(tcg_tmp, tcg_tmp, ri);
64
 
+        pos = 0;
65
 
+        len = (si - ri) + 1;
66
 
+    } else {
67
 
+        /* Wd<32+s-r,32-r> = Wn<s:0> */
68
 
+        pos = bitsize - ri;
69
 
+        len = si + 1;
70
 
+    }
71
 
+
72
 
+    tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, pos, len);
73
 
+
74
 
+    if (opc == 0) { /* SBFM - sign extend the destination field */
75
 
+        tcg_gen_shli_i64(tcg_rd, tcg_rd, 64 - (pos + len));
76
 
+        tcg_gen_sari_i64(tcg_rd, tcg_rd, 64 - (pos + len));
77
 
+    }
78
 
+
79
 
+    if (!sf) { /* zero extend final result */
80
 
+        tcg_gen_ext32u_i64(tcg_rd, tcg_rd);
81
 
+    }
82
 
 }
83
 
 
84
 
 /* C3.4.3 Extract
85
 
1.8.5.2
86