aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:30:57 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:28 -0500
commitd25f2e1235aab716c9fd6ba36c42503627a3a0e3 (patch)
tree5eaabe739be50f1417707fb6eef2da75dc567a30 /arch/um
parentee3d9bd4de1ed93d2a7ee41c331ed30a1c7b8acd (diff)
uml: use ptrace directly in libc code
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>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/include/registers.h1
-rw-r--r--arch/um/kernel/process.c2
-rw-r--r--arch/um/os-Linux/registers.c13
-rw-r--r--arch/um/os-Linux/skas/process.c11
4 files changed, 13 insertions, 14 deletions
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index 0e27406a43a4..6df37480cb8c 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -9,7 +9,6 @@
9#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10#include "sysdep/archsetjmp.h" 10#include "sysdep/archsetjmp.h"
11 11
12extern void init_thread_registers(struct uml_pt_regs *to);
13extern int save_fp_registers(int pid, unsigned long *fp_regs); 12extern int save_fp_registers(int pid, unsigned long *fp_regs);
14extern int restore_fp_registers(int pid, unsigned long *fp_regs); 13extern int restore_fp_registers(int pid, unsigned long *fp_regs);
15extern int save_fpx_registers(int pid, unsigned long *fp_regs); 14extern int save_fpx_registers(int pid, unsigned long *fp_regs);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index ae1942eeb994..7a291239242b 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -199,7 +199,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
199 arch_copy_thread(&current->thread.arch, &p->thread.arch); 199 arch_copy_thread(&current->thread.arch, &p->thread.arch);
200 } 200 }
201 else { 201 else {
202 init_thread_registers(&p->thread.regs.regs); 202 get_safe_registers(p->thread.regs.regs.gp);
203 p->thread.request.u.thread = current->thread.request.u.thread; 203 p->thread.request.u.thread = current->thread.request.u.thread;
204 handler = new_thread_handler; 204 handler = new_thread_handler;
205 } 205 }
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c
index a32ba6ab1211..c78fae3aba81 100644
--- a/arch/um/os-Linux/registers.c
+++ b/arch/um/os-Linux/registers.c
@@ -10,15 +10,6 @@
10#include "sysdep/ptrace.h" 10#include "sysdep/ptrace.h"
11#include "user.h" 11#include "user.h"
12 12
13/* This is set once at boot time and not changed thereafter */
14
15static unsigned long exec_regs[MAX_REG_NR];
16
17void init_thread_registers(struct uml_pt_regs *to)
18{
19 memcpy(to->gp, exec_regs, sizeof(to->gp));
20}
21
22void save_registers(int pid, struct uml_pt_regs *regs) 13void save_registers(int pid, struct uml_pt_regs *regs)
23{ 14{
24 int err; 15 int err;
@@ -39,6 +30,10 @@ void restore_registers(int pid, struct uml_pt_regs *regs)
39 "errno = %d\n", errno); 30 "errno = %d\n", errno);
40} 31}
41 32
33/* This is set once at boot time and not changed thereafter */
34
35static unsigned long exec_regs[MAX_REG_NR];
36
42void init_registers(int pid) 37void init_registers(int pid)
43{ 38{
44 int err; 39 int err;
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 2cc2071112bc..7dc24e3cb190 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -300,7 +300,9 @@ void userspace(struct uml_pt_regs *regs)
300 nsecs += os_nsecs(); 300 nsecs += os_nsecs();
301 301
302 while (1) { 302 while (1) {
303 restore_registers(pid, regs); 303 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
304 panic("userspace - PTRACE_SETREGS failed, "
305 "errno = %d\n", errno);
304 306
305 /* Now we set local_using_sysemu to be used for one loop */ 307 /* Now we set local_using_sysemu to be used for one loop */
306 local_using_sysemu = get_using_sysemu(); 308 local_using_sysemu = get_using_sysemu();
@@ -320,7 +322,10 @@ void userspace(struct uml_pt_regs *regs)
320 errno); 322 errno);
321 323
322 regs->is_user = 1; 324 regs->is_user = 1;
323 save_registers(pid, regs); 325 if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp))
326 panic("userspace - saving registers failed, "
327 "errno = %d\n", errno);
328
324 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ 329 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
325 330
326 if (WIFSTOPPED(status)) { 331 if (WIFSTOPPED(status)) {
@@ -343,7 +348,7 @@ void userspace(struct uml_pt_regs *regs)
343 break; 348 break;
344 case SIGVTALRM: 349 case SIGVTALRM:
345 now = os_nsecs(); 350 now = os_nsecs();
346 if(now < nsecs) 351 if (now < nsecs)
347 break; 352 break;
348 block_signals(); 353 block_signals();
349 (*sig_info[sig])(sig, regs); 354 (*sig_info[sig])(sig, regs);