-/* Store our register values back into the inferior.
- * If REG is -1, do this for all registers.
- * Otherwise, REG specifies which register
- *
- * On mach3 all registers are always saved in one call.
- */
-void
-gnu_store_registers (reg)
- int reg;
+
+/* Store the whole floating-point state into THREAD using information
+ from the corresponding (pseudo) registers. */
+static void
+store_fpregs (const struct regcache *regcache, struct proc *thread, int regno)
+{
+ mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
+ struct i386_float_state state;
+ error_t err;
+
+ err = thread_get_state (thread->port, i386_FLOAT_STATE,
+ (thread_state_t) &state, &count);
+ if (err)
+ {
+ warning (_("Couldn't fetch floating-point state from %s"),
+ proc_string (thread));
+ return;
+ }
+
+ /* FIXME: kettenis/2001-07-15: Is this right? Should we somehow
+ take into account DEPRECATED_REGISTER_VALID like the old code did? */
+ i387_collect_fsave (regcache, regno, state.hw_state);
+
+ err = thread_set_state (thread->port, i386_FLOAT_STATE,
+ (thread_state_t) &state, i386_FLOAT_STATE_COUNT);
+ if (err)
+ {
+ warning (_("Couldn't store floating-point state into %s"),
+ proc_string (thread));
+ return;
+ }
+}
+
+/* Store at least register REGNO, or all regs if REGNO == -1. */
+static void
+gnu_store_registers (struct target_ops *ops,
+ struct regcache *regcache, int regno)