S/390: Disassemble 31-bit binaries with "zarch" opcode set by default
[deliverable/binutils-gdb.git] / gdb / s390-tdep.c
index 72d55450225e89da4394079efac1fa33b36cb68c..091d82a76b169d4163475871830cf6aad650132d 100644 (file)
@@ -44,6 +44,7 @@
 #include "prologue-value.h"
 #include "linux-tdep.h"
 #include "s390-tdep.h"
+#include "auxv.h"
 
 #include "stap-probe.h"
 #include "ax.h"
@@ -51,6 +52,7 @@
 #include "user-regs.h"
 #include "cli/cli-utils.h"
 #include <ctype.h>
+#include "elf/common.h"
 
 #include "features/s390-linux32.c"
 #include "features/s390-linux32v1.c"
 #include "features/s390-linux64.c"
 #include "features/s390-linux64v1.c"
 #include "features/s390-linux64v2.c"
+#include "features/s390-te-linux64.c"
 #include "features/s390x-linux64.c"
 #include "features/s390x-linux64v1.c"
 #include "features/s390x-linux64v2.c"
+#include "features/s390x-te-linux64.c"
 
 /* The tdep structure.  */
 
@@ -141,7 +145,7 @@ s390_write_pc (struct regcache *regcache, CORE_ADDR pc)
 
 /* DWARF Register Mapping.  */
 
