Merge branch 'drm-forlinus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / arch / cris / arch-v10 / kernel / ptrace.c
index 581ecab..f214f74 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/ptrace.h>
 #include <linux/user.h>
 #include <linux/signal.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 #include <asm/page.h>
@@ -36,7 +37,7 @@ inline long get_reg(struct task_struct *task, unsigned int regno)
        if (regno == PT_USP)
                return task->thread.usp;
        else if (regno < PT_MAX)
-               return ((unsigned long *)user_regs(task->thread_info))[regno];
+               return ((unsigned long *)task_pt_regs(task))[regno];
        else
                return 0;
 }
@@ -50,7 +51,7 @@ inline int put_reg(struct task_struct *task, unsigned int regno,
        if (regno == PT_USP)
                task->thread.usp = data;
        else if (regno < PT_MAX)
-               ((unsigned long *)user_regs(task->thread_info))[regno] = data;
+               ((unsigned long *)task_pt_regs(task))[regno] = data;
        else
                return -1;
        return 0;
@@ -75,51 +76,11 @@ ptrace_disable(struct task_struct *child)
  * (in user space) where the result of the ptrace call is written (instead of
  * being returned).
  */
-asmlinkage int 
-sys_ptrace(long request, long pid, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 {
-       struct task_struct *child;
        int ret;
        unsigned long __user *datap = (unsigned long __user *)data;
 
-       lock_kernel();
-       ret = -EPERM;
-       
-       if (request == PTRACE_TRACEME) {
-               if (current->ptrace & PT_PTRACED)
-                       goto out;
-
-               current->ptrace |= PT_PTRACED;
-               ret = 0;
-               goto out;
-       }
-       
-       ret = -ESRCH;
-       read_lock(&tasklist_lock);
-       child = find_task_by_pid(pid);
-       
-       if (child)
-               get_task_struct(child);
-       
-       read_unlock(&tasklist_lock);
-       
-       if (!child)
-               goto out;
-       
-       ret = -EPERM;
-       
-       if (pid == 1)           /* Leave the init process alone! */
-               goto out_tsk;
-       
-       if (request == PTRACE_ATTACH) {
-               ret = ptrace_attach(child);
-               goto out_tsk;
-       }
-       
-       ret = ptrace_check_attach(child, request == PTRACE_KILL);
-       if (ret < 0)
-               goto out_tsk;
-
        switch (request) {
                /* Read word at location address. */ 
                case PTRACE_PEEKTEXT:
@@ -207,7 +168,7 @@ sys_ptrace(long request, long pid, long addr, long data)
                case PTRACE_KILL:
                        ret = 0;
                        
-                       if (child->state == TASK_ZOMBIE)
+                       if (child->exit_state == EXIT_ZOMBIE)
                                break;
                        
                        child->exit_code = SIGKILL;
@@ -284,10 +245,7 @@ sys_ptrace(long request, long pid, long addr, long data)
                        ret = ptrace_request(child, request, addr, data);
                        break;
        }
-out_tsk:
-       put_task_struct(child);
-out:
-       unlock_kernel();
+
        return ret;
 }