33 #include "elf/common.h"
35 #include <asm/ptrace.h>
36 #include <sys/ptrace.h>
37 #include <asm/types.h>
38 #include <sys/procfs.h>
39 #include <sys/ucontext.h>
84 static const struct regset s390_64_gregset =
86 s390_64_regmap_gregset,
91 #define S390_PSWM_OFFSET 0
92 #define S390_PSWA_OFFSET 8
116 + S390_PSWM_OFFSET, 8, byte_order);
118 + S390_PSWA_OFFSET, 8, byte_order);
122 (pswa & 0x7fffffff) | (pswm & 0x80000000));
169 pswm ^= (pswm ^ pswa) & 0x80000000;
223 parea.len =
sizeof (regs);
224 parea.process_addr = (addr_t) ®s;
225 parea.kernel_addr = offsetof (
struct user_regs_struct, psw);
226 if (
ptrace (PTRACE_PEEKUSR_AREA, tid, (
long) &parea) < 0)
240 parea.len =
sizeof (regs);
241 parea.process_addr = (addr_t) ®s;
242 parea.kernel_addr = offsetof (
struct user_regs_struct, psw);
243 if (
ptrace (PTRACE_PEEKUSR_AREA, tid, (
long) &parea) < 0)
248 if (
ptrace (PTRACE_POKEUSR_AREA, tid, (
long) &parea) < 0)
260 parea.len =
sizeof (fpregs);
261 parea.process_addr = (addr_t) &fpregs;
262 parea.kernel_addr = offsetof (
struct user_regs_struct, fp_regs);
263 if (
ptrace (PTRACE_PEEKUSR_AREA, tid, (
long) &parea) < 0)
277 parea.len =
sizeof (fpregs);
278 parea.process_addr = (addr_t) &fpregs;
279 parea.kernel_addr = offsetof (
struct user_regs_struct, fp_regs);
280 if (
ptrace (PTRACE_PEEKUSR_AREA, tid, (
long) &parea) < 0)
285 if (
ptrace (PTRACE_POKEUSR_AREA, tid, (
long) &parea) < 0)
295 int regset_id,
int regsize,
const struct regset *
regset)
301 iov.iov_len = regsize;
305 if (errno == ENODATA)
319 int regset_id,
int regsize,
const struct regset *
regset)
325 iov.iov_len = regsize;
345 iov.iov_len = regsize;
391 fetch_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16,
425 store_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16,
451 per_lowcore_bits per_lowcore;
459 parea.len =
sizeof (per_lowcore);
460 parea.process_addr = (addr_t) & per_lowcore;
461 parea.kernel_addr = offsetof (
struct user_regs_struct, per_info.lowcore);
465 result = (per_lowcore.perc_storage_alteration == 1
466 && per_lowcore.perc_store_real_address == 0);
471 memset (&per_lowcore, 0,
sizeof (per_lowcore));
502 for (area = watch_base; area; area = area->
next)
504 watch_lo_addr =
min (watch_lo_addr, area->
lo_addr);
505 watch_hi_addr =
max (watch_hi_addr, area->
hi_addr);
508 parea.len =
sizeof (per_info);
509 parea.process_addr = (addr_t) & per_info;
510 parea.kernel_addr = offsetof (
struct user_regs_struct, per_info);
511 if (
ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0)
516 per_info.control_regs.bits.em_storage_alteration = 1;
517 per_info.control_regs.bits.storage_alt_space_ctl = 1;
521 per_info.control_regs.bits.em_storage_alteration = 0;
522 per_info.control_regs.bits.storage_alt_space_ctl = 0;
524 per_info.starting_addr = watch_lo_addr;
525 per_info.ending_addr = watch_hi_addr;
527 if (
ptrace (PTRACE_POKEUSR_AREA, tid, &parea) < 0)
567 area->
hi_addr = addr + len - 1;
585 for (parea = &watch_base; *parea; parea = &(*parea)->
next)
586 if ((*parea)->lo_addr == addr
587 && (*parea)->hi_addr == addr + len - 1)
593 "Attempt to remove nonexistent watchpoint.\n");
608 int type,
int cnt,
int othertype)
632 if (errno == 0 && (pswm & 0x100000000ul) != 0)
650 if (endptr - ptr < sizeof_auxv_field * 2)
654 ptr += sizeof_auxv_field;
656 ptr += sizeof_auxv_field;
struct gdbarch * target_gdbarch(void)
static int s390_remove_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
#define S390_V15_LOWER_REGNUM
void supply_fpregset(struct regcache *regcache, const fpregset_t *regp)
struct arch_lwp_info * arch_private
static int s390_target_wordsize(void)
static void fetch_fpregs(struct regcache *regcache, int tid)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
static void fetch_regs(struct regcache *regcache, int tid)
static int have_regset_tdb
struct target_desc * tdesc_s390_vx_linux64
const struct target_desc *(* to_read_description)(struct target_ops *ops) TARGET_DEFAULT_RETURN(NULL)
#define S390_SYSTEM_CALL_REGNUM
struct target_desc * tdesc_s390_te_linux64
void fill_gregset(const struct regcache *regcache, gregset_t *regp, int regno)
struct target_desc * tdesc_s390_linux32v1
void linux_stop_lwp(struct lwp_info *lwp)
static int s390_can_use_hw_breakpoint(struct target_ops *self, int type, int cnt, int othertype)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
static const struct target_desc * s390_read_description(struct target_ops *ops)
void linux_nat_set_new_thread(struct target_ops *t, void(*new_thread)(struct lwp_info *))
struct target_desc * tdesc_s390x_tevx_linux64
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
static int have_regset_system_call
#define S390_R6_UPPER_REGNUM
static void s390_prepare_to_resume(struct lwp_info *lp)
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
#define S390_R2_UPPER_REGNUM
const struct regset s390_gregset
static int have_regset_last_break
struct target_desc * tdesc_s390_linux64v2
struct target_desc * tdesc_s390_linux32v2
int(* to_region_ok_for_hw_watchpoint)(struct target_ops *, CORE_ADDR, int) TARGET_DEFAULT_FUNC(default_region_ok_for_hw_watchpoint)
const struct regset s390_fpregset
static int s390_insert_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
#define S390_IS_GREGSET_REGNUM(i)
struct target_desc * tdesc_s390_tevx_linux64
#define S390_R11_UPPER_REGNUM
#define S390_R4_UPPER_REGNUM
void supply_gregset(struct regcache *regcache, const gregset_t *regp)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
#define S390_R7_UPPER_REGNUM
int(* to_insert_watchpoint)(struct target_ops *, CORE_ADDR, int, int, struct expression *) TARGET_DEFAULT_RETURN(-1)
static void store_regset(struct regcache *regcache, int tid, int regset_id, int regsize, const struct regset *regset)
const struct regset s390_vxrs_low_regset
static int s390_inferior_tid(void)
struct target_ops current_target
static void s390_refresh_per_info(struct lwp_info *lp)
const struct regset s390_last_break_regset
int(* to_remove_watchpoint)(struct target_ops *, CORE_ADDR, int, int, struct expression *) TARGET_DEFAULT_RETURN(-1)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
int target_auxv_search(struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void linux_nat_set_prepare_to_resume(struct target_ops *t, void(*prepare_to_resume)(struct lwp_info *))
#define S390_R0_UPPER_REGNUM
#define S390_LAST_BREAK_REGNUM
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
static int s390_auxv_parse(struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
#define S390_R13_UPPER_REGNUM
struct target_desc * tdesc_s390_linux64v1
void linux_nat_add_target(struct target_ops *t)
struct target_desc * tdesc_s390x_vx_linux64
const struct regset s390x_last_break_regset
static void s390_linux_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
const struct regset s390_system_call_regset
struct target_ops * linux_target(void)
const struct regset s390_vxrs_high_regset
void fill_fpregset(const struct regcache *regcache, fpregset_t *regp, int regno)
int ptid_get_pid(ptid_t ptid)
#define S390_ORIG_R2_REGNUM
int(* to_auxv_parse)(struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) TARGET_DEFAULT_FUNC(default_auxv_parse)
#define S390_R3_UPPER_REGNUM
static void s390_new_thread(struct lwp_info *lp)
static int have_regset_vxrs
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
struct target_desc * tdesc_s390x_linux64v2
int(* to_can_use_hw_breakpoint)(struct target_ops *, int, int, int) TARGET_DEFAULT_RETURN(0)
static void fetch_regset(struct regcache *regcache, int tid, int regset_id, int regsize, const struct regset *regset)
struct target_desc * tdesc_s390x_linux64v1
struct ui_file * gdb_stderr
#define S390_IS_FPREGSET_REGNUM(i)
const struct regset s390_tdb_regset
static struct watch_area * watch_base
static int check_regset(int tid, int regset, int regsize)
#define S390_R10_UPPER_REGNUM
#define S390_IS_TDBREGSET_REGNUM(i)
struct target_desc * tdesc_s390_linux32
int(* to_stopped_by_watchpoint)(struct target_ops *) TARGET_DEFAULT_RETURN(0)
#define S390_R5_UPPER_REGNUM
struct target_desc * tdesc_s390x_linux64
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
int to_have_continuable_watchpoint
#define S390_R15_UPPER_REGNUM
void _initialize_s390_nat(void)
unsigned long long ULONGEST
#define S390_R12_UPPER_REGNUM
static void store_fpregs(const struct regcache *regcache, int tid, int regnum)
long ptid_get_lwp(ptid_t ptid)
#define S390_V0_LOWER_REGNUM
#define S390_R8_UPPER_REGNUM
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
static int s390_region_ok_for_hw_watchpoint(struct target_ops *self, CORE_ADDR addr, int cnt)
#define S390_R14_UPPER_REGNUM
struct target_desc * tdesc_s390x_te_linux64
struct target_desc * tdesc_s390_linux64
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
#define s390_sizeof_tdbregset
enum bfd_endian byte_order
#define HWCAP_S390_HIGH_GPRS
#define S390_R1_UPPER_REGNUM
static void s390_linux_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
static int s390_stopped_by_watchpoint(struct target_ops *ops)
#define S390_R9_UPPER_REGNUM
const ULONGEST const LONGEST len
static void store_regs(const struct regcache *regcache, int tid, int regnum)