+ for (regi = gdbarch_fp0_regnum (gdbarch);
+ regi < gdbarch_fp0_regnum (gdbarch) + 8; regi++)
+ regcache_raw_supply (regcache, regi,
+ FPREG_ADDR (fpregsetp,
+ regi - gdbarch_fp0_regnum (gdbarch)));
+ regcache_raw_supply (regcache, M68K_FPC_REGNUM, &fpregsetp->fpcntl[0]);
+ regcache_raw_supply (regcache, M68K_FPS_REGNUM, &fpregsetp->fpcntl[1]);
+ regcache_raw_supply (regcache, M68K_FPI_REGNUM, &fpregsetp->fpcntl[2]);
+}
+
+/* Fill register REGNO (if it is a floating-point register) in
+ *FPREGSETP with the value in GDB's register array. If REGNO is -1,
+ do this for all registers. */
+
+void
+fill_fpregset (const struct regcache *regcache,
+ elf_fpregset_t *fpregsetp, int regno)
+{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int i;
+
+ /* Fill in the floating-point registers. */
+ for (i = gdbarch_fp0_regnum (gdbarch);
+ i < gdbarch_fp0_regnum (gdbarch) + 8; i++)
+ if (regno == -1 || regno == i)
+ regcache_raw_collect (regcache, i,
+ FPREG_ADDR (fpregsetp,
+ i - gdbarch_fp0_regnum (gdbarch)));
+
+ /* Fill in the floating-point control registers. */
+ for (i = M68K_FPC_REGNUM; i <= M68K_FPI_REGNUM; i++)
+ if (regno == -1 || regno == i)
+ regcache_raw_collect (regcache, i,
+ &fpregsetp->fpcntl[i - M68K_FPC_REGNUM]);
+}
+
+#ifdef HAVE_PTRACE_GETREGS
+
+/* Fetch all floating-point registers from process/thread TID and store
+ thier values in GDB's register array. */
+
+static void
+fetch_fpregs (struct regcache *regcache, int tid)
+{
+ elf_fpregset_t fpregs;
+
+ if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ supply_fpregset (regcache, (const elf_fpregset_t *) &fpregs);
+}
+
+/* Store all valid floating-point registers in GDB's register array
+ into the process/thread specified by TID. */
+
+static void
+store_fpregs (const struct regcache *regcache, int tid, int regno)
+{
+ elf_fpregset_t fpregs;
+
+ if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ fill_fpregset (regcache, &fpregs, regno);
+
+ if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
+ perror_with_name (_("Couldn't write floating point status"));
+}
+
+#else
+
+static void fetch_fpregs (struct regcache *regcache, int tid)
+{
+}
+
+static void store_fpregs (const struct regcache *regcache, int tid, int regno)
+{