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

« back to all changes in this revision

Viewing changes to debian/patches/arm64/0027-target-arm-Support-fp-registers-in-gdb-stub.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 a55c46c1d27e0ac6e680d5088fb378dc7986a3e2 Mon Sep 17 00:00:00 2001
2
 
From: Peter Maydell <peter.maydell@linaro.org>
3
 
Date: Tue, 17 Dec 2013 19:42:32 +0000
4
 
Subject: [PATCH 27/49] target-arm: Support fp registers in gdb stub
5
 
 
6
 
Register the aarch64-fpu XML and implement the necessary
7
 
read/write handlers so we can support reading and writing
8
 
of FP registers in the gdb stub.
9
 
 
10
 
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
 
Reviewed-by: Richard Henderson <rth@twiddle.net>
12
 
---
13
 
 configure               |  2 +-
14
 
 gdb-xml/aarch64-fpu.xml | 86 +++++++++++++++++++++++++++++++++++++++++++++++++
15
 
 target-arm/helper.c     | 48 ++++++++++++++++++++++++++-
16
 
 3 files changed, 134 insertions(+), 2 deletions(-)
17
 
 create mode 100644 gdb-xml/aarch64-fpu.xml
18
 
 
19
 
diff --git a/configure b/configure
20
 
index 72432ef..76c0b8d 100755
21
 
--- a/configure
22
 
+++ b/configure
23
 
@@ -4406,7 +4406,7 @@ case "$target_name" in
24
 
   aarch64)
25
 
     TARGET_BASE_ARCH=arm
26
 
     bflt="yes"
27
 
-    gdb_xml_files="aarch64-core.xml"
28
 
+    gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
29
 
   ;;
30
 
   cris)
31
 
   ;;
32
 
diff --git a/gdb-xml/aarch64-fpu.xml b/gdb-xml/aarch64-fpu.xml
33
 
new file mode 100644
34
 
index 0000000..997197e
35
 
--- /dev/null
36
 
+++ b/gdb-xml/aarch64-fpu.xml
37
 
@@ -0,0 +1,86 @@
38
 
+<?xml version="1.0"?>
39
 
+<!-- Copyright (C) 2009-2012 Free Software Foundation, Inc.
40
 
+     Contributed by ARM Ltd.
41
 
+
42
 
+     Copying and distribution of this file, with or without modification,
43
 
+     are permitted in any medium without royalty provided the copyright
44
 
+     notice and this notice are preserved.  -->
45
 
+
46
 
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
47
 
+<feature name="org.gnu.gdb.aarch64.fpu">
48
 
+  <vector id="v2d" type="ieee_double" count="2"/>
49
 
+  <vector id="v2u" type="uint64" count="2"/>
50
 
+  <vector id="v2i" type="int64" count="2"/>
51
 
+  <vector id="v4f" type="ieee_single" count="4"/>
52
 
+  <vector id="v4u" type="uint32" count="4"/>
53
 
+  <vector id="v4i" type="int32" count="4"/>
54
 
+  <vector id="v8u" type="uint16" count="8"/>
55
 
+  <vector id="v8i" type="int16" count="8"/>
56
 
+  <vector id="v16u" type="uint8" count="16"/>
57
 
+  <vector id="v16i" type="int8" count="16"/>
58
 
+  <vector id="v1u" type="uint128" count="1"/>
59
 
+  <vector id="v1i" type="int128" count="1"/>
60
 
+  <union id="vnd">
61
 
+    <field name="f" type="v2d"/>
62
 
+    <field name="u" type="v2u"/>
63
 
+    <field name="s" type="v2i"/>
64
 
+  </union>
65
 
+  <union id="vns">
66
 
+    <field name="f" type="v4f"/>
67
 
+    <field name="u" type="v4u"/>
68
 
+    <field name="s" type="v4i"/>
69
 
+  </union>
70
 
+  <union id="vnh">
71
 
+    <field name="u" type="v8u"/>
72
 
+    <field name="s" type="v8i"/>
73
 
+  </union>
74
 
+  <union id="vnb">
75
 
+    <field name="u" type="v16u"/>
76
 
+    <field name="s" type="v16i"/>
77
 
+  </union>
78
 
+  <union id="vnq">
79
 
+    <field name="u" type="v1u"/>
80
 
+    <field name="s" type="v1i"/>
81
 
+  </union>
82
 
+  <union id="aarch64v">
83
 
+    <field name="d" type="vnd"/>
84
 
+    <field name="s" type="vns"/>
85
 
+    <field name="h" type="vnh"/>
86
 
+    <field name="b" type="vnb"/>
87
 
+    <field name="q" type="vnq"/>
88
 
+  </union>
89
 
+  <reg name="v0" bitsize="128" type="aarch64v" regnum="34"/>
90
 
+  <reg name="v1" bitsize="128" type="aarch64v" />
91
 
+  <reg name="v2" bitsize="128" type="aarch64v" />
92
 
+  <reg name="v3" bitsize="128" type="aarch64v" />
93
 
+  <reg name="v4" bitsize="128" type="aarch64v" />
94
 
+  <reg name="v5" bitsize="128" type="aarch64v" />
95
 