-static int s390_dwarf_regmap[] =
+static const short s390_dwarf_regmap[] =
 {
   /* General Purpose Registers.  */
   S390_R0_REGNUM, S390_R1_REGNUM, S390_R2_REGNUM, S390_R3_REGNUM,
@@ -212,6 +216,14 @@ s390_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
 
 /* Pseudo registers.  */
 
+static int
+regnum_is_gpr_full (struct gdbarch_tdep *tdep, int regnum)
+{
+  return (tdep->gpr_full_regnum != -1
+         && regnum >= tdep->gpr_full_regnum
+         && regnum <= tdep->gpr_full_regnum + 15);
+}
+
 static const char *
 s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -223,9 +235,7 @@ s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
   if (regnum == tdep->cc_regnum)
     return "cc";
 
-  if (tdep->gpr_full_regnum != -1
-      && regnum >= tdep->gpr_full_regnum
-      && regnum < tdep->gpr_full_regnum + 16)
+  if (regnum_is_gpr_full (tdep, regnum))
     {
       static const char *full_name[] = {
        "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -248,9 +258,7 @@ s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   if (regnum == tdep->cc_regnum)
     return builtin_type (gdbarch)->builtin_int;
 
-  if (tdep->gpr_full_regnum != -1
-      && regnum >= tdep->gpr_full_regnum
-      && regnum < tdep->gpr_full_regnum + 16)
+  if (regnum_is_gpr_full (tdep, regnum))
     return builtin_type (gdbarch)->builtin_uint64;
 
   internal_error (__FILE__, __LINE__, _("invalid regnum"));
@@ -295,9 +303,7 @@ s390_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
       return status;
     }
 
-  if (tdep->gpr_full_regnum != -1
-      && regnum >= tdep->gpr_full_regnum
-      && regnum < tdep->gpr_full_regnum + 16)
+  if (regnum_is_gpr_full (tdep, regnum))
     {
       enum register_status status;
       ULONGEST val_upper;
@@ -352,9 +358,7 @@ s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
       return;
     }
 
-  if (tdep->gpr_full_regnum != -1
-      && regnum >= tdep->gpr_full_regnum
-      && regnum < tdep->gpr_full_regnum + 16)
+  if (regnum_is_gpr_full (tdep, regnum))
     {
       regnum -= tdep->gpr_full_regnum;
       val = extract_unsigned_integer (buf, regsize, byte_order);
@@ -409,175 +413,190 @@ s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 }
 
 
-/* Core file register sets.  */
+/* Maps for register sets.  */
 
-int s390_regmap_gregset[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  0x00, 0x04,
-  /* General Purpose Registers.  */
-  0x08, 0x0c, 0x10, 0x14,
-  0x18, 0x1c, 0x20, 0x24,
-  0x28, 0x2c, 0x30, 0x34,
-  0x38, 0x3c, 0x40, 0x44,
-  /* Access Registers.  */
-  0x48, 0x4c, 0x50, 0x54,
-  0x58, 0x5c, 0x60, 0x64,
-  0x68, 0x6c, 0x70, 0x74,
-  0x78, 0x7c, 0x80, 0x84,
-  /* Floating Point Control Word.  */
-  -1,
-  /* Floating Point Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GPR Uppper Halves.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GNU/Linux-specific optional "registers".  */
-  0x88, -1, -1,
-};
+const short s390_regmap_gregset[] =
+  {
+    0x00, S390_PSWM_REGNUM,
+    0x04, S390_PSWA_REGNUM,
+    0x08, S390_R0_REGNUM,
+    0x0c, S390_R1_REGNUM,
+    0x10, S390_R2_REGNUM,
+    0x14, S390_R3_REGNUM,
+    0x18, S390_R4_REGNUM,
+    0x1c, S390_R5_REGNUM,
+    0x20, S390_R6_REGNUM,
+    0x24, S390_R7_REGNUM,
+    0x28, S390_R8_REGNUM,
+    0x2c, S390_R9_REGNUM,
+    0x30, S390_R10_REGNUM,
+    0x34, S390_R11_REGNUM,
+    0x38, S390_R12_REGNUM,
+    0x3c, S390_R13_REGNUM,
+    0x40, S390_R14_REGNUM,
+    0x44, S390_R15_REGNUM,
+    0x48, S390_A0_REGNUM,
+    0x4c, S390_A1_REGNUM,
+    0x50, S390_A2_REGNUM,
+    0x54, S390_A3_REGNUM,
+    0x58, S390_A4_REGNUM,
+    0x5c, S390_A5_REGNUM,
+    0x60, S390_A6_REGNUM,
+    0x64, S390_A7_REGNUM,
+    0x68, S390_A8_REGNUM,
+    0x6c, S390_A9_REGNUM,
+    0x70, S390_A10_REGNUM,
+    0x74, S390_A11_REGNUM,
+    0x78, S390_A12_REGNUM,
+    0x7c, S390_A13_REGNUM,
+    0x80, S390_A14_REGNUM,
+    0x84, S390_A15_REGNUM,
+    0x88, S390_ORIG_R2_REGNUM,
+    -1, -1
+  };
 
-int s390x_regmap_gregset[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  0x00, 0x08,
-  /* General Purpose Registers.  */
-  0x10, 0x18, 0x20, 0x28,
-  0x30, 0x38, 0x40, 0x48,
-  0x50, 0x58, 0x60, 0x68,
-  0x70, 0x78, 0x80, 0x88,
-  /* Access Registers.  */
-  0x90, 0x94, 0x98, 0x9c,
-  0xa0, 0xa4, 0xa8, 0xac,
-  0xb0, 0xb4, 0xb8, 0xbc,
-  0xc0, 0xc4, 0xc8, 0xcc,
-  /* Floating Point Control Word.  */
-  -1,
-  /* Floating Point Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GPR Uppper Halves.  */
-  0x10, 0x18, 0x20, 0x28,
-  0x30, 0x38, 0x40, 0x48,
-  0x50, 0x58, 0x60, 0x68,
-  0x70, 0x78, 0x80, 0x88,
-  /* GNU/Linux-specific optional "registers".  */
-  0xd0, -1, -1,
-};
+const short s390x_regmap_gregset[] =
+  {
+    0x00, S390_PSWM_REGNUM,
+    0x08, S390_PSWA_REGNUM,
+    0x10, S390_R0_REGNUM,
+    0x18, S390_R1_REGNUM,
+    0x20, S390_R2_REGNUM,
+    0x28, S390_R3_REGNUM,
+    0x30, S390_R4_REGNUM,
+    0x38, S390_R5_REGNUM,
+    0x40, S390_R6_REGNUM,
+    0x48, S390_R7_REGNUM,
+    0x50, S390_R8_REGNUM,
+    0x58, S390_R9_REGNUM,
+    0x60, S390_R10_REGNUM,
+    0x68, S390_R11_REGNUM,
+    0x70, S390_R12_REGNUM,
+    0x78, S390_R13_REGNUM,
+    0x80, S390_R14_REGNUM,
+    0x88, S390_R15_REGNUM,
+    0x90, S390_A0_REGNUM,
+    0x94, S390_A1_REGNUM,
+    0x98, S390_A2_REGNUM,
+    0x9c, S390_A3_REGNUM,
+    0xa0, S390_A4_REGNUM,
+    0xa4, S390_A5_REGNUM,
+    0xa8, S390_A6_REGNUM,
+    0xac, S390_A7_REGNUM,
+    0xb0, S390_A8_REGNUM,
+    0xb4, S390_A9_REGNUM,
+    0xb8, S390_A10_REGNUM,
+    0xbc, S390_A11_REGNUM,
+    0xc0, S390_A12_REGNUM,
+    0xc4, S390_A13_REGNUM,
+    0xc8, S390_A14_REGNUM,
+    0xcc, S390_A15_REGNUM,
+    0x10, S390_R0_UPPER_REGNUM,
+    0x18, S390_R1_UPPER_REGNUM,
+    0x20, S390_R2_UPPER_REGNUM,
+    0x28, S390_R3_UPPER_REGNUM,
+    0x30, S390_R4_UPPER_REGNUM,
+    0x38, S390_R5_UPPER_REGNUM,
+    0x40, S390_R6_UPPER_REGNUM,
+    0x48, S390_R7_UPPER_REGNUM,
+    0x50, S390_R8_UPPER_REGNUM,
+    0x58, S390_R9_UPPER_REGNUM,
+    0x60, S390_R10_UPPER_REGNUM,
+    0x68, S390_R11_UPPER_REGNUM,
+    0x70, S390_R12_UPPER_REGNUM,
+    0x78, S390_R13_UPPER_REGNUM,
+    0x80, S390_R14_UPPER_REGNUM,
+    0x88, S390_R15_UPPER_REGNUM,
+    0xd0, S390_ORIG_R2_REGNUM,
+    -1, -1
+  };
 
-int s390_regmap_fpregset[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  -1, -1,
-  /* General Purpose Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Access Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Floating Point Control Word.  */
-  0x00,
-  /* Floating Point Registers.  */
-  0x08, 0x10, 0x18, 0x20,
-  0x28, 0x30, 0x38, 0x40,
-  0x48, 0x50, 0x58, 0x60,
-  0x68, 0x70, 0x78, 0x80,
-  /* GPR Uppper Halves.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GNU/Linux-specific optional "registers".  */
-  -1, -1, -1,
-};
+const short s390_regmap_fpregset[] =
+  {
+    0x00, S390_FPC_REGNUM,
+    0x08, S390_F0_REGNUM,
+    0x10, S390_F1_REGNUM,
+    0x18, S390_F2_REGNUM,
+    0x20, S390_F3_REGNUM,
+    0x28, S390_F4_REGNUM,
+    0x30, S390_F5_REGNUM,
+    0x38, S390_F6_REGNUM,
+    0x40, S390_F7_REGNUM,
+    0x48, S390_F8_REGNUM,
+    0x50, S390_F9_REGNUM,
+    0x58, S390_F10_REGNUM,
+    0x60, S390_F11_REGNUM,
+    0x68, S390_F12_REGNUM,
+    0x70, S390_F13_REGNUM,
+    0x78, S390_F14_REGNUM,
+    0x80, S390_F15_REGNUM,
+    -1, -1
+  };
 
-int s390_regmap_upper[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  -1, -1,
-  /* General Purpose Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Access Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Floating Point Control Word.  */
-  -1,
-  /* Floating Point Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GPR Uppper Halves.  */
-  0x00, 0x04, 0x08, 0x0c,
-  0x10, 0x14, 0x18, 0x1c,
-  0x20, 0x24, 0x28, 0x2c,
-  0x30, 0x34, 0x38, 0x3c,
-  /* GNU/Linux-specific optional "registers".  */
-  -1, -1, -1,
-};
+const short s390_regmap_upper[] =
+  {
+    0x00, S390_R0_UPPER_REGNUM,
+    0x04, S390_R1_UPPER_REGNUM,
+    0x08, S390_R2_UPPER_REGNUM,
+    0x0c, S390_R3_UPPER_REGNUM,
+    0x10, S390_R4_UPPER_REGNUM,
+    0x14, S390_R5_UPPER_REGNUM,
+    0x18, S390_R6_UPPER_REGNUM,
+    0x1c, S390_R7_UPPER_REGNUM,
+    0x20, S390_R8_UPPER_REGNUM,
+    0x24, S390_R9_UPPER_REGNUM,
+    0x28, S390_R10_UPPER_REGNUM,
+    0x2c, S390_R11_UPPER_REGNUM,
+    0x30, S390_R12_UPPER_REGNUM,
+    0x34, S390_R13_UPPER_REGNUM,
+    0x38, S390_R14_UPPER_REGNUM,
+    0x3c, S390_R15_UPPER_REGNUM,
+    -1, -1
+  };
 
-int s390_regmap_last_break[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  -1, -1,
-  /* General Purpose Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Access Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Floating Point Control Word.  */
-  -1,
-  /* Floating Point Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GPR Uppper Halves.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GNU/Linux-specific optional "registers".  */
-  -1, 4, -1,
-};
+const short s390_regmap_last_break[] =
+  {
+    0x04, S390_LAST_BREAK_REGNUM,
+    -1, -1
+  };
 
-int s390x_regmap_last_break[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  -1, -1,
-  /* General Purpose Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Access Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Floating Point Control Word.  */
-  -1,
-  /* Floating Point Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GPR Uppper Halves.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GNU/Linux-specific optional "registers".  */
-  -1, 0, -1,
-};
+const short s390x_regmap_last_break[] =
+  {
+    0x00, S390_LAST_BREAK_REGNUM,
+    -1, -1
+  };
+
+const short s390_regmap_system_call[] =
+  {
+    0x00, S390_SYSTEM_CALL_REGNUM,
+    -1, -1
+  };
+
+const short s390_regmap_tdb[] =
+  {
+    0x00, S390_TDB_DWORD0_REGNUM,
+    0x08, S390_TDB_ABORT_CODE_REGNUM,
+    0x10, S390_TDB_CONFLICT_TOKEN_REGNUM,
+    0x18, S390_TDB_ATIA_REGNUM,
+    0x80, S390_TDB_R0_REGNUM,
+    0x88, S390_TDB_R1_REGNUM,
+    0x90, S390_TDB_R2_REGNUM,
+    0x98, S390_TDB_R3_REGNUM,
+    0xa0, S390_TDB_R4_REGNUM,
+    0xa8, S390_TDB_R5_REGNUM,
+    0xb0, S390_TDB_R6_REGNUM,
+    0xb8, S390_TDB_R7_REGNUM,
+    0xc0, S390_TDB_R8_REGNUM,
+    0xc8, S390_TDB_R9_REGNUM,
+    0xd0, S390_TDB_R10_REGNUM,
+    0xd8, S390_TDB_R11_REGNUM,
+    0xe0, S390_TDB_R12_REGNUM,
+    0xe8, S390_TDB_R13_REGNUM,
+    0xf0, S390_TDB_R14_REGNUM,
+    0xf8, S390_TDB_R15_REGNUM,
+    -1, -1
+  };
 
-int s390_regmap_system_call[S390_NUM_REGS] =
-{
-  /* Program Status Word.  */
-  -1, -1,
-  /* General Purpose Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Access Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* Floating Point Control Word.  */
-  -1,
-  /* Floating Point Registers.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GPR Uppper Halves.  */
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  -1, -1, -1, -1, -1, -1, -1, -1,
-  /* GNU/Linux-specific optional "registers".  */
-  -1, -1, 0,
-};
 
 /* Supply register REGNUM from the register set REGSET to register cache 
    REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
@@ -585,14 +604,28 @@ static void
 s390_supply_regset (const struct regset *regset, struct regcache *regcache,
                    int regnum, const void *regs, size_t len)
 {
-  const int *offset = regset->descr;
+  const short *map;
+  for (map = regset->descr; map[0] >= 0; map += 2)
+    if (regnum == -1 || regnum == map[1])
+      regcache_raw_supply (regcache, map[1],
+                          regs ? (const char *)regs + map[0] : NULL);
+}
+
+/* Supply the TDB regset.  Like s390_supply_regset, but invalidate the
+   TDB registers unless the TDB format field is valid.  */
+
+static void
+s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache,
+                   int regnum, const void *regs, size_t len)
+{
+  ULONGEST tdw;
+  enum register_status ret;
   int i;
 
-  for (i = 0; i < S390_NUM_REGS; i++)
-    {
-      if ((regnum == i || regnum == -1) && offset[i] != -1)
-       regcache_raw_supply (regcache, i, (const char *)regs + offset[i]);
-    }
+  s390_supply_regset (regset, regcache, regnum, regs, len);
+  ret = regcache_cooked_read_unsigned (regcache, S390_TDB_DWORD0_REGNUM, &tdw);
+  if (ret != REG_VALID || (tdw >> 56) != 1)
+    s390_supply_regset (regset, regcache, regnum, NULL, len);
 }
 
 /* Collect register REGNUM from the register cache REGCACHE and store
@@ -604,14 +637,10 @@ s390_collect_regset (const struct regset *regset,
                     const struct regcache *regcache,
                     int regnum, void *regs, size_t len)
 {
-  const int *offset = regset->descr;
-  int i;
-
-  for (i = 0; i < S390_NUM_REGS; i++)
-    {
-      if ((regnum == i || regnum == -1) && offset[i] != -1)
-       regcache_raw_collect (regcache, i, (char *)regs + offset[i]);
-    }
+  const short *map;
+  for (map = regset->descr; map[0] >= 0; map += 2)
+    if (regnum == -1 || regnum == map[1])
+      regcache_raw_collect (regcache, map[1], (char *)regs + map[0]);
 }
 
 static const struct regset s390_gregset = {
@@ -656,6 +685,12 @@ static const struct regset s390_system_call_regset = {
   s390_collect_regset
 };
 
+static const struct regset s390_tdb_regset = {
+  s390_regmap_tdb,
+  s390_supply_tdb_regset,
+  s390_collect_regset
+};
+
 static struct core_regset_section s390_linux32_regset_sections[] =
 {
   { ".reg", s390_sizeof_gregset, "general-purpose" },
@@ -704,6 +739,7 @@ static struct core_regset_section s390_linux64v2_regset_sections[] =
   { ".reg-s390-high-gprs", 16*4, "s390 GPR upper halves" },
   { ".reg-s390-last-break", 8, "s930 last-break address" },
   { ".reg-s390-system-call", 4, "s390 system-call" },
+  { ".reg-s390-tdb", s390_sizeof_tdbregset, "s390 TDB" },
   { NULL, 0}
 };
 
@@ -728,6 +764,7 @@ static struct core_regset_section s390x_linux64v2_regset_sections[] =
   { ".reg2", s390_sizeof_fpregset, "floating-point" },
   { ".reg-s390-last-break", 8, "s930 last-break address" },
   { ".reg-s390-system-call", 4, "s390 system-call" },
+  { ".reg-s390-tdb", s390_sizeof_tdbregset, "s390 TDB" },
   { NULL, 0}
 };
 
@@ -756,6 +793,9 @@ s390_regset_from_core_section (struct gdbarch *gdbarch,
   if (strcmp (sect_name, ".reg-s390-system-call") == 0 && sect_size >= 4)
     return &s390_system_call_regset;
 
+  if (strcmp (sect_name, ".reg-s390-tdb") == 0 && sect_size >= 256)
+    return &s390_tdb_regset;
+
   return NULL;
 }
 
@@ -767,6 +807,9 @@ s390_core_read_description (struct gdbarch *gdbarch,
   asection *v1 = bfd_get_section_by_name (abfd, ".reg-s390-last-break");
   asection *v2 = bfd_get_section_by_name (abfd, ".reg-s390-system-call");
   asection *section = bfd_get_section_by_name (abfd, ".reg");
+  CORE_ADDR hwcap = 0;
+
+  target_auxv_search (target, AT_HWCAP, &hwcap);
   if (!section)
     return NULL;
 
@@ -774,14 +817,16 @@ s390_core_read_description (struct gdbarch *gdbarch,
     {
     case s390_sizeof_gregset:
       if (high_gprs)
-       return (v2? tdesc_s390_linux64v2 :
+       return ((hwcap & HWCAP_S390_TE) ? tdesc_s390_te_linux64 :
+               v2? tdesc_s390_linux64v2 :
                v1? tdesc_s390_linux64v1 : tdesc_s390_linux64);
       else
        return (v2? tdesc_s390_linux32v2 :
                v1? tdesc_s390_linux32v1 : tdesc_s390_linux32);
 
     case s390x_sizeof_gregset:
-      return (v2? tdesc_s390x_linux64v2 :
+      return ((hwcap & HWCAP_S390_TE) ? tdesc_s390x_te_linux64 :
+             v2? tdesc_s390x_linux64v2 :
              v1? tdesc_s390x_linux64v1 : tdesc_s390x_linux64);
 
     default:
@@ -1719,9 +1764,7 @@ s390_unwind_pseudo_register (struct frame_info *this_frame, int regnum)
 
   /* Unwind full GPRs to show at least the lower halves (as the
      upper halves are undefined).  */
-  if (tdep->gpr_full_regnum != -1
-      && regnum >= tdep->gpr_full_regnum
-      && regnum < tdep->gpr_full_regnum + 16)
+  if (regnum_is_gpr_full (tdep, regnum))
     {
       int reg = regnum - tdep->gpr_full_regnum;
       struct value *val;
@@ -3031,6 +3074,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
        "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
       };
+      static const char *const tdb_regs[] = {
+       "tdb0", "tac", "tct", "atia",
+       "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
+       "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
+      };
       const struct tdesc_feature *feature;
       int i, valid_p = 1;
 
@@ -3108,6 +3156,16 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
            valid_p = 0;
        }
 
+      /* Transaction diagnostic block.  */
+      feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.tdb");
+      if (feature)
+       {
+         for (i = 0; i < ARRAY_SIZE (tdb_regs); i++)
+           valid_p &= tdesc_numbered_register (feature, tdesc_data,
+                                               S390_TDB_DWORD0_REGNUM + i,
+                                               tdb_regs[i]);
+       }
+
       if (!valid_p)
        {
          tdesc_data_cleanup (tdesc_data);
@@ -3324,7 +3382,9 @@ _initialize_s390_tdep (void)
   initialize_tdesc_s390_linux64 ();
   initialize_tdesc_s390_linux64v1 ();
   initialize_tdesc_s390_linux64v2 ();
+  initialize_tdesc_s390_te_linux64 ();
   initialize_tdesc_s390x_linux64 ();
   initialize_tdesc_s390x_linux64v1 ();
   initialize_tdesc_s390x_linux64v2 ();
+  initialize_tdesc_s390x_te_linux64 ();
 }
This page took 0.037403 seconds and 4 git commands to generate.