|
|
7b26da |
From 6682d9595ed8d9b9bba5470bfd7fd1ccd378f19a Mon Sep 17 00:00:00 2001
|
|
|
7b26da |
From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
|
|
|
7b26da |
Date: Tue, 5 Nov 2013 18:43:50 +0100
|
|
|
7b26da |
Subject: [PATCH] S390: Fix TDB regset recognition
|
|
|
7b26da |
|
|
|
7b26da |
When checking for the presence of the TDB regset, the current code
|
|
|
7b26da |
interprets ENODATA from PTRACE_GETREGSET as an indication that the TDB
|
|
|
7b26da |
regset *could* occur on this system, but the inferior stopped outside
|
|
|
7b26da |
a transaction. However, the Linux kernel actually reports ENODATA
|
|
|
7b26da |
even on systems without the transactional execution facility. Thus
|
|
|
7b26da |
the logic is now changed to check the TE field in the HWCAP as well.
|
|
|
7b26da |
|
|
|
7b26da |
This version also checks the existence of the TDB regset -- just to be
|
|
|
7b26da |
on the safe side when running on TE-enabled hardware with a kernel
|
|
|
7b26da |
that does not offer the TDB regset for some reason.
|
|
|
7b26da |
|
|
|
7b26da |
gdb/
|
|
|
7b26da |
* s390-linux-nat.c (s390_read_description): Consider the TE field
|
|
|
7b26da |
in the HWCAP for determining 'have_regset_tdb'.
|
|
|
7b26da |
|
|
|
7b26da |
gdbserver/
|
|
|
7b26da |
* linux-s390-low.c (HWCAP_S390_TE): New define.
|
|
|
7b26da |
(s390_arch_setup): Consider the TE field in the HWCAP for
|
|
|
7b26da |
determining 'have_regset_tdb'.
|
|
|
7b26da |
---
|
|
|
7b26da |
gdb/ChangeLog | 5 +++++
|
|
|
7b26da |
gdb/gdbserver/ChangeLog | 6 ++++++
|
|
|
7b26da |
gdb/gdbserver/linux-s390-low.c | 48 ++++++++++++++++++++++++++----------------
|
|
|
7b26da |
gdb/s390-linux-nat.c | 5 +++--
|
|
|
7b26da |
4 files changed, 44 insertions(+), 20 deletions(-)
|
|
|
7b26da |
|
|
|
7b26da |
Index: gdb-7.6.1/gdb/gdbserver/linux-s390-low.c
|
|
|
7b26da |
===================================================================
|
|
|
7b26da |
--- gdb-7.6.1.orig/gdb/gdbserver/linux-s390-low.c
|
|
|
7b26da |
+++ gdb-7.6.1/gdb/gdbserver/linux-s390-low.c
|
|
|
7b26da |
@@ -32,6 +32,10 @@
|
|
|
7b26da |
#define HWCAP_S390_HIGH_GPRS 512
|
|
|
7b26da |
#endif
|
|
|
7b26da |
|
|
|
7b26da |
+#ifndef HWCAP_S390_TE
|
|
|
7b26da |
+#define HWCAP_S390_TE 1024
|
|
|
7b26da |
+#endif
|
|
|
7b26da |
+
|
|
|
7b26da |
#ifndef PTRACE_GETREGSET
|
|
|
7b26da |
#define PTRACE_GETREGSET 0x4204
|
|
|
7b26da |
#endif
|
|
|
7b26da |
@@ -390,23 +394,6 @@ s390_arch_setup (void)
|
|
|
7b26da |
= s390_check_regset (pid, NT_S390_SYSTEM_CALL, 4);
|
|
|
7b26da |
int have_regset_tdb = s390_check_regset (pid, NT_S390_TDB, 256);
|
|
|
7b26da |
|
|
|
7b26da |
- /* Update target_regsets according to available register sets. */
|
|
|
7b26da |
- for (regset = target_regsets; regset->fill_function != NULL; regset++)
|
|
|
7b26da |
- if (regset->get_request == PTRACE_GETREGSET)
|
|
|
7b26da |
- switch (regset->nt_type)
|
|
|
7b26da |
- {
|
|
|
7b26da |
- case NT_S390_LAST_BREAK:
|
|
|
7b26da |
- regset->size = have_regset_last_break? 8 : 0;
|
|
|
7b26da |
- break;
|
|
|
7b26da |
- case NT_S390_SYSTEM_CALL:
|
|
|
7b26da |
- regset->size = have_regset_system_call? 4 : 0;
|
|
|
7b26da |
- break;
|
|
|
7b26da |
- case NT_S390_TDB:
|
|
|
7b26da |
- regset->size = have_regset_tdb ? 256 : 0;
|
|
|
7b26da |
- default:
|
|
|
7b26da |
- break;
|
|
|
7b26da |
- }
|
|
|
7b26da |
-
|
|
|
7b26da |
/* Assume 31-bit inferior process. */
|
|
|
7b26da |
if (have_regset_system_call)
|
|
|
7b26da |
init_registers_s390_linux32v2 ();
|
|
|
7b26da |
@@ -424,6 +411,7 @@ s390_arch_setup (void)
|
|
|
7b26da |
{
|
|
|
7b26da |
unsigned int pswm;
|
|
|
7b26da |
struct regcache *regcache = new_register_cache ();
|
|
|
7b26da |
+
|
|
|
7b26da |
fetch_inferior_registers (regcache, find_regno ("pswm"));
|
|
|
7b26da |
collect_register_by_name (regcache, "pswm", &pswm);
|
|
|
7b26da |
free_register_cache (regcache);
|
|
|
7b26da |
@@ -431,8 +419,12 @@ s390_arch_setup (void)
|
|
|
7b26da |
if (pswm & 1)
|
|
|
7b26da |
{
|
|
|
7b26da |
if (have_regset_tdb)
|
|
|
7b26da |
+ have_regset_tdb =
|
|
|
7b26da |
+ (s390_get_hwcap () & HWCAP_S390_TE) != 0;
|
|
|
7b26da |
+
|
|
|
7b26da |
+ if (have_regset_tdb)
|
|
|
7b26da |
init_registers_s390x_te_linux64 ();
|
|
|
7b26da |
- if (have_regset_system_call)
|
|
|
7b26da |
+ else if (have_regset_system_call)
|
|
|
7b26da |
init_registers_s390x_linux64v2 ();
|
|
|
7b26da |
else if (have_regset_last_break)
|
|
|
7b26da |
init_registers_s390x_linux64v1 ();
|
|
|
7b26da |
@@ -445,6 +437,9 @@ s390_arch_setup (void)
|
|
|
7b26da |
else if (s390_get_hwcap () & HWCAP_S390_HIGH_GPRS)
|
|
|
7b26da |
{
|
|
|
7b26da |
if (have_regset_tdb)
|
|
|
7b26da |
+ have_regset_tdb = (s390_get_hwcap () & HWCAP_S390_TE) != 0;
|
|
|
7b26da |
+
|
|
|
7b26da |
+ if (have_regset_tdb)
|
|
|
7b26da |
init_registers_s390_te_linux64 ();
|
|
|
7b26da |
if (have_regset_system_call)
|
|
|
7b26da |
init_registers_s390_linux64v2 ();
|
|
|
7b26da |
@@ -458,6 +453,22 @@ s390_arch_setup (void)
|
|
|
7b26da |
}
|
|
|
7b26da |
}
|
|
|
7b26da |
#endif
|
|
|
7b26da |
+ /* Update target_regsets according to available register sets. */
|
|
|
7b26da |
+ for (regset = target_regsets; regset->fill_function != NULL; regset++)
|
|
|
7b26da |
+ if (regset->get_request == PTRACE_GETREGSET)
|
|
|
7b26da |
+ switch (regset->nt_type)
|
|
|
7b26da |
+ {
|
|
|
7b26da |
+ case NT_S390_LAST_BREAK:
|
|
|
7b26da |
+ regset->size = have_regset_last_break? 8 : 0;
|
|
|
7b26da |
+ break;
|
|
|
7b26da |
+ case NT_S390_SYSTEM_CALL:
|
|
|
7b26da |
+ regset->size = have_regset_system_call? 4 : 0;
|
|
|
7b26da |
+ break;
|
|
|
7b26da |
+ case NT_S390_TDB:
|
|
|
7b26da |
+ regset->size = have_regset_tdb ? 256 : 0;
|
|
|
7b26da |
+ default:
|
|
|
7b26da |
+ break;
|
|
|
7b26da |
+ }
|
|
|
7b26da |
}
|
|
|
7b26da |
|
|
|
7b26da |
|
|
|
7b26da |
Index: gdb-7.6.1/gdb/s390-nat.c
|
|
|
7b26da |
===================================================================
|
|
|
7b26da |
--- gdb-7.6.1.orig/gdb/s390-nat.c
|
|
|
7b26da |
+++ gdb-7.6.1/gdb/s390-nat.c
|
|
|
7b26da |
@@ -632,8 +632,6 @@ s390_read_description (struct target_ops
|
|
|
7b26da |
= check_regset (tid, NT_S390_LAST_BREAK, 8);
|
|
|
7b26da |
have_regset_system_call
|
|
|
7b26da |
= check_regset (tid, NT_S390_SYSTEM_CALL, 4);
|
|
|
7b26da |
- have_regset_tdb
|
|
|
7b26da |
- = check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
|
|
|
7b26da |
|
|
|
7b26da |
#ifdef __s390x__
|
|
|
7b26da |
/* If GDB itself is compiled as 64-bit, we are running on a machine in
|
|
|
7b26da |
@@ -642,6 +640,9 @@ s390_read_description (struct target_ops
|
|
|
7b26da |
addressing mode, but the kernel supports using 64-bit registers in
|
|
|
7b26da |
that mode, report s390 architecture with 64-bit GPRs. */
|
|
|
7b26da |
|
|
|
7b26da |
+ have_regset_tdb = (s390_get_hwcap () & HWCAP_S390_TE) ?
|
|
|
7b26da |
+ check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset) : 0;
|
|
|
7b26da |
+
|
|
|
7b26da |
if (s390_target_wordsize () == 8)
|
|
|
7b26da |
return (have_regset_tdb ? tdesc_s390x_te_linux64 :
|
|
|
7b26da |
have_regset_system_call? tdesc_s390x_linux64v2 :
|