]> err.no Git - linux-2.6/commitdiff
alpha: convert to generic sys_ptrace
authorChristoph Hellwig <hch@lst.de>
Tue, 16 Oct 2007 08:26:34 +0000 (01:26 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:43:03 +0000 (09:43 -0700)
This patch converts alpha to the generic sys_ptrace.  We use
force_successful_syscall_return to avoid having to pass the pt_regs pointer
down to the function.  I think the removal of the assemly stub is correct,
but I could only compile-test this patch, so please give it a spin before
commiting :)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/alpha/kernel/entry.S
arch/alpha/kernel/ptrace.c
include/asm-alpha/ptrace.h

index debc8f03886cf9edafa577664a90a6c8ec59c9ad..5fc61e281ac77724cbcf0270b4269dd4559a686b 100644 (file)
@@ -916,15 +916,6 @@ sys_pipe:
        ret
 .end sys_pipe
 
-       .align  4
-       .globl  sys_ptrace
-       .ent    sys_ptrace
-sys_ptrace:
-       .prologue 0
-       mov     $sp, $20
-       jmp     $31, do_sys_ptrace
-.end sys_ptrace
-
        .align  4
        .globl  sys_execve
        .ent    sys_execve
index eaf4ee5f0c356881c3588a0d5e9689db2ba5556d..1e9ad52c460ec293aa70f9cbc5bb3094adc08d74 100644 (file)
@@ -260,38 +260,12 @@ void ptrace_disable(struct task_struct *child)
        ptrace_cancel_bpt(child);
 }
 
-asmlinkage long
-do_sys_ptrace(long request, long pid, long addr, long data,
-             struct pt_regs *regs)
+long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 {
-       struct task_struct *child;
        unsigned long tmp;
        size_t copied;
        long ret;
 
-       lock_kernel();
-       DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n",
-                     request, pid, addr, data));
-       if (request == PTRACE_TRACEME) {
-               ret = ptrace_traceme();
-               goto out_notsk;
-       }
-
-       child = ptrace_get_task_struct(pid);
-       if (IS_ERR(child)) {
-               ret = PTR_ERR(child);
-               goto out_notsk;
-       }
-
-       if (request == PTRACE_ATTACH) {
-               ret = ptrace_attach(child);
-               goto out;
-       }
-
-       ret = ptrace_check_attach(child, request == PTRACE_KILL);
-       if (ret < 0)
-               goto out;
-
        switch (request) {
        /* When I and D space are separate, these will need to be fixed.  */
        case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -301,13 +275,13 @@ do_sys_ptrace(long request, long pid, long addr, long data,
                if (copied != sizeof(tmp))
                        break;
                
-               regs->r0 = 0;   /* special return: no errors */
+               force_successful_syscall_return();
                ret = tmp;
                break;
 
        /* Read register number ADDR. */
        case PTRACE_PEEKUSR:
-               regs->r0 = 0;   /* special return: no errors */
+               force_successful_syscall_return();
                ret = get_reg(child, addr);
                DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret));
                break;
@@ -353,7 +327,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
                /* make sure single-step breakpoint is gone. */
                ptrace_cancel_bpt(child);
                wake_up_process(child);
-               goto out;
+               break;
 
        case PTRACE_SINGLESTEP:  /* execute single instruction. */
                ret = -EIO;
@@ -366,16 +340,12 @@ do_sys_ptrace(long request, long pid, long addr, long data,
                wake_up_process(child);
                /* give it a chance to run. */
                ret = 0;
-               goto out;
+               break;
 
        default:
                ret = ptrace_request(child, request, addr, data);
-               goto out;
+               break;
        }
- out:
-       put_task_struct(child);
- out_notsk:
-       unlock_kernel();
        return ret;
 }
 
index 9933b8b3612ee2a6173d22ba5bd441d07c80eab5..32c7a5cddd5909f68c60c1877bb0177f20204e88 100644 (file)
@@ -68,8 +68,6 @@ struct switch_stack {
 
 #ifdef __KERNEL__
 
-#define __ARCH_SYS_PTRACE      1
-
 #define user_mode(regs) (((regs)->ps & 8) != 0)
 #define instruction_pointer(regs) ((regs)->pc)
 #define profile_pc(regs) instruction_pointer(regs)