+
+
+/* Fetch one register. */
+
+static void
+fetch_register (struct regcache *regcache, int regno)
+{
+ struct gdbarch *gdbarch = regcache->arch ();
+ pid_t tid;
+ int val;
+
+ if (gdbarch_cannot_fetch_register (gdbarch, regno))
+ {
+ regcache->raw_supply (regno, NULL);
+ return;
+ }
+
+ tid = get_ptrace_pid (regcache->ptid ());
+
+ errno = 0;
+ val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
+ if (errno != 0)
+ error (_("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno),
+ regno, safe_strerror (errno));
+
+ regcache->raw_supply (regno, &val);
+}
+
+/* Store one register. */
+
+static void
+store_register (const struct regcache *regcache, int regno)
+{
+ struct gdbarch *gdbarch = regcache->arch ();
+ pid_t tid;
+ int val;
+
+ if (gdbarch_cannot_store_register (gdbarch, regno))
+ return;
+
+ tid = get_ptrace_pid (regcache->ptid ());
+
+ errno = 0;
+ regcache->raw_collect (regno, &val);
+ ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
+ if (errno != 0)
+ error (_("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno),
+ regno, safe_strerror (errno));
+}
+
+/* Fetch registers from the child process. Fetch all registers if
+ regno == -1, otherwise fetch all general registers or all floating
+ point registers depending upon the value of regno. */
+
+void
+hppa_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
+{
+ if (-1 == regno)
+ {
+ for (regno = 0;
+ regno < gdbarch_num_regs (regcache->arch ());
+ regno++)
+ fetch_register (regcache, regno);
+ }
+ else
+ {
+ fetch_register (regcache, regno);
+ }
+}
+
+/* Store registers back into the inferior. Store all registers if
+ regno == -1, otherwise store all general registers or all floating
+ point registers depending upon the value of regno. */
+
+void
+hppa_linux_nat_target::store_registers (struct regcache *regcache, int regno)
+{
+ if (-1 == regno)
+ {
+ for (regno = 0;
+ regno < gdbarch_num_regs (regcache->arch ());
+ regno++)
+ store_register (regcache, regno);
+ }
+ else
+ {
+ store_register (regcache, regno);
+ }
+}
+
+/* Fill GDB's register array with the general-purpose register values
+ in *gregsetp. */
+