]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
uml: use ptrace directly in libc code
authorJeff Dike <jdike@addtoit.com>
Tue, 5 Feb 2008 06:30:57 +0000 (22:30 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 5 Feb 2008 17:44:28 +0000 (09:44 -0800)
Some register accessor cleanups -
userspace() was calling restore_registers and save_registers for no
reason, since userspace() is on the libc side of the house, and these
add no value over calling ptrace directly
init_thread_registers and get_safe_registers were the same thing,
so init_thread_registers is gone

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/include/registers.h
arch/um/kernel/process.c
arch/um/os-Linux/registers.c
arch/um/os-Linux/skas/process.c

index 0e27406a43a4d24f311af678b10a71dbd51a6ffa..6df37480cb8ca04a7b4d75fdf48fa5fec489b351 100644 (file)
@@ -9,7 +9,6 @@
 #include "sysdep/ptrace.h"
 #include "sysdep/archsetjmp.h"
 
-extern void init_thread_registers(struct uml_pt_regs *to);
 extern int save_fp_registers(int pid, unsigned long *fp_regs);
 extern int restore_fp_registers(int pid, unsigned long *fp_regs);
 extern int save_fpx_registers(int pid, unsigned long *fp_regs);
index ae1942eeb994d73ebe7651376d4bf113e02ce1e8..7a291239242b75f8b40d2104b1b8266389435a2e 100644 (file)
@@ -199,7 +199,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                arch_copy_thread(&current->thread.arch, &p->thread.arch);
        }
        else {
-               init_thread_registers(&p->thread.regs.regs);
+               get_safe_registers(p->thread.regs.regs.gp);
                p->thread.request.u.thread = current->thread.request.u.thread;
                handler = new_thread_handler;
        }
index a32ba6ab12112e3c6379d55588e538560512fb28..c78fae3aba81ad0e48d465ab7fc78fcdccfe0b8d 100644 (file)
 #include "sysdep/ptrace.h"
 #include "user.h"
 
-/* This is set once at boot time and not changed thereafter */
-
-static unsigned long exec_regs[MAX_REG_NR];
-
-void init_thread_registers(struct uml_pt_regs *to)
-{
-       memcpy(to->gp, exec_regs, sizeof(to->gp));
-}
-
 void save_registers(int pid, struct uml_pt_regs *regs)
 {
        int err;
@@ -39,6 +30,10 @@ void restore_registers(int pid, struct uml_pt_regs *regs)
                      "errno = %d\n", errno);
 }
 
+/* This is set once at boot time and not changed thereafter */
+
+static unsigned long exec_regs[MAX_REG_NR];
+
 void init_registers(int pid)
 {
        int err;
index 2cc2071112bc9f0f4f27a1cedebe181400458a8c..7dc24e3cb19050b4e86218f864317b898e80039e 100644 (file)
@@ -300,7 +300,9 @@ void userspace(struct uml_pt_regs *regs)
        nsecs += os_nsecs();
 
        while (1) {
-               restore_registers(pid, regs);
+               if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
+                       panic("userspace - PTRACE_SETREGS failed, "
+                             "errno = %d\n", errno);
 
                /* Now we set local_using_sysemu to be used for one loop */
                local_using_sysemu = get_using_sysemu();
@@ -320,7 +322,10 @@ void userspace(struct uml_pt_regs *regs)
                              errno);
 
                regs->is_user = 1;
-               save_registers(pid, regs);
+               if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp))
+                       panic("userspace - saving registers failed, "
+                             "errno = %d\n", errno);
+
                UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
 
                if (WIFSTOPPED(status)) {
@@ -343,7 +348,7 @@ void userspace(struct uml_pt_regs *regs)
                                break;
                        case SIGVTALRM:
                                now = os_nsecs();
-                               if(now < nsecs)
+                               if (now < nsecs)
                                        break;
                                block_signals();
                                (*sig_info[sig])(sig, regs);