From 6682d9595ed8d9b9bba5470bfd7fd1ccd378f19a Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Tue, 5 Nov 2013 18:43:50 +0100 Subject: S390: Fix TDB regset recognition When checking for the presence of the TDB regset, the current code interprets ENODATA from PTRACE_GETREGSET as an indication that the TDB regset *could* occur on this system, but the inferior stopped outside a transaction. However, the Linux kernel actually reports ENODATA even on systems without the transactional execution facility. Thus the logic is now changed to check the TE field in the HWCAP as well. This version also checks the existence of the TDB regset -- just to be on the safe side when running on TE-enabled hardware with a kernel that does not offer the TDB regset for some reason. gdb/ * s390-linux-nat.c (s390_read_description): Consider the TE field in the HWCAP for determining 'have_regset_tdb'. gdbserver/ * linux-s390-low.c (HWCAP_S390_TE): New define. (s390_arch_setup): Consider the TE field in the HWCAP for determining 'have_regset_tdb'. --- gdb/s390-linux-nat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gdb/s390-linux-nat.c') diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 67f97f9..cf3f7d7 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -632,8 +632,6 @@ s390_read_description (struct target_ops *ops) = check_regset (tid, NT_S390_LAST_BREAK, 8); have_regset_system_call = check_regset (tid, NT_S390_SYSTEM_CALL, 4); - have_regset_tdb - = check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset); #ifdef __s390x__ /* If GDB itself is compiled as 64-bit, we are running on a machine in @@ -642,6 +640,9 @@ s390_read_description (struct target_ops *ops) addressing mode, but the kernel supports using 64-bit registers in that mode, report s390 architecture with 64-bit GPRs. */ + have_regset_tdb = (s390_get_hwcap () & HWCAP_S390_TE) ? + check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset) : 0; + if (s390_target_wordsize () == 8) return (have_regset_tdb ? tdesc_s390x_te_linux64 : have_regset_system_call? tdesc_s390x_linux64v2 : -- cgit v1.1