vserver 2.0 rc7
[linux-2.6.git] / arch / um / os-Linux / sys-i386 / registers.c
index cbfbaf2..9a0ad09 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <errno.h>
 #include <string.h>
-#include <sys/ptrace.h>
+#include "sysdep/ptrace_user.h"
 #include "sysdep/ptrace.h"
 #include "uml-config.h"
 #include "skas_ptregs.h"
@@ -27,6 +27,23 @@ void init_thread_registers(union uml_pt_regs *to)
                memcpy(to->skas.xfp, exec_fpx_regs, sizeof(to->skas.xfp));
 }
 
+/* XXX These need to use [GS]ETFPXREGS and copy_sc_{to,from}_user_skas needs
+ * to pass in a sufficiently large buffer
+ */
+int save_fp_registers(int pid, unsigned long *fp_regs)
+{
+       if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
+               return(-errno);
+       return(0);
+}
+
+int restore_fp_registers(int pid, unsigned long *fp_regs)
+{
+       if(ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
+               return(-errno);
+       return(0);
+}
+
 static int move_registers(int pid, int int_op, union uml_pt_regs *regs,
                          int fp_op, unsigned long *fp_regs)
 {
@@ -88,14 +105,15 @@ void init_registers(int pid)
                panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
                      err);
 
+       errno = 0;
        err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
        if(!err)
                return;
+       if(errno != EIO)
+               panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
+                     errno);
 
        have_fpx_regs = 0;
-       if(err != EIO)
-               panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
-                     err);
 
        err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
        if(err)