| Index: gdb/s390-linux-tdep.c
|
| diff --git a/gdb/s390-tdep.c b/gdb/s390-linux-tdep.c
|
| similarity index 88%
|
| rename from gdb/s390-tdep.c
|
| rename to gdb/s390-linux-tdep.c
|
| index 620eaea7d58b925408d1f519e3c365d62c6210df..cd41de5acd9a7ffb8ea10683e12d68334d4a2ddc 100644
|
| --- a/gdb/s390-tdep.c
|
| +++ b/gdb/s390-linux-tdep.c
|
| @@ -1,6 +1,6 @@
|
| /* Target-dependent code for GDB, the GNU debugger.
|
|
|
| - Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
| + Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
|
|
| Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
|
| for IBM Deutschland Entwicklung GmbH, IBM Corporation.
|
| @@ -43,7 +43,8 @@
|
| #include "solib-svr4.h"
|
| #include "prologue-value.h"
|
| #include "linux-tdep.h"
|
| -#include "s390-tdep.h"
|
| +#include "s390-linux-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"
|
| @@ -58,9 +60,11 @@
|
| #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,
|
| @@ -156,8 +160,8 @@ static int s390_dwarf_regmap[] =
|
| S390_F9_REGNUM, S390_F11_REGNUM, S390_F13_REGNUM, S390_F15_REGNUM,
|
|
|
| /* Control Registers (not mapped). */
|
| - -1, -1, -1, -1, -1, -1, -1, -1,
|
| - -1, -1, -1, -1, -1, -1, -1, -1,
|
| + -1, -1, -1, -1, -1, -1, -1, -1,
|
| + -1, -1, -1, -1, -1, -1, -1, -1,
|
|
|
| /* Access Registers. */
|
| S390_A0_REGNUM, S390_A1_REGNUM, S390_A2_REGNUM, S390_A3_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);
|
| @@ -376,9 +380,11 @@ s390_value_from_register (struct type *type, int regnum,
|
| struct frame_info *frame)
|
| {
|
| struct value *value = default_value_from_register (type, regnum, frame);
|
| - int len = TYPE_LENGTH (check_typedef (type));
|
|
|
| - if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM && len < 8)
|
| + check_typedef (type);
|
| +
|
| + if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
|
| + && TYPE_LENGTH (type) < 8)
|
| set_value_offset (value, 0);
|
|
|
| return value;
|
| @@ -407,190 +413,219 @@ 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
|
| + };
|
|
|
| -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,
|
| -};
|
| +const short s390_regmap_system_call[] =
|
| + {
|
| + 0x00, S390_SYSTEM_CALL_REGNUM,
|
| + -1, -1
|
| + };
|
|
|
| -/* Supply register REGNUM from the register set REGSET to register cache
|
| +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
|
| + };
|
| +
|
| +
|
| +/* Supply register REGNUM from the register set REGSET to register cache
|
| REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
| 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
|
| @@ -602,36 +637,32 @@ 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 = {
|
| - s390_regmap_gregset,
|
| + s390_regmap_gregset,
|
| s390_supply_regset,
|
| s390_collect_regset
|
| };
|
|
|
| static const struct regset s390x_gregset = {
|
| - s390x_regmap_gregset,
|
| + s390x_regmap_gregset,
|
| s390_supply_regset,
|
| s390_collect_regset
|
| };
|
|
|
| static const struct regset s390_fpregset = {
|
| - s390_regmap_fpregset,
|
| + s390_regmap_fpregset,
|
| s390_supply_regset,
|
| s390_collect_regset
|
| };
|
|
|
| static const struct regset s390_upper_regset = {
|
| - s390_regmap_upper,
|
| + s390_regmap_upper,
|
| s390_supply_regset,
|
| s390_collect_regset
|
| };
|
| @@ -654,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" },
|
| @@ -702,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}
|
| };
|
|
|
| @@ -726,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}
|
| };
|
|
|
| @@ -754,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;
|
| }
|
|
|
| @@ -765,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;
|
|
|
| @@ -772,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:
|
| @@ -876,7 +923,7 @@ s390_readinstruction (bfd_byte instr[], CORE_ADDR at)
|
| if (instrlen > 2)
|
| {
|
| if (target_read_memory (at + 2, &instr[2], instrlen - 2))
|
| - return -1;
|
| + return -1;
|
| }
|
| return instrlen;
|
| }
|
| @@ -912,18 +959,18 @@ is_ri (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
|
|
|
| static int
|
| is_ril (bfd_byte *insn, int op1, int op2,
|
| - unsigned int *r1, int *i2)
|
| + unsigned int *r1, int *i2)
|
| {
|
| if (insn[0] == op1 && (insn[1] & 0xf) == op2)
|
| {
|
| *r1 = (insn[1] >> 4) & 0xf;
|
| /* i2 is a signed quantity. If the host 'int' is 32 bits long,
|
| - no sign extension is necessary, but we don't want to assume
|
| - that. */
|
| + no sign extension is necessary, but we don't want to assume
|
| + that. */
|
| *i2 = (((insn[2] << 24)
|
| - | (insn[3] << 16)
|
| - | (insn[4] << 8)
|
| - | (insn[5])) ^ 0x80000000) - 0x80000000;
|
| + | (insn[3] << 16)
|
| + | (insn[4] << 8)
|
| + | (insn[5])) ^ 0x80000000) - 0x80000000;
|
| return 1;
|
| }
|
| else
|
| @@ -962,7 +1009,7 @@ is_rre (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
|
|
|
| static int
|
| is_rs (bfd_byte *insn, int op,
|
| - unsigned int *r1, unsigned int *r3, unsigned int *d2, unsigned int *b2)
|
| + unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
|
| {
|
| if (insn[0] == op)
|
| {
|
| @@ -979,7 +1026,7 @@ is_rs (bfd_byte *insn, int op,
|
|
|
| static int
|
| is_rsy (bfd_byte *insn, int op1, int op2,
|
| - unsigned int *r1, unsigned int *r3, unsigned int *d2, unsigned int *b2)
|
| + unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
|
| {
|
| if (insn[0] == op1
|
| && insn[5] == op2)
|
| @@ -988,7 +1035,7 @@ is_rsy (bfd_byte *insn, int op1, int op2,
|
| *r3 = insn[1] & 0xf;
|
| *b2 = (insn[2] >> 4) & 0xf;
|
| /* The 'long displacement' is a 20-bit signed integer. */
|
| - *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
|
| + *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
|
| ^ 0x80000) - 0x80000;
|
| return 1;
|
| }
|
| @@ -999,7 +1046,7 @@ is_rsy (bfd_byte *insn, int op1, int op2,
|
|
|
| static int
|
| is_rsi (bfd_byte *insn, int op,
|
| - unsigned int *r1, unsigned int *r3, int *i2)
|
| + unsigned int *r1, unsigned int *r3, int *i2)
|
| {
|
| if (insn[0] == op)
|
| {
|
| @@ -1016,7 +1063,7 @@ is_rsi (bfd_byte *insn, int op,
|
|
|
| static int
|
| is_rie (bfd_byte *insn, int op1, int op2,
|
| - unsigned int *r1, unsigned int *r3, int *i2)
|
| + unsigned int *r1, unsigned int *r3, int *i2)
|
| {
|
| if (insn[0] == op1
|
| && insn[5] == op2)
|
| @@ -1034,7 +1081,7 @@ is_rie (bfd_byte *insn, int op1, int op2,
|
|
|
| static int
|
| is_rx (bfd_byte *insn, int op,
|
| - unsigned int *r1, unsigned int *d2, unsigned int *x2, unsigned int *b2)
|
| + unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
|
| {
|
| if (insn[0] == op)
|
| {
|
| @@ -1051,7 +1098,7 @@ is_rx (bfd_byte *insn, int op,
|
|
|
| static int
|
| is_rxy (bfd_byte *insn, int op1, int op2,
|
| - unsigned int *r1, unsigned int *d2, unsigned int *x2, unsigned int *b2)
|
| + unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
|
| {
|
| if (insn[0] == op1
|
| && insn[5] == op2)
|
| @@ -1060,7 +1107,7 @@ is_rxy (bfd_byte *insn, int op1, int op2,
|
| *x2 = insn[1] & 0xf;
|
| *b2 = (insn[2] >> 4) & 0xf;
|
| /* The 'long displacement' is a 20-bit signed integer. */
|
| - *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
|
| + *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
|
| ^ 0x80000) - 0x80000;
|
| return 1;
|
| }
|
| @@ -1104,7 +1151,7 @@ struct s390_prologue_data {
|
|
|
| /* Return the effective address for an X-style instruction, like:
|
|
|
| - L R1, D2(X2, B2)
|
| + L R1, D2(X2, B2)
|
|
|
| Here, X2 and B2 are registers, and D2 is a signed 20-bit
|
| constant; the effective address is the sum of all three. If either
|
| @@ -1163,7 +1210,7 @@ s390_store (struct s390_prologue_data *data,
|
| static pv_t
|
| s390_load (struct s390_prologue_data *data,
|
| int d2, unsigned int x2, unsigned int b2, CORE_ADDR size)
|
| -
|
| +
|
| {
|
| pv_t addr = s390_addr (data, d2, x2, b2);
|
|
|
| @@ -1177,9 +1224,10 @@ s390_load (struct s390_prologue_data *data,
|
| struct target_section *secp;
|
| secp = target_section_by_addr (¤t_target, addr.k);
|
| if (secp != NULL
|
| - && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
|
| - & SEC_READONLY))
|
| - return pv_constant (read_memory_integer (addr.k, size,
|
| + && (bfd_get_section_flags (secp->the_bfd_section->owner,
|
| + secp->the_bfd_section)
|
| + & SEC_READONLY))
|
| + return pv_constant (read_memory_integer (addr.k, size,
|
| data->byte_order));
|
| }
|
|
|
| @@ -1209,7 +1257,7 @@ s390_check_for_saved (void *data_untyped, pv_t addr,
|
| /* If we are storing the original value of a register, we want to
|
| record the CFA offset. If the same register is stored multiple
|
| times, the stack slot with the highest address counts. */
|
| -
|
| +
|
| for (i = 0; i < S390_NUM_GPRS; i++)
|
| if (size == data->gpr_size
|
| && pv_is_register_k (value, S390_R0_REGNUM + i, 0))
|
| @@ -1247,7 +1295,7 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
|
|
| /* Our return value:
|
| The address of the instruction after the last one that changed
|
| - the SP, FP, or back chain; zero if we got an error trying to
|
| + the SP, FP, or back chain; zero if we got an error trying to
|
| read memory. */
|
| CORE_ADDR result = start_pc;
|
|
|
| @@ -1256,7 +1304,7 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
|
|
| /* The address of the next instruction after that. */
|
| CORE_ADDR next_pc;
|
| -
|
| +
|
| /* Set up everything's initial value. */
|
| {
|
| int i;
|
| @@ -1301,17 +1349,17 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| int i2, d2;
|
|
|
| /* The values of SP and FP before this instruction,
|
| - for detecting instructions that change them. */
|
| + for detecting instructions that change them. */
|
| pv_t pre_insn_sp, pre_insn_fp;
|
| /* Likewise for the flag whether the back chain was saved. */
|
| int pre_insn_back_chain_saved_p;
|
|
|
| /* If we got an error trying to read the instruction, report it. */
|
| if (insn_len < 0)
|
| - {
|
| - result = 0;
|
| - break;
|
| - }
|
| + {
|
| + result = 0;
|
| + break;
|
| + }
|
|
|
| next_pc = pc + insn_len;
|
|
|
| @@ -1324,8 +1372,8 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| /* LGHI r1, i2 --- load halfword immediate (64-bit version). */
|
| /* LGFI r1, i2 --- load fullword immediate. */
|
| if (is_ri (insn32, op1_lhi, op2_lhi, &r1, &i2)
|
| - || is_ri (insn64, op1_lghi, op2_lghi, &r1, &i2)
|
| - || is_ril (insn, op1_lgfi, op2_lgfi, &r1, &i2))
|
| + || is_ri (insn64, op1_lghi, op2_lghi, &r1, &i2)
|
| + || is_ril (insn, op1_lgfi, op2_lgfi, &r1, &i2))
|
| data->gpr[r1] = pv_constant (i2);
|
|
|
| /* LR r1, r2 --- load from register. */
|
| @@ -1361,10 +1409,10 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| else if (is_rs (insn32, op_stm, &r1, &r3, &d2, &b2)
|
| || is_rsy (insn32, op1_stmy, op2_stmy, &r1, &r3, &d2, &b2)
|
| || is_rsy (insn64, op1_stmg, op2_stmg, &r1, &r3, &d2, &b2))
|
| - {
|
| - for (; r1 <= r3; r1++, d2 += data->gpr_size)
|
| + {
|
| + for (; r1 <= r3; r1++, d2 += data->gpr_size)
|
| s390_store (data, d2, 0, b2, data->gpr_size, data->gpr[r1]);
|
| - }
|
| + }
|
|
|
| /* AHI r1, i2 --- add halfword immediate. */
|
| /* AGHI r1, i2 --- add halfword immediate (64-bit version). */
|
| @@ -1423,7 +1471,7 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| /* LA r1, d2(x2, b2) --- load address. */
|
| /* LAY r1, d2(x2, b2) --- load address (long-displacement version). */
|
| else if (is_rx (insn, op_la, &r1, &d2, &x2, &b2)
|
| - || is_rxy (insn, op1_lay, op2_lay, &r1, &d2, &x2, &b2))
|
| + || is_rxy (insn, op1_lay, op2_lay, &r1, &d2, &x2, &b2))
|
| data->gpr[r1] = s390_addr (data, d2, x2, b2);
|
|
|
| /* LARL r1, i2 --- load address relative long. */
|
| @@ -1431,22 +1479,22 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| data->gpr[r1] = pv_constant (pc + i2 * 2);
|
|
|
| /* BASR r1, 0 --- branch and save.
|
| - Since r2 is zero, this saves the PC in r1, but doesn't branch. */
|
| + Since r2 is zero, this saves the PC in r1, but doesn't branch. */
|
| else if (is_rr (insn, op_basr, &r1, &r2)
|
| - && r2 == 0)
|
| + && r2 == 0)
|
| data->gpr[r1] = pv_constant (next_pc);
|
|
|
| /* BRAS r1, i2 --- branch relative and save. */
|
| else if (is_ri (insn, op1_bras, op2_bras, &r1, &i2))
|
| - {
|
| - data->gpr[r1] = pv_constant (next_pc);
|
| - next_pc = pc + i2 * 2;
|
| + {
|
| + data->gpr[r1] = pv_constant (next_pc);
|
| + next_pc = pc + i2 * 2;
|
|
|
| - /* We'd better not interpret any backward branches. We'll
|
| - never terminate. */
|
| - if (next_pc <= pc)
|
| - break;
|
| - }
|
| + /* We'd better not interpret any backward branches. We'll
|
| + never terminate. */
|
| + if (next_pc <= pc)
|
| + break;
|
| + }
|
|
|
| /* Terminate search when hitting any other branch instruction. */
|
| else if (is_rr (insn, op_basr, &r1, &r2)
|
| @@ -1459,31 +1507,32 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| break;
|
|
|
| else
|
| - /* An instruction we don't know how to simulate. The only
|
| - safe thing to do would be to set every value we're tracking
|
| - to 'unknown'. Instead, we'll be optimistic: we assume that
|
| - we *can* interpret every instruction that the compiler uses
|
| - to manipulate any of the data we're interested in here --
|
| - then we can just ignore anything else. */
|
| - ;
|
| + {
|
| + /* An instruction we don't know how to simulate. The only
|
| + safe thing to do would be to set every value we're tracking
|
| + to 'unknown'. Instead, we'll be optimistic: we assume that
|
| + we *can* interpret every instruction that the compiler uses
|
| + to manipulate any of the data we're interested in here --
|
| + then we can just ignore anything else. */
|
| + }
|
|
|
| /* Record the address after the last instruction that changed
|
| - the FP, SP, or backlink. Ignore instructions that changed
|
| - them back to their original values --- those are probably
|
| - restore instructions. (The back chain is never restored,
|
| - just popped.) */
|
| + the FP, SP, or backlink. Ignore instructions that changed
|
| + them back to their original values --- those are probably
|
| + restore instructions. (The back chain is never restored,
|
| + just popped.) */
|
| {
|
| - pv_t sp = data->gpr[S390_SP_REGNUM - S390_R0_REGNUM];
|
| - pv_t fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM];
|
| -
|
| - if ((! pv_is_identical (pre_insn_sp, sp)
|
| - && ! pv_is_register_k (sp, S390_SP_REGNUM, 0)
|
| + pv_t sp = data->gpr[S390_SP_REGNUM - S390_R0_REGNUM];
|
| + pv_t fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM];
|
| +
|
| + if ((! pv_is_identical (pre_insn_sp, sp)
|
| + && ! pv_is_register_k (sp, S390_SP_REGNUM, 0)
|
| && sp.kind != pvk_unknown)
|
| - || (! pv_is_identical (pre_insn_fp, fp)
|
| - && ! pv_is_register_k (fp, S390_FRAME_REGNUM, 0)
|
| + || (! pv_is_identical (pre_insn_fp, fp)
|
| + && ! pv_is_register_k (fp, S390_FRAME_REGNUM, 0)
|
| && fp.kind != pvk_unknown)
|
| - || pre_insn_back_chain_saved_p != data->back_chain_saved_p)
|
| - result = next_pc;
|
| + || pre_insn_back_chain_saved_p != data->back_chain_saved_p)
|
| + result = next_pc;
|
| }
|
| }
|
|
|
| @@ -1496,7 +1545,7 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
| return result;
|
| }
|
|
|
| -/* Advance PC across any function entry prologue instructions to reach
|
| +/* Advance PC across any function entry prologue instructions to reach
|
| some "real" code. */
|
| static CORE_ADDR
|
| s390_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
| @@ -1622,7 +1671,7 @@ s390_displaced_step_fixup (struct gdbarch *gdbarch,
|
|
|
| /* Handle PC-relative branch and save instructions. */
|
| else if (is_ri (insn, op1_bras, op2_bras, &r1, &i2)
|
| - || is_ril (insn, op1_brasl, op2_brasl, &r1, &i2))
|
| + || is_ril (insn, op1_brasl, op2_brasl, &r1, &i2))
|
| {
|
| /* Update PC. */
|
| regcache_write_pc (regs, pc - to + from);
|
| @@ -1650,7 +1699,7 @@ s390_displaced_step_fixup (struct gdbarch *gdbarch,
|
| {
|
| /* Update PC. */
|
| regcache_write_pc (regs, from + insnlen);
|
| - /* Recompute output address in R1. */
|
| + /* Recompute output address in R1. */
|
| regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
|
| amode | (from + i2 * 2));
|
| }
|
| @@ -1715,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;
|
| @@ -1787,19 +1834,19 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
|
| return 0;
|
|
|
| /* If this was successful, we should have found the instruction that
|
| - sets the stack pointer register to the previous value of the stack
|
| + sets the stack pointer register to the previous value of the stack
|
| pointer minus the frame size. */
|
| if (!pv_is_register (*sp, S390_SP_REGNUM))
|
| return 0;
|
|
|
| - /* A frame size of zero at this point can mean either a real
|
| + /* A frame size of zero at this point can mean either a real
|
| frameless function, or else a failure to find the prologue.
|
| - Perform some sanity checks to verify we really have a
|
| + Perform some sanity checks to verify we really have a
|
| frameless function. */
|
| if (sp->k == 0)
|
| {
|
| - /* If the next frame is a NORMAL_FRAME, this frame *cannot* have frame
|
| - size zero. This is only possible if the next frame is a sentinel
|
| + /* If the next frame is a NORMAL_FRAME, this frame *cannot* have frame
|
| + size zero. This is only possible if the next frame is a sentinel
|
| frame, a dummy frame, or a signal trampoline frame. */
|
| /* FIXME: cagney/2004-05-01: This sanity check shouldn't be
|
| needed, instead the code should simpliy rely on its
|
| @@ -1828,8 +1875,8 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
|
| pv_t *sp = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
|
|
|
| if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR)-1, &data2)
|
| - && pv_is_register (*sp, S390_SP_REGNUM)
|
| - && sp->k != 0))
|
| + && pv_is_register (*sp, S390_SP_REGNUM)
|
| + && sp->k != 0))
|
| return 0;
|
| }
|
| }
|
| @@ -1847,8 +1894,8 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
|
| else
|
| frame_pointer = S390_SP_REGNUM;
|
|
|
| - /* If we've detected a function with stack frame, we'll still have to
|
| - treat it as frameless if we're currently within the function epilog
|
| + /* If we've detected a function with stack frame, we'll still have to
|
| + treat it as frameless if we're currently within the function epilog
|
| code at a point where the frame pointer has already been restored.
|
| This can only happen in an innermost frame. */
|
| /* FIXME: cagney/2004-05-01: This sanity check shouldn't be needed,
|
| @@ -1872,7 +1919,7 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
|
|
|
| /* Once we know the frame register and the frame size, we can unwind
|
| the current value of the frame register from the next frame, and
|
| - add back the frame size to arrive that the previous frame's
|
| + add back the frame size to arrive that the previous frame's
|
| stack pointer value. */
|
| prev_sp = get_frame_register_unsigned (this_frame, frame_pointer) + size;
|
| cfa = prev_sp + 16*word_size + 32;
|
| @@ -1970,8 +2017,8 @@ s390_backchain_frame_unwind_cache (struct frame_info *this_frame,
|
| && (CORE_ADDR)sp == backchain)
|
| {
|
| /* We don't know which registers were saved, but it will have
|
| - to be at least %r14 and %r15. This will allow us to continue
|
| - unwinding, but other prev-frame registers may be incorrect ... */
|
| + to be at least %r14 and %r15. This will allow us to continue
|
| + unwinding, but other prev-frame registers may be incorrect ... */
|
| info->saved_regs[S390_SP_REGNUM].addr = backchain + 15*word_size;
|
| info->saved_regs[S390_RETADDR_REGNUM].addr = backchain + 14*word_size;
|
|
|
| @@ -1980,7 +2027,7 @@ s390_backchain_frame_unwind_cache (struct frame_info *this_frame,
|
| = info->saved_regs[S390_RETADDR_REGNUM];
|
|
|
| /* We use the current value of the frame register as local_base,
|
| - and the top of the register save area as frame_base. */
|
| + and the top of the register save area as frame_base. */
|
| info->frame_base = backchain + 16*word_size + 32;
|
| info->local_base = reg;
|
| }
|
| @@ -2113,7 +2160,7 @@ s390_stub_frame_sniffer (const struct frame_unwind *self,
|
| have trapped due to an invalid function pointer call. We handle
|
| the non-existing current function like a PLT stub. */
|
| addr_in_block = get_frame_address_in_block (this_frame);
|
| - if (in_plt_section (addr_in_block, NULL)
|
| + if (in_plt_section (addr_in_block)
|
| || s390_readinstruction (insn, get_frame_pc (this_frame)) < 0)
|
| return 1;
|
| return 0;
|
| @@ -2185,13 +2232,13 @@ s390_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
|
| }
|
|
|
| /* The sigregs structure looks like this:
|
| - long psw_mask;
|
| - long psw_addr;
|
| - long gprs[16];
|
| - int acrs[16];
|
| - int fpc;
|
| - int __pad;
|
| - double fprs[16]; */
|
| + long psw_mask;
|
| + long psw_addr;
|
| + long gprs[16];
|
| + int acrs[16];
|
| + int fpc;
|
| + int __pad;
|
| + double fprs[16]; */
|
|
|
| /* PSW mask and address. */
|
| info->saved_regs[S390_PSWM_REGNUM].addr = sigreg_ptr;
|
| @@ -2229,7 +2276,7 @@ s390_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
|
| if (tdep->gpr_full_regnum != -1)
|
| for (i = 0; i < 16; i++)
|
| {
|
| - info->saved_regs[S390_R0_UPPER_REGNUM + i].addr = sigreg_ptr;
|
| + info->saved_regs[S390_R0_UPPER_REGNUM + i].addr = sigreg_ptr;
|
| sigreg_ptr += 4;
|
| }
|
|
|
| @@ -2280,7 +2327,7 @@ s390_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
| if (sigreturn[1] != 119 /* sigreturn */
|
| && sigreturn[1] != 173 /* rt_sigreturn */)
|
| return 0;
|
| -
|
| +
|
| return 1;
|
| }
|
|
|
| @@ -2348,7 +2395,7 @@ s390_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
|
|
|
| static void
|
| s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
|
| - struct dwarf2_frame_state_reg *reg,
|
| + struct dwarf2_frame_state_reg *reg,
|
| struct frame_info *this_frame)
|
| {
|
| struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
| @@ -2391,10 +2438,10 @@ is_integer_like (struct type *type)
|
| enum type_code code = TYPE_CODE (type);
|
|
|
| return (code == TYPE_CODE_INT
|
| - || code == TYPE_CODE_ENUM
|
| - || code == TYPE_CODE_RANGE
|
| - || code == TYPE_CODE_CHAR
|
| - || code == TYPE_CODE_BOOL);
|
| + || code == TYPE_CODE_ENUM
|
| + || code == TYPE_CODE_RANGE
|
| + || code == TYPE_CODE_CHAR
|
| + || code == TYPE_CODE_BOOL);
|
| }
|
|
|
| /* Return non-zero if TYPE is a pointer-like type, zero otherwise.
|
| @@ -2406,7 +2453,7 @@ is_pointer_like (struct type *type)
|
| enum type_code code = TYPE_CODE (type);
|
|
|
| return (code == TYPE_CODE_PTR
|
| - || code == TYPE_CODE_REF);
|
| + || code == TYPE_CODE_REF);
|
| }
|
|
|
|
|
| @@ -2456,7 +2503,7 @@ is_struct_like (struct type *type)
|
| enum type_code code = TYPE_CODE (type);
|
|
|
| return (code == TYPE_CODE_UNION
|
| - || (code == TYPE_CODE_STRUCT && ! is_float_singleton (type)));
|
| + || (code == TYPE_CODE_STRUCT && ! is_float_singleton (type)));
|
| }
|
|
|
|
|
| @@ -2474,7 +2521,7 @@ is_float_like (struct type *type)
|
| {
|
| return (TYPE_CODE (type) == TYPE_CODE_FLT
|
| || TYPE_CODE (type) == TYPE_CODE_DECFLOAT
|
| - || is_float_singleton (type));
|
| + || is_float_singleton (type));
|
| }
|
|
|
|
|
| @@ -2489,8 +2536,7 @@ is_power_of_two (unsigned int n)
|
| static int
|
| s390_function_arg_pass_by_reference (struct type *type)
|
| {
|
| - unsigned length = TYPE_LENGTH (type);
|
| - if (length > 8)
|
| + if (TYPE_LENGTH (type) > 8)
|
| return 1;
|
|
|
| return (is_struct_like (type) && !is_power_of_two (TYPE_LENGTH (type)))
|
| @@ -2503,8 +2549,7 @@ s390_function_arg_pass_by_reference (struct type *type)
|
| static int
|
| s390_function_arg_float (struct type *type)
|
| {
|
| - unsigned length = TYPE_LENGTH (type);
|
| - if (length > 8)
|
| + if (TYPE_LENGTH (type) > 8)
|
| return 0;
|
|
|
| return is_float_like (type);
|
| @@ -2515,13 +2560,12 @@ s390_function_arg_float (struct type *type)
|
| static int
|
| s390_function_arg_integer (struct type *type)
|
| {
|
| - unsigned length = TYPE_LENGTH (type);
|
| - if (length > 8)
|
| + if (TYPE_LENGTH (type) > 8)
|
| return 0;
|
|
|
| return is_integer_like (type)
|
| || is_pointer_like (type)
|
| - || (is_struct_like (type) && is_power_of_two (length));
|
| + || (is_struct_like (type) && is_power_of_two (TYPE_LENGTH (type)));
|
| }
|
|
|
| /* Return ARG, a `SIMPLE_ARG', sign-extended or zero-extended to a full
|
| @@ -2537,10 +2581,10 @@ extend_simple_arg (struct gdbarch *gdbarch, struct value *arg)
|
| an integer, but it does take care of the extension. */
|
| if (TYPE_UNSIGNED (type))
|
| return extract_unsigned_integer (value_contents (arg),
|
| - TYPE_LENGTH (type), byte_order);
|
| + TYPE_LENGTH (type), byte_order);
|
| else
|
| return extract_signed_integer (value_contents (arg),
|
| - TYPE_LENGTH (type), byte_order);
|
| + TYPE_LENGTH (type), byte_order);
|
| }
|
|
|
|
|
| @@ -2556,19 +2600,19 @@ alignment_of (struct type *type)
|
| || TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
|
| alignment = TYPE_LENGTH (type);
|
| else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
| - || TYPE_CODE (type) == TYPE_CODE_UNION)
|
| + || TYPE_CODE (type) == TYPE_CODE_UNION)
|
| {
|
| int i;
|
|
|
| alignment = 1;
|
| for (i = 0; i < TYPE_NFIELDS (type); i++)
|
| - {
|
| - int field_alignment
|
| + {
|
| + int field_alignment
|
| = alignment_of (check_typedef (TYPE_FIELD_TYPE (type, i)));
|
|
|
| - if (field_alignment > alignment)
|
| - alignment = field_alignment;
|
| - }
|
| + if (field_alignment > alignment)
|
| + alignment = field_alignment;
|
| + }
|
| }
|
| else
|
| alignment = 1;
|
| @@ -2589,7 +2633,7 @@ alignment_of (struct type *type)
|
| SP is the current stack pointer. We must put arguments, links,
|
| padding, etc. whereever they belong, and return the new stack
|
| pointer value.
|
| -
|
| +
|
| If STRUCT_RETURN is non-zero, then the function we're calling is
|
| going to return a structure by value; STRUCT_ADDR is the address of
|
| a block we've allocated for it on the stack.
|
| @@ -2616,19 +2660,18 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
| {
|
| struct value *arg = args[i];
|
| struct type *type = check_typedef (value_type (arg));
|
| - unsigned length = TYPE_LENGTH (type);
|
|
|
| if (s390_function_arg_pass_by_reference (type))
|
| - {
|
| - sp -= length;
|
| - sp = align_down (sp, alignment_of (type));
|
| - copy_addr[i] = sp;
|
| - }
|
| + {
|
| + sp -= TYPE_LENGTH (type);
|
| + sp = align_down (sp, alignment_of (type));
|
| + copy_addr[i] = sp;
|
| + }
|
| }
|
|
|
| /* Reserve space for the parameter area. As a conservative
|
| simplification, we assume that everything will be passed on the
|
| - stack. Since every argument larger than 8 bytes will be
|
| + stack. Since every argument larger than 8 bytes will be
|
| passed by reference, we use this simple upper bound. */
|
| sp -= nargs * 8;
|
|
|
| @@ -2661,15 +2704,15 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
| if (struct_return)
|
| {
|
| regcache_cooked_write_unsigned (regcache, S390_R0_REGNUM + gr,
|
| - struct_addr);
|
| + struct_addr);
|
| gr++;
|
| }
|
|
|
| for (i = 0; i < nargs; i++)
|
| {
|
| - struct value *arg = args[i];
|
| - struct type *type = check_typedef (value_type (arg));
|
| - unsigned length = TYPE_LENGTH (type);
|
| + struct value *arg = args[i];
|
| + struct type *type = check_typedef (value_type (arg));
|
| + unsigned length = TYPE_LENGTH (type);
|
|
|
| if (s390_function_arg_pass_by_reference (type))
|
| {
|
| @@ -2680,7 +2723,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
| if (gr <= 6)
|
| {
|
| regcache_cooked_write_unsigned (regcache, S390_R0_REGNUM + gr,
|
| - copy_addr[i]);
|
| + copy_addr[i]);
|
| gr++;
|
| }
|
| else
|
| @@ -2707,7 +2750,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
| /* When we store a single-precision value in a stack slot,
|
| it occupies the rightmost bits. */
|
| starg = align_up (starg + length, word_size);
|
| - write_memory (starg - length, value_contents (arg), length);
|
| + write_memory (starg - length, value_contents (arg), length);
|
| }
|
| }
|
| else if (s390_function_arg_integer (type) && length <= word_size)
|
| @@ -2724,8 +2767,8 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
| {
|
| /* Integer arguments are always extended to word size. */
|
| write_memory_signed_integer (starg, word_size, byte_order,
|
| - extend_simple_arg (gdbarch, arg));
|
| - starg += word_size;
|
| + extend_simple_arg (gdbarch, arg));
|
| + starg += word_size;
|
| }
|
| }
|
| else if (s390_function_arg_integer (type) && length == 2*word_size)
|
| @@ -2782,7 +2825,7 @@ s390_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
| sp = gdbarch_addr_bits_remove (gdbarch, sp);
|
|
|
| return frame_id_build (sp + 16*word_size + 32,
|
| - get_frame_pc (this_frame));
|
| + get_frame_pc (this_frame));
|
| }
|
|
|
| static CORE_ADDR
|
| @@ -2799,8 +2842,7 @@ s390_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
|
| static enum return_value_convention
|
| s390_return_value_convention (struct gdbarch *gdbarch, struct type *type)
|
| {
|
| - int length = TYPE_LENGTH (type);
|
| - if (length > 8)
|
| + if (TYPE_LENGTH (type) > 8)
|
| return RETURN_VALUE_STRUCT_CONVENTION;
|
|
|
| switch (TYPE_CODE (type))
|
| @@ -2840,7 +2882,7 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
|
| {
|
| /* When we store a single-precision value in an FP register,
|
| it occupies the leftmost bits. */
|
| - regcache_cooked_write_part (regcache, S390_F0_REGNUM,
|
| + regcache_cooked_write_part (regcache, S390_F0_REGNUM,
|
| 0, length, in);
|
| }
|
| else if (length <= word_size)
|
| @@ -2877,13 +2919,13 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
|
| {
|
| /* When we store a single-precision value in an FP register,
|
| it occupies the leftmost bits. */
|
| - regcache_cooked_read_part (regcache, S390_F0_REGNUM,
|
| + regcache_cooked_read_part (regcache, S390_F0_REGNUM,
|
| 0, length, out);
|
| }
|
| else if (length <= word_size)
|
| {
|
| /* Integer arguments occupy the rightmost bits. */
|
| - regcache_cooked_read_part (regcache, S390_R2_REGNUM,
|
| + regcache_cooked_read_part (regcache, S390_R2_REGNUM,
|
| word_size - length, length, out);
|
| }
|
| else if (length == 2*word_size)
|
| @@ -3032,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;
|
|
|
| @@ -3109,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);
|
| @@ -3164,7 +3221,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
| set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_dwarf_reg_to_regnum);
|
| set_gdbarch_value_from_register (gdbarch, s390_value_from_register);
|
| set_gdbarch_regset_from_core_section (gdbarch,
|
| - s390_regset_from_core_section);
|
| + s390_regset_from_core_section);
|
| set_gdbarch_core_read_description (gdbarch, s390_core_read_description);
|
| set_gdbarch_cannot_store_register (gdbarch, s390_cannot_store_register);
|
| set_gdbarch_write_pc (gdbarch, s390_write_pc);
|
| @@ -3173,7 +3230,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
| set_tdesc_pseudo_register_name (gdbarch, s390_pseudo_register_name);
|
| set_tdesc_pseudo_register_type (gdbarch, s390_pseudo_register_type);
|
| set_tdesc_pseudo_register_reggroup_p (gdbarch,
|
| - s390_pseudo_register_reggroup_p);
|
| + s390_pseudo_register_reggroup_p);
|
| tdesc_use_registers (gdbarch, tdesc, tdesc_data);
|
|
|
| /* Assign pseudo register numbers. */
|
| @@ -3210,12 +3267,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|
|
| /* Displaced stepping. */
|
| set_gdbarch_displaced_step_copy_insn (gdbarch,
|
| - simple_displaced_step_copy_insn);
|
| + simple_displaced_step_copy_insn);
|
| set_gdbarch_displaced_step_fixup (gdbarch, s390_displaced_step_fixup);
|
| set_gdbarch_displaced_step_free_closure (gdbarch,
|
| - simple_displaced_step_free_closure);
|
| + simple_displaced_step_free_closure);
|
| set_gdbarch_displaced_step_location (gdbarch,
|
| - displaced_step_at_entry_point);
|
| + displaced_step_at_entry_point);
|
| set_gdbarch_max_insn_length (gdbarch, S390_MAX_INSTR_SIZE);
|
|
|
| /* Note that GNU/Linux is the only OS supported on this
|
| @@ -3272,11 +3329,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
| set_solib_svr4_fetch_link_map_offsets
|
| (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
| set_gdbarch_address_class_type_flags (gdbarch,
|
| - s390_address_class_type_flags);
|
| + s390_address_class_type_flags);
|
| set_gdbarch_address_class_type_flags_to_name (gdbarch,
|
| - s390_address_class_type_flags_to_name);
|
| + s390_address_class_type_flags_to_name);
|
| set_gdbarch_address_class_name_to_type_flags (gdbarch,
|
| - s390_address_class_name_to_type_flags);
|
| + s390_address_class_name_to_type_flags);
|
|
|
| if (have_linux_v2)
|
| set_gdbarch_core_regset_sections (gdbarch,
|
| @@ -3296,7 +3353,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|
|
| /* Enable TLS support. */
|
| set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
| - svr4_fetch_objfile_link_map);
|
| + svr4_fetch_objfile_link_map);
|
|
|
| set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
|
|
|
| @@ -3325,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 ();
|
| }
|
|
|