static void ppc_linux_collect_gregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len) { const struct ppc_reg_offsets *offsets = regset->descr; /* Clear areas in the linux gregset not written elsewhere. */ if (regnum == -1) memset (gregs, 0, len); ppc_collect_gregset (regset, regcache, regnum, gregs, len); if (ppc_linux_trap_reg_p (get_regcache_arch (regcache))) { /* "orig_r3" is stored 2 slots after "pc". */ if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM) ppc_collect_reg (regcache, PPC_ORIG_R3_REGNUM, gregs, offsets->pc_offset + 2 * offsets->gpr_size, offsets->gpr_size); /* "trap" is stored 8 slots after "pc". */ if (regnum == -1 || regnum == PPC_TRAP_REGNUM) ppc_collect_reg (regcache, PPC_TRAP_REGNUM, gregs, offsets->pc_offset + 8 * offsets->gpr_size, offsets->gpr_size); } }
static void rs6000_aix_collect_regset (const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len) { ppc_collect_gregset (regset, regcache, regnum, gregs, len); ppc_collect_fpregset (regset, regcache, regnum, gregs, len); }
void ppcobsd_collect_gregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len) { ppc_collect_gregset (regset, regcache, regnum, gregs, len); ppc_collect_fpregset (regset, regcache, regnum, gregs, len); }
static void ppc_linux_collect_gregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len) { if (regnum == -1) memset (gregs, 0, len); ppc_collect_gregset (regset, regcache, regnum, gregs, len); }
void fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno) { const struct regset *regset = ppc_linux_gregset (sizeof (long)); if (regno == -1) memset (gregsetp, 0, sizeof (*gregsetp)); ppc_collect_gregset (regset, regcache, regno, gregsetp, sizeof (*gregsetp)); }
static void ppcobsd_store_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct reg regs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); ppc_collect_gregset (&ppcobsd_gregset, regcache, regnum, ®s, sizeof regs); #ifndef PT_GETFPREGS ppc_collect_fpregset (&ppcobsd_gregset, regcache, regnum, ®s, sizeof regs); #endif if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); #ifdef PT_GETFPREGS if (regnum == -1 || getfpregs_supplies (get_regcache_arch (regcache), regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); ppc_collect_fpregset (&ppcobsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't write floating point status")); } #endif }
static void ppcnbsd_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); ppc_collect_gregset (&ppcnbsd_gregset, regcache, regnum, ®s, sizeof regs); if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); } if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_collect_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't set FP registers")); } }