From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [PATCH 3/4] S390: Add vector register support to gdbserver
Date: Wed, 25 Feb 2015 09:44:00 -0000 [thread overview]
Message-ID: <1424857321-20322-4-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1424857321-20322-1-git-send-email-arnez@linux.vnet.ibm.com>
On S/390 targets with vector registers, enable gdbserver to advertise
and handle the feature "org.gnu.gdb.s390.vx".
gdb/gdbserver/ChangeLog:
* Makefile.in (s390-vx-linux64.c, s390-tevx-linux64.c)
(s390x-vx-linux64.c, s390x-tevx-linux64.c): New rules.
(clean): Add "rm -f" for above C files.
* configure.srv (srv_regobj): Add s390-vx-linux64.o,
s390-tevx-linux64.o, s390x-vx-linux64.o, and s390x-tevx-linux64.o.
(srv_xmlfiles): Add s390-vx-linux64.xml, s390-tevx-linux64.xml,
s390x-vx-linux64.xml, s390x-tevx-linux64.xml, and s390-vx.xml.
* linux-s390-low.c (HWCAP_S390_VX): New macro.
(init_registers_s390_vx_linux64, init_registers_s390_tevx_linux64)
(init_registers_s390x_vx_linux64)
(init_registers_s390x_tevx_linux64)
(tdesc_s390_vx_linux64, tdesc_s390_tevx_linux64)
(tdesc_s390x_vx_linux64, tdesc_s390x_tevx_linux64): New extern
declarations.
(s390_fill_vxrs_low, s390_store_vxrs_low, s390_fill_vxrs_high)
(s390_store_vxrs_high): New functions.
(s390_regsets): Add entries for NT_S390_VXRS_LOW and
NT_S390_VXRS_HIGH.
(s390_arch_setup): Add logic for selecting one of the new target
descriptions. Activate the new vector regsets if applicable.
(initialize_low_arch): Also invoke init_registers_s390_vx_linux64,
init_registers_s390_tevx_linux64, init_registers_s390x_vx_linux64,
and init_registers_s390x_tevx_linux64.
---
gdb/gdbserver/Makefile.in | 12 +++++-
gdb/gdbserver/configure.srv | 9 ++++
gdb/gdbserver/linux-s390-low.c | 94 ++++++++++++++++++++++++++++++++++++++++--
3 files changed, 111 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e479c7c..2edfdf9 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -358,7 +358,9 @@ clean:
rm -f s390-linux32.c s390-linux64.c s390x-linux64.c
rm -f s390-linux32v1.c s390-linux32v2.c s390-linux64v1.c
rm -f s390-linux64v2.c s390x-linux64v1.c s390x-linux64v2.c
- rm -f s390-te-linux32.c s390-te-linux64.c
+ rm -f s390-te-linux64.c s390x-te-linux64.c
+ rm -f s390-vx-linux64.c s390x-vx-linux64.c
+ rm -f s390-tevx-linux64.c s390x-tevx-linux64.c
rm -f tic6x-c64xp-linux.c tic6x-c64x-linux.c tic6x-c62x-linux.c
rm -f xml-builtin.c stamp-xml
rm -f i386-avx.c i386-avx-linux.c
@@ -701,6 +703,10 @@ s390-linux64v2.c : $(srcdir)/../regformats/s390-linux64v2.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-linux64v2.dat s390-linux64v2.c
s390-te-linux64.c : $(srcdir)/../regformats/s390-te-linux64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-te-linux64.dat s390-te-linux64.c
+s390-vx-linux64.c : $(srcdir)/../regformats/s390-vx-linux64.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-vx-linux64.dat s390-vx-linux64.c
+s390-tevx-linux64.c : $(srcdir)/../regformats/s390-tevx-linux64.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-tevx-linux64.dat s390-tevx-linux64.c
s390x-linux64.c : $(srcdir)/../regformats/s390x-linux64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-linux64.dat s390x-linux64.c
s390x-linux64v1.c : $(srcdir)/../regformats/s390x-linux64v1.dat $(regdat_sh)
@@ -709,6 +715,10 @@ s390x-linux64v2.c : $(srcdir)/../regformats/s390x-linux64v2.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-linux64v2.dat s390x-linux64v2.c
s390x-te-linux64.c : $(srcdir)/../regformats/s390x-te-linux64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-te-linux64.dat s390x-te-linux64.c
+s390x-vx-linux64.c : $(srcdir)/../regformats/s390x-vx-linux64.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-vx-linux64.dat s390x-vx-linux64.c
+s390x-tevx-linux64.c : $(srcdir)/../regformats/s390x-tevx-linux64.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-tevx-linux64.dat s390x-tevx-linux64.c
tic6x-c64xp-linux.c : $(srcdir)/../regformats/tic6x-c64xp-linux.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/tic6x-c64xp-linux.dat tic6x-c64xp-linux.c
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 127786e..98dd0d9 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -260,10 +260,14 @@ case "${target}" in
srv_regobj="${srv_regobj} s390-linux64v1.o"
srv_regobj="${srv_regobj} s390-linux64v2.o"
srv_regobj="${srv_regobj} s390-te-linux64.o"
+ srv_regobj="${srv_regobj} s390-vx-linux64.o"
+ srv_regobj="${srv_regobj} s390-tevx-linux64.o"
srv_regobj="${srv_regobj} s390x-linux64.o"
srv_regobj="${srv_regobj} s390x-linux64v1.o"
srv_regobj="${srv_regobj} s390x-linux64v2.o"
srv_regobj="${srv_regobj} s390x-te-linux64.o"
+ srv_regobj="${srv_regobj} s390x-vx-linux64.o"
+ srv_regobj="${srv_regobj} s390x-tevx-linux64.o"
srv_tgtobj="$srv_linux_obj linux-s390-low.o"
srv_xmlfiles="s390-linux32.xml"
srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
@@ -272,16 +276,21 @@ case "${target}" in
srv_xmlfiles="${srv_xmlfiles} s390-linux64v1.xml"
srv_xmlfiles="${srv_xmlfiles} s390-linux64v2.xml"
srv_xmlfiles="${srv_xmlfiles} s390-te-linux64.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390-vx-linux64.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390-tevx-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-linux64v1.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-linux64v2.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-te-linux64.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390x-vx-linux64.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390x-tevx-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390-core32.xml"
srv_xmlfiles="${srv_xmlfiles} s390-core64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-core64.xml"
srv_xmlfiles="${srv_xmlfiles} s390-acr.xml"
srv_xmlfiles="${srv_xmlfiles} s390-fpr.xml"
srv_xmlfiles="${srv_xmlfiles} s390-tdb.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390-vx.xml"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index b9631bf..afee1ff 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -36,6 +36,10 @@
#define HWCAP_S390_TE 1024
#endif
+#ifndef HWCAP_S390_VX
+#define HWCAP_S390_VX 2048
+#endif
+
#ifndef PTRACE_GETREGSET
#define PTRACE_GETREGSET 0x4204
#endif
@@ -72,6 +76,14 @@ extern const struct target_desc *tdesc_s390_linux64v2;
void init_registers_s390_te_linux64 (void);
extern const struct target_desc *tdesc_s390_te_linux64;
+/* Defined in auto-generated file s390-vx-linux64.c. */
+void init_registers_s390_vx_linux64 (void);
+extern const struct target_desc *tdesc_s390_vx_linux64;
+
+/* Defined in auto-generated file s390-tevx-linux64.c. */
+void init_registers_s390_tevx_linux64 (void);
+extern const struct target_desc *tdesc_s390_tevx_linux64;
+
/* Defined in auto-generated file s390x-linux64.c. */
void init_registers_s390x_linux64 (void);
extern const struct target_desc *tdesc_s390x_linux64;
@@ -88,6 +100,14 @@ extern const struct target_desc *tdesc_s390x_linux64v2;
void init_registers_s390x_te_linux64 (void);
extern const struct target_desc *tdesc_s390x_te_linux64;
+/* Defined in auto-generated file s390x-vx-linux64.c. */
+void init_registers_s390x_vx_linux64 (void);
+extern const struct target_desc *tdesc_s390x_vx_linux64;
+
+/* Defined in auto-generated file s390x-tevx-linux64.c. */
+void init_registers_s390x_tevx_linux64 (void);
+extern const struct target_desc *tdesc_s390x_tevx_linux64;
+
#define s390_num_regs 52
static int s390_regmap[] = {
@@ -324,6 +344,46 @@ s390_store_tdb (struct regcache *regcache, const void *buf)
supply_register (regcache, tr0 + i, (const char *) buf + 8 * (16 + i));
}
+static void
+s390_fill_vxrs_low (struct regcache *regcache, void *buf)
+{
+ int v0 = find_regno (regcache->tdesc, "v0l");
+ int i;
+
+ for (i = 0; i < 16; i++)
+ collect_register (regcache, v0 + i, (char *) buf + 8 * i);
+}
+
+static void
+s390_store_vxrs_low (struct regcache *regcache, const void *buf)
+{
+ int v0 = find_regno (regcache->tdesc, "v0l");
+ int i;
+
+ for (i = 0; i < 16; i++)
+ supply_register (regcache, v0 + i, (const char *) buf + 8 * i);
+}
+
+static void
+s390_fill_vxrs_high (struct regcache *regcache, void *buf)
+{
+ int v16 = find_regno (regcache->tdesc, "v16");
+ int i;
+
+ for (i = 0; i < 16; i++)
+ collect_register (regcache, v16 + i, (char *) buf + 16 * i);
+}
+
+static void
+s390_store_vxrs_high (struct regcache *regcache, const void *buf)
+{
+ int v16 = find_regno (regcache->tdesc, "v16");
+ int i;
+
+ for (i = 0; i < 16; i++)
+ supply_register (regcache, v16 + i, (const char *) buf + 16 * i);
+}
+
static struct regset_info s390_regsets[] = {
{ 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
/* Last break address is read-only; no fill function. */
@@ -334,6 +394,10 @@ static struct regset_info s390_regsets[] = {
/* TDB is read-only. */
{ PTRACE_GETREGSET, -1, NT_S390_TDB, 0, EXTENDED_REGS,
NULL, s390_store_tdb },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_LOW, 0,
+ EXTENDED_REGS, s390_fill_vxrs_low, s390_store_vxrs_low },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_HIGH, 0,
+ EXTENDED_REGS, s390_fill_vxrs_high, s390_store_vxrs_high },
{ 0, 0, 0, -1, -1, NULL, NULL }
};
@@ -439,6 +503,8 @@ s390_arch_setup (void)
int have_regset_system_call
= s390_check_regset (pid, NT_S390_SYSTEM_CALL, 4);
int have_regset_tdb = s390_check_regset (pid, NT_S390_TDB, 256);
+ int have_regset_vxrs = s390_check_regset (pid, NT_S390_VXRS_LOW, 128)
+ && s390_check_regset (pid, NT_S390_VXRS_HIGH, 256);
/* Assume 31-bit inferior process. */
if (have_regset_system_call)
@@ -464,8 +530,14 @@ s390_arch_setup (void)
if (have_regset_tdb)
have_regset_tdb =
(s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_TE) != 0;
-
- if (have_regset_tdb)
+ if (have_regset_vxrs)
+ have_regset_vxrs =
+ (s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_VX) != 0;
+
+ if (have_regset_vxrs)
+ tdesc = (have_regset_tdb ? tdesc_s390x_tevx_linux64 :
+ tdesc_s390x_vx_linux64);
+ else if (have_regset_tdb)
tdesc = tdesc_s390x_te_linux64;
else if (have_regset_system_call)
tdesc = tdesc_s390x_linux64v2;
@@ -482,8 +554,13 @@ s390_arch_setup (void)
have_hwcap_s390_high_gprs = 1;
if (have_regset_tdb)
have_regset_tdb = (s390_get_hwcap (tdesc) & HWCAP_S390_TE) != 0;
+ if (have_regset_vxrs)
+ have_regset_vxrs = (s390_get_hwcap (tdesc) & HWCAP_S390_VX) != 0;
- if (have_regset_tdb)
+ if (have_regset_vxrs)
+ tdesc = (have_regset_tdb ? tdesc_s390_tevx_linux64 :
+ tdesc_s390_vx_linux64);
+ else if (have_regset_tdb)
tdesc = tdesc_s390_te_linux64;
else if (have_regset_system_call)
tdesc = tdesc_s390_linux64v2;
@@ -508,6 +585,13 @@ s390_arch_setup (void)
break;
case NT_S390_TDB:
regset->size = have_regset_tdb ? 256 : 0;
+ break;
+ case NT_S390_VXRS_LOW:
+ regset->size = have_regset_vxrs ? 128 : 0;
+ break;
+ case NT_S390_VXRS_HIGH:
+ regset->size = have_regset_vxrs ? 256 : 0;
+ break;
default:
break;
}
@@ -615,10 +699,14 @@ initialize_low_arch (void)
init_registers_s390_linux64v1 ();
init_registers_s390_linux64v2 ();
init_registers_s390_te_linux64 ();
+ init_registers_s390_vx_linux64 ();
+ init_registers_s390_tevx_linux64 ();
init_registers_s390x_linux64 ();
init_registers_s390x_linux64v1 ();
init_registers_s390x_linux64v2 ();
init_registers_s390x_te_linux64 ();
+ init_registers_s390x_vx_linux64 ();
+ init_registers_s390x_tevx_linux64 ();
initialize_regsets_info (&s390_regsets_info);
#ifdef __s390x__
--
1.9.3
next prev parent reply other threads:[~2015-02-25 9:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 9:42 [PATCH 0/4] S390: Vector register support Andreas Arnez
2015-02-25 9:42 ` [PATCH 1/4] S390: Add target descriptions for vector register sets Andreas Arnez
2015-02-25 15:58 ` Eli Zaretskii
2015-02-25 9:43 ` [PATCH 2/4] S390: Add vector register support to gdb Andreas Arnez
2015-02-25 15:58 ` Eli Zaretskii
2015-02-25 9:44 ` [PATCH 4/4] S390: Vector register test case Andreas Arnez
2015-02-25 9:44 ` Andreas Arnez [this message]
2015-02-27 20:43 ` [PATCH 0/4] S390: Vector register support Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424857321-20322-4-git-send-email-arnez@linux.vnet.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox