#define HWCAP_S390_HIGH_GPRS 512
#endif
+#ifndef HWCAP_S390_TE
+#define HWCAP_S390_TE 1024
+#endif
+
#ifndef PTRACE_GETREGSET
#define PTRACE_GETREGSET 0x4204
#endif
= s390_check_regset (pid, NT_S390_SYSTEM_CALL, 4);
int have_regset_tdb = s390_check_regset (pid, NT_S390_TDB, 256);
- /* Update target_regsets according to available register sets. */
- for (regset = s390_regsets; regset->fill_function != NULL; regset++)
- if (regset->get_request == PTRACE_GETREGSET)
- switch (regset->nt_type)
- {
- case NT_S390_LAST_BREAK:
- regset->size = have_regset_last_break? 8 : 0;
- break;
- case NT_S390_SYSTEM_CALL:
- regset->size = have_regset_system_call? 4 : 0;
- break;
- case NT_S390_TDB:
- regset->size = have_regset_tdb ? 256 : 0;
- default:
- break;
- }
-
/* Assume 31-bit inferior process. */
if (have_regset_system_call)
tdesc = tdesc_s390_linux32v2;
{
unsigned int pswm;
struct regcache *regcache = new_register_cache (tdesc);
+
fetch_inferior_registers (regcache, find_regno (tdesc, "pswm"));
collect_register_by_name (regcache, "pswm", &pswm);
free_register_cache (regcache);
if (pswm & 1)
{
+ if (have_regset_tdb)
+ have_regset_tdb =
+ (s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_TE) != 0;
+
if (have_regset_tdb)
tdesc = tdesc_s390x_te_linux64;
- if (have_regset_system_call)
+ else if (have_regset_system_call)
tdesc = tdesc_s390x_linux64v2;
else if (have_regset_last_break)
tdesc = tdesc_s390x_linux64v1;
else if (s390_get_hwcap (tdesc) & HWCAP_S390_HIGH_GPRS)
{
have_hwcap_s390_high_gprs = 1;
+ if (have_regset_tdb)
+ have_regset_tdb = (s390_get_hwcap (tdesc) & HWCAP_S390_TE) != 0;
if (have_regset_tdb)
tdesc = tdesc_s390_te_linux64;
}
}
#endif
+
+ /* Update target_regsets according to available register sets. */
+ for (regset = s390_regsets; regset->fill_function != NULL; regset++)
+ if (regset->get_request == PTRACE_GETREGSET)
+ switch (regset->nt_type)
+ {
+ case NT_S390_LAST_BREAK:
+ regset->size = have_regset_last_break? 8 : 0;
+ break;
+ case NT_S390_SYSTEM_CALL:
+ regset->size = have_regset_system_call? 4 : 0;
+ break;
+ case NT_S390_TDB:
+ regset->size = have_regset_tdb ? 256 : 0;
+ default:
+ break;
+ }
+
current_process ()->tdesc = tdesc;
}
= 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
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 :