/* Target-dependent code for GNU/Linux on s390.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
s390_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
void *cb_data,
const struct regcache *regcache)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const int gregset_size = (tdep->abi == ABI_LINUX_S390 ?
s390_sizeof_gregset : s390x_sizeof_gregset);
struct s390_sigtramp_unwind_cache {
CORE_ADDR frame_base;
- struct trad_frame_saved_reg *saved_regs;
+ trad_frame_saved_reg *saved_regs;
};
/* Unwind THIS_FRAME and return the corresponding unwind cache for
void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct s390_sigtramp_unwind_cache *info;
double fprs[16]; */
/* PSW mask and address. */
- info->saved_regs[S390_PSWM_REGNUM].addr = sigreg_ptr;
+ info->saved_regs[S390_PSWM_REGNUM].set_addr (sigreg_ptr);
sigreg_ptr += word_size;
- info->saved_regs[S390_PSWA_REGNUM].addr = sigreg_ptr;
+ info->saved_regs[S390_PSWA_REGNUM].set_addr (sigreg_ptr);
sigreg_ptr += word_size;
/* Then the GPRs. */
for (i = 0; i < 16; i++)
{
- info->saved_regs[S390_R0_REGNUM + i].addr = sigreg_ptr;
+ info->saved_regs[S390_R0_REGNUM + i].set_addr (sigreg_ptr);
sigreg_ptr += word_size;
}
/* Then the ACRs. */
for (i = 0; i < 16; i++)
{
- info->saved_regs[S390_A0_REGNUM + i].addr = sigreg_ptr;
+ info->saved_regs[S390_A0_REGNUM + i].set_addr (sigreg_ptr);
sigreg_ptr += 4;
}
/* The floating-point control word. */
- info->saved_regs[S390_FPC_REGNUM].addr = sigreg_ptr;
+ info->saved_regs[S390_FPC_REGNUM].set_addr (sigreg_ptr);
sigreg_ptr += 8;
/* And finally the FPRs. */
for (i = 0; i < 16; i++)
{
- info->saved_regs[S390_F0_REGNUM + i].addr = sigreg_ptr;
+ info->saved_regs[S390_F0_REGNUM + i].set_addr (sigreg_ptr);
sigreg_ptr += 8;
}
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].set_addr (sigreg_ptr);
sigreg_ptr += 4;
}
/* Restore the previous frame's SP. */
prev_sp = read_memory_unsigned_integer (
- info->saved_regs[S390_SP_REGNUM].addr,
+ info->saved_regs[S390_SP_REGNUM].addr (),
word_size, byte_order);
/* Determine our frame base. */
/* S390 sigtramp frame unwinder. */
static const struct frame_unwind s390_sigtramp_frame_unwind = {
+ "s390 linux sigtramp",
SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
s390_sigtramp_frame_this_id,
thread_info *thread)
{
struct regcache *regs = get_thread_regcache (thread);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST pc;
ULONGEST svc_number = -1;
s390_all_but_pc_registers_record (struct regcache *regcache)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int i;
for (i = 0; i < 16; i++)
{
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + i))
- return -1;
+ return -1;
if (record_full_arch_list_add_reg (regcache, S390_A0_REGNUM + i))
- return -1;
+ return -1;
if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + i))
- return -1;
+ return -1;
if (tdep->gpr_full_regnum != -1)
- if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
- return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
+ return -1;
if (tdep->v0_full_regnum != -1)
- {
- if (record_full_arch_list_add_reg (regcache, S390_V0_LOWER_REGNUM + i))
- return -1;
- if (record_full_arch_list_add_reg (regcache, S390_V16_REGNUM + i))
- return -1;
- }
+ {
+ if (record_full_arch_list_add_reg (regcache, S390_V0_LOWER_REGNUM + i))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_V16_REGNUM + i))
+ return -1;
+ }
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
case 197: /* fstat64 */
case 221: /* fcntl64 */
if (abi == ABI_LINUX_S390)
- return (enum gdb_syscall) syscall;
+ return (enum gdb_syscall) syscall;
return gdb_sys_no_syscall;
/* These syscalls don't exist on s390. */
case 17: /* break */
return gdb_sys_readahead;
case 223:
if (abi == ABI_LINUX_S390)
- return gdb_sys_sendfile64;
+ return gdb_sys_sendfile64;
return gdb_sys_no_syscall;
/* 224-235 handled below */
case 236:
/* 263 reserved */
case 264:
if (abi == ABI_LINUX_S390)
- return gdb_sys_fadvise64_64;
+ return gdb_sys_fadvise64_64;
return gdb_sys_no_syscall;
case 265:
return gdb_sys_statfs64;
/* 282-312 handled below */
case 293:
if (abi == ABI_LINUX_S390)
- return gdb_sys_fstatat64;
+ return gdb_sys_fstatat64;
return gdb_sys_newfstatat;
/* 313+ not yet supported */
default:
s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ret;
enum gdb_syscall syscall_gdb;
if (syscall_gdb < 0)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (syscall_native));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ plongest (syscall_native));
return -1;
}
|| syscall_gdb == gdb_sys_rt_sigreturn)
{
if (s390_all_but_pc_registers_record (regcache))
- return -1;
+ return -1;
return 0;
}
if (tdep->abi == ABI_LINUX_ZSERIES)
ret = record_linux_system_call (syscall_gdb, regcache,
- &s390x_linux_record_tdep);
+ &s390x_linux_record_tdep);
else
ret = record_linux_system_call (syscall_gdb, regcache,
- &s390_linux_record_tdep);
+ &s390_linux_record_tdep);
if (ret)
return ret;
static int
s390_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
- enum gdb_signal signal)
+ enum gdb_signal signal)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* There are two kinds of signal frames on s390. rt_sigframe is always
the larger one, so don't even bother with sigframe. */
const int sizeof_rt_sigframe = (tdep->abi == ABI_LINUX_ZSERIES ?
- 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
+ 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
ULONGEST sp;
int i;
for (i = 0; i < 16; i++)
{
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + i))
- return -1;
+ return -1;
if (tdep->gpr_full_regnum != -1)
- if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
- return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
+ return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWA_REGNUM))
return -1;
static void
s390_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
- enum s390_abi_kind abi)
+ enum s390_abi_kind abi)
{
/* These values are the size of the type that will be used in a system
call. They are obtained from Linux Kernel source. */
static void
s390_linux_init_abi_any (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->s390_syscall_record = s390_linux_syscall_record;
- linux_init_abi (info, gdbarch);
+ linux_init_abi (info, gdbarch, 1);
/* Register handling. */
set_gdbarch_core_read_description (gdbarch, s390_core_read_description);
static void
s390_linux_init_abi_31 (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->abi = ABI_LINUX_S390;
s390_linux_init_abi_any (info, gdbarch);
set_solib_svr4_fetch_link_map_offsets (gdbarch,
- svr4_ilp32_fetch_link_map_offsets);
+ linux_ilp32_fetch_link_map_offsets);
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390);
}
static void
s390_linux_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->abi = ABI_LINUX_ZSERIES;
s390_linux_init_abi_any (info, gdbarch);
set_solib_svr4_fetch_link_map_offsets (gdbarch,
- svr4_lp64_fetch_link_map_offsets);
+ linux_lp64_fetch_link_map_offsets);
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390X);
}
+void _initialize_s390_linux_tdep ();
void
-_initialize_s390_linux_tdep (void)
+_initialize_s390_linux_tdep ()
{
/* Hook us into the OSABI mechanism. */
gdbarch_register_osabi (bfd_arch_s390, bfd_mach_s390_31, GDB_OSABI_LINUX,