S390: Add guarded-storage register support to GDB

Recognize targets with the new guarded-storage feature and then present
the guarded-storage registers and the Linux-specific guarded-storage
broadcast control block appropriately.

gdb/ChangeLog:

	* s390-linux-nat.c (have_regset_gs): New static variable.
	(s390_linux_fetch_inferior_registers): Handle guarded-storage
	control block and guarded-storage broadcast control regsets.
	(s390_read_description): Detect whether the target has
	guarded-storage support, return appropriate tdesc.
	* s390-linux-tdep.c (features/s390-gs-linux64.c): New include.
	(features/s390x-gs-linux64.c): Likewise.
	(struct gdbarch_tdep) <have_gs>: New field.
	(s390_regmap_gs, s390_regmap_gsbc, s390_gs_regset)
	(s390_gsbc_regset): New variables.
	(s390_iterate_over_regset_sections): Iterate over s390_gs_regset
	and s390_gsbc_regset, if applicable.
	(s390_core_read_description): Check whether core file was from a
	target with guarded-storage support; include appropriate regsets.
	(s390_gdbarch_init): Add registers for guarded-storage support.
	(_initialize_s390_tdep): Initialize new target descriptions that
	include registers for guarded-storage support.
	* s390-linux-tdep.h (HWCAP_S390_GS, S390_GSD_REGNUM)
	(S390_GSSM_REGNUM, S390_GSEPLA_REGNUM)
	(S390_BC_GSD_REGNUM, S390_BC_GSSM_REGNUM): New defines.
	(S390_NUM_REGS): Adjust macro definition.
	(s390_gs_regset, s390_gsbc_regset, tdesc_s390_gs_linux64)
	(tdesc_s390x_gs_linux64): New declarations.
This commit is contained in:
Andreas Arnez 2017-09-25 16:02:23 +02:00
parent 96235dc1ac
commit 1b63490c91
4 changed files with 153 additions and 6 deletions

View file

@ -54,6 +54,7 @@ static int have_regset_last_break = 0;
static int have_regset_system_call = 0;
static int have_regset_tdb = 0;
static int have_regset_vxrs = 0;
static int have_regset_gs = 0;
/* Register map for 32-bit executables running under a 64-bit
kernel. */
@ -406,6 +407,18 @@ s390_linux_fetch_inferior_registers (struct target_ops *ops,
fetch_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16,
&s390_vxrs_high_regset);
}
if (have_regset_gs)
{
if (regnum == -1 || (regnum >= S390_GSD_REGNUM
&& regnum <= S390_GSEPLA_REGNUM))
fetch_regset (regcache, tid, NT_S390_GS_CB, 4 * 8,
&s390_gs_regset);
if (regnum == -1 || (regnum >= S390_BC_GSD_REGNUM
&& regnum <= S390_BC_GSEPLA_REGNUM))
fetch_regset (regcache, tid, NT_S390_GS_BC, 4 * 8,
&s390_gsbc_regset);
}
}
/* Store register REGNUM back into the child process. If REGNUM is
@ -974,8 +987,13 @@ s390_read_description (struct target_ops *ops)
&& check_regset (tid, NT_S390_VXRS_LOW, 16 * 8)
&& check_regset (tid, NT_S390_VXRS_HIGH, 16 * 16);
have_regset_gs = (hwcap & HWCAP_S390_GS)
&& check_regset (tid, NT_S390_GS_CB, 4 * 8)
&& check_regset (tid, NT_S390_GS_BC, 4 * 8);
if (s390_target_wordsize () == 8)
return (have_regset_vxrs ?
return (have_regset_gs ? tdesc_s390x_gs_linux64 :
have_regset_vxrs ?
(have_regset_tdb ? tdesc_s390x_tevx_linux64 :
tdesc_s390x_vx_linux64) :
have_regset_tdb ? tdesc_s390x_te_linux64 :
@ -984,7 +1002,8 @@ s390_read_description (struct target_ops *ops)
tdesc_s390x_linux64);
if (hwcap & HWCAP_S390_HIGH_GPRS)
return (have_regset_vxrs ?
return (have_regset_gs ? tdesc_s390_gs_linux64 :
have_regset_vxrs ?
(have_regset_tdb ? tdesc_s390_tevx_linux64 :
tdesc_s390_vx_linux64) :
have_regset_tdb ? tdesc_s390_te_linux64 :