+  <reg name="v6" bitsize="128" type="aarch64v" />
96
 
+  <reg name="v7" bitsize="128" type="aarch64v" />
97
 
+  <reg name="v8" bitsize="128" type="aarch64v" />
98
 
+  <reg name="v9" bitsize="128" type="aarch64v" />
99
 
+  <reg name="v10" bitsize="128" type="aarch64v"/>
100
 
+  <reg name="v11" bitsize="128" type="aarch64v"/>
101
 
+  <reg name="v12" bitsize="128" type="aarch64v"/>
102
 
+  <reg name="v13" bitsize="128" type="aarch64v"/>
103
 
+  <reg name="v14" bitsize="128" type="aarch64v"/>
104
 
+  <reg name="v15" bitsize="128" type="aarch64v"/>
105
 
+  <reg name="v16" bitsize="128" type="aarch64v"/>
106
 
+  <reg name="v17" bitsize="128" type="aarch64v"/>
107
 
+  <reg name="v18" bitsize="128" type="aarch64v"/>
108
 
+  <reg name="v19" bitsize="128" type="aarch64v"/>
109
 
+  <reg name="v20" bitsize="128" type="aarch64v"/>
110
 
+  <reg name="v21" bitsize="128" type="aarch64v"/>
111
 
+  <reg name="v22" bitsize="128" type="aarch64v"/>
112
 
+  <reg name="v23" bitsize="128" type="aarch64v"/>
113
 
+  <reg name="v24" bitsize="128" type="aarch64v"/>
114
 
+  <reg name="v25" bitsize="128" type="aarch64v"/>
115
 
+  <reg name="v26" bitsize="128" type="aarch64v"/>
116
 
+  <reg name="v27" bitsize="128" type="aarch64v"/>
117
 
+  <reg name="v28" bitsize="128" type="aarch64v"/>
118
 
+  <reg name="v29" bitsize="128" type="aarch64v"/>
119
 
+  <reg name="v30" bitsize="128" type="aarch64v"/>
120
 
+  <reg name="v31" bitsize="128" type="aarch64v"/>
121
 
+  <reg name="fpsr" bitsize="32"/>
122
 
+  <reg name="fpcr" bitsize="32"/>
123
 
+</feature>
124
 
diff --git a/target-arm/helper.c b/target-arm/helper.c
125
 
index 8ec4cb1..7f8177e 100644
126
 
--- a/target-arm/helper.c
127
 
+++ b/target-arm/helper.c
128
 
@@ -65,6 +65,48 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg)
129
 
     return 0;
130
 
 }
131
 
 
132
 
+static int aarch64_fpu_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg)
133
 
+{
134
 
+    switch (reg) {
135
 
+    case 0 ... 31:
136
 
+        /* 128 bit FP register */
137
 
+        stfq_le_p(buf, env->vfp.regs[reg * 2]);
138
 
+        stfq_le_p(buf + 8, env->vfp.regs[reg * 2 + 1]);
139
 
+        return 16;
140
 
+    case 32:
141
 
+        /* FPSR */
142
 
+        stl_p(buf, vfp_get_fpsr(env));
143
 
+        return 4;
144
 
+    case 33:
145
 
+        /* FPCR */
146
 
+        stl_p(buf, vfp_get_fpcr(env));
147
 
+        return 4;
148
 
+    default:
149
 
+        return 0;
150
 
+    }
151
 
+}
152
 
+
153
 
+static int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg)
154
 
+{
155
 
+    switch (reg) {
156
 
+    case 0 ... 31:
157
 
+        /* 128 bit FP register */
158
 
+        env->vfp.regs[reg * 2] = ldfq_le_p(buf);
159
 
+        env->vfp.regs[reg * 2 + 1] = ldfq_le_p(buf + 8);
160
 
+        return 16;
161
 
+    case 32:
162
 
+        /* FPSR */
163
 
+        vfp_set_fpsr(env, ldl_p(buf));
164
 
+        return 4;
165
 
+    case 33:
166
 
+        /* FPCR */
167
 
+        vfp_set_fpcr(env, ldl_p(buf));
168
 
+        return 4;
169
 
+    default:
170
 
+        return 0;
171
 
+    }
172
 
+}
173
 
+
174
 
 static int raw_read(CPUARMState *env, const ARMCPRegInfo *ri,
175
 
                     uint64_t *value)
176
 
 {
177
 
@@ -1785,7 +1827,11 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
178
 
     CPUState *cs = CPU(cpu);
179
 
     CPUARMState *env = &cpu->env;
180
 
 
181
 
-    if (arm_feature(env, ARM_FEATURE_NEON)) {
182
 
+    if (arm_feature(env, ARM_FEATURE_AARCH64)) {
183
 
+        gdb_register_coprocessor(cs, aarch64_fpu_gdb_get_reg,
184
 
+                                 aarch64_fpu_gdb_set_reg,
185
 
+                                 34, "aarch64-fpu.xml", 0);
186
 
+    } else if (arm_feature(env, ARM_FEATURE_NEON)) {
187
 
         gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg,
188
 
                                  51, "arm-neon.xml", 0);
189
 
     } else if (arm_feature(env, ARM_FEATURE_VFP3)) {
190
 
1.8.5.2
191