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

« back to all changes in this revision

Viewing changes to debian/patches/arm64/0030-target-arm-A64-expand-decoding-skeleton-for-system-i.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 cf438b58cfd4725a14cb1daa7eceabf703f62dbb Mon Sep 17 00:00:00 2001
2
 
From: Claudio Fontana <claudio.fontana@linaro.org>
3
 
Date: Tue, 17 Dec 2013 19:42:32 +0000
4
 
Subject: [PATCH 30/49] target-arm: A64: expand decoding skeleton for system
5
 
 instructions
6
 
 
7
 
Decode the various kinds of system instructions:
8
 
 hints (HINT), which include NOP, YIELD, WFE, WFI, SEV, SEL
9
 
 sync instructions, which include CLREX, DSB, DMB, ISB
10
 
 msr_i, which move immediate to processor state field
11
 
 sys, which include all SYS and SYSL instructions
12
 
 msr, which move from a gp register to a system register
13
 
 mrs, which move from a system register to a gp register
14
 
 
15
 
Provide implementations where they are trivial nops.
16
 
 
17
 
Signed-off-by: Claudio Fontana <claudio.fontana@linaro.org>
18
 
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
 
Reviewed-by: Richard Henderson <rth@twiddle.net>
20
 
---
21
 
 target-arm/translate-a64.c | 131 ++++++++++++++++++++++++++++++++++++++++++++-
22
 
 1 file changed, 129 insertions(+), 2 deletions(-)
23
 
 
24
 
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
25
 
index 8e16cb1..1e2b371 100644
26
 
--- a/target-arm/translate-a64.c
27
 
+++ b/target-arm/translate-a64.c
28
 
@@ -190,12 +190,139 @@ static void disas_cond_b_imm(DisasContext *s, uint32_t insn)
29
 
     unsupported_encoding(s, insn);
30
 
 }
31
 
 
32
 
-/* System */
33
 
-static void disas_system(DisasContext *s, uint32_t insn)
34
 
+/* C5.6.68 HINT */
35
 
+static void handle_hint(DisasContext *s, uint32_t insn,
36
 
+                        unsigned int op1, unsigned int op2, unsigned int crm)
37
 
+{
38
 
+    unsigned int selector = crm << 3 | op2;
39
 
+
40
 
+    if (op1 != 3) {
41
 
+        unallocated_encoding(s);
42
 
+        return;
43
 
+    }
44
 
+
45
 
+    switch (selector) {
46
 
+    case 0: /* NOP */
47
 
+        return;
48
 
+    case 1: /* YIELD */
49
 
+    case 2: /* WFE */
50
 
+    case 3: /* WFI */
51
 
+    case 4: /* SEV */
52
 
+    case 5: /* SEVL */
53
 
+        /* we treat all as NOP at least for now */
54
 
+        return;
55
 
+    default:
56
 
+        /* default specified as NOP equivalent */
57
 
+        return;
58
 
+    }
59
 
+}
60
 
+
61
 
+/* CLREX, DSB, DMB, ISB */
62
 
+static void handle_sync(DisasContext *s, uint32_t insn,
63
 
+                        unsigned int op1, unsigned int op2, unsigned int crm)
64
 
+{
65
 
+    if (op1 != 3) {
66
 
+        unallocated_encoding(s);
67
 
+        return;
68
 
+    }
69
 
+
70
 
+    switch (op2) {
71
 
+    case 2: /* CLREX */
72
 
+        unsupported_encoding(s, insn);
73
 
+        return;
74
 
+    case 4: /* DSB */
75
 
+    case 5: /* DMB */
76
 
+    case 6: /* ISB */
77
 
+        /* We don't emulate caches so barriers are no-ops */
78
 
+        return;
79
 
+    default:
80
 
+        unallocated_encoding(s);
81
 
+        return;
82
 
+    }
83
 
+}
84
 
+
85
 
+/* C5.6.130 MSR (immediate) - move immediate to processor state field */
86
 
+static void handle_msr_i(DisasContext *s, uint32_t insn,
87
 
+                         unsigned int op1, unsigned int op2, unsigned int crm)
88
 
 {
89
 
     unsupported_encoding(s, insn);
90
 
 }
91
 
 
92
 
+/* C5.6.204 SYS */
93
 
+static void handle_sys(DisasContext *s, uint32_t insn, unsigned int l,
94
 
+                       unsigned int op1, unsigned int op2,
95
 
+                       unsigned int crn, unsigned int crm, unsigned int rt)
96
 
+{
97
 
+    unsupported_encoding(s, insn);
98
 
+}
99
 
+
100
 
+/* C5.6.129 MRS - move from system register */
101
 
+static void handle_mrs(DisasContext *s, uint32_t insn, unsigned int op0,
102
 
+                       unsigned int op1, unsigned int op2,
103
 
+                       unsigned int crn, unsigned int crm, unsigned int rt)
104
 
+{
105
 
+    unsupported_encoding(s, insn);
106
 
+}
107
 
+
108
 
+/* C5.6.131 MSR (register) - move to system register */
109
 
+static void handle_msr(DisasContext *s, uint32_t insn, unsigned int op0,
110
 
+                       unsigned int op1, unsigned int op2,
111
 
+                       unsigned int crn, unsigned int crm, unsigned int rt)
112
 
+{
113
 
+    unsupported_encoding(s, insn);
114
 
+}
115
 
+
116
 
+/* C3.2.4 System
117
 
+ *  31                 22 21  20 19 18 16 15   12 11    8 7   5 4    0
118
 
+ * +---------------------+---+-----+-----+-------+-------+-----+------+
119
 
+ * | 1 1 0 1 0 1 0 1 0 0 | L | op0 | op1 |  CRn  |  CRm  | op2 |  Rt  |
120
 
+ * +---------------------+---+-----+-----+-------+-------+-----+------+
121
 
+ */
122
 
+static void disas_system(DisasContext *s, uint32_t insn)
123
 
+{
124
 
+    unsigned int l, op0, op1, crn, crm, op2, rt;
125
 
+    l = extract32(insn, 21, 1);
126
 
+    op0 = extract32(insn, 19, 2);
127
 
+    op1 = extract32(insn, 16, 3);
128
 
+    crn = extract32(insn, 12, 4);
129
 
+    crm = extract32(insn, 8, 4);
130
 
+    op2 = extract32(insn, 5, 3);
131
 
+    rt = extract32(insn, 0, 5);
132
 
+
133
 
+    if (op0 == 0) {
134
 
+        if (l || rt != 31) {
135
 
+            unallocated_encoding(s);
136
 
+            return;
137
 
+        }
138
 
+        switch (crn) {
139
 
+        case 2: /* C5.6.68 HINT */
140
 
+            handle_hint(s, insn, op1, op2, crm);
141
 
+            break;
142
 
+        case 3: /* CLREX, DSB, DMB, ISB */
143
 
+            handle_sync(s, insn, op1, op2, crm);
144
 
+            break;
145
 
+        case 4: /* C5.6.130 MSR (immediate) */
146
 
+            handle_msr_i(s, insn, op1, op2, crm);
147
 
+            break;
148
 
+        default:
149
 
+            unallocated_encoding(s);
150
 
+            break;
151
 
+        }
152
 
+        return;
153
 
+    }
154
 
+
155
 
+    if (op0 == 1) {
156
 
+        /* C5.6.204 SYS */
157
 
+        handle_sys(s, insn, l, op1, op2, crn, crm, rt);
158
 
+    } else if (l) { /* op0 > 1 */
159
 
+        /* C5.6.129 MRS - move from system register */
160
 
+        handle_mrs(s, insn, op0, op1, op2, crn, crm, rt);
161
 
+    } else {
162
 
+        /* C5.6.131 MSR (register) - move to system register */
163
 
+        handle_msr(s, insn, op0, op1, op2, crn, crm, rt);
164
 
+    }
165
 
+}
166
 
+
167
 
 /* Exception generation */
168
 
 static void disas_exc(DisasContext *s, uint32_t insn)
169
 
 {
170
 
1.8.5.2
171