+ int tid;
+
+ /* Use the old method of peeking around in `struct user' if the
+ GETREGS request isn't available. */
+ if (! have_ptrace_getregs)
+ {
+ old_fetch_inferior_registers (regcache, regno);
+ return;
+ }
+
+ /* GNU/Linux LWP ID's are process ID's. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+
+ /* Use the PTRACE_GETFPXREGS request whenever possible, since it
+ transfers more registers in one system call, and we'll cache the
+ results. But remember that fetch_fpxregs can fail, and return
+ zero. */
+ if (regno == -1)
+ {
+ fetch_regs (regcache, tid);
+
+ /* The call above might reset `have_ptrace_getregs'. */
+ if (! have_ptrace_getregs)
+ {
+ old_fetch_inferior_registers (regcache, -1);
+ return;
+ }
+
+ fetch_fpregs (regcache, tid);
+ return;
+ }
+
+ if (getregs_supplies (regno))
+ {
+ fetch_regs (regcache, tid);
+ return;
+ }
+
+ if (getfpregs_supplies (regno))
+ {
+ fetch_fpregs (regcache, tid);
+ return;
+ }
+
+ internal_error (__FILE__, __LINE__,
+ _("Got request for bad register number %d."), regno);
+}
+
+/* Store register REGNO back into the child process. If REGNO is -1,
+ do this for all registers (including the floating point and SSE
+ registers). */
+static void
+m68k_linux_store_inferior_registers (struct regcache *regcache, int regno)
+{
+ int tid;
+
+ /* Use the old method of poking around in `struct user' if the
+ SETREGS request isn't available. */
+ if (! have_ptrace_getregs)
+ {
+ old_store_inferior_registers (regcache, regno);
+ return;
+ }
+
+ /* GNU/Linux LWP ID's are process ID's. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+
+ /* Use the PTRACE_SETFPREGS requests whenever possible, since it
+ transfers more registers in one system call. But remember that
+ store_fpregs can fail, and return zero. */
+ if (regno == -1)
+ {
+ store_regs (regcache, tid, regno);
+ store_fpregs (regcache, tid, regno);
+ return;
+ }
+
+ if (getregs_supplies (regno))
+ {
+ store_regs (regcache, tid, regno);
+ return;
+ }
+
+ if (getfpregs_supplies (regno))
+ {
+ store_fpregs (regcache, tid, regno);
+ return;
+ }
+
+ internal_error (__FILE__, __LINE__,
+ _("Got request to store bad register number %d."), regno);