This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / arch / cris / arch-v10 / kernel / ptrace.c
index da15db8..55fd631 100644 (file)
  */
 #define DCCR_MASK 0x0000001f     /* XNZVC */
 
-/*
- * Get contents of register REGNO in task TASK.
- */
-inline long get_reg(struct task_struct *task, unsigned int regno)
-{
-       /* USP is a special case, it's not in the pt_regs struct but
-        * in the tasks thread struct
-        */
-
-       if (regno == PT_USP)
-               return task->thread.usp;
-       else if (regno < PT_MAX)
-               return ((unsigned long *)user_regs(task->thread_info))[regno];
-       else
-               return 0;
-}
-
-/*
- * Write contents of register REGNO in task TASK.
- */
-inline int put_reg(struct task_struct *task, unsigned int regno,
-                         unsigned long data)
-{
-       if (regno == PT_USP)
-               task->thread.usp = data;
-       else if (regno < PT_MAX)
-               ((unsigned long *)user_regs(task->thread_info))[regno] = data;
-       else
-               return -1;
-       return 0;
-}
+extern inline long get_reg(struct task_struct *, unsigned int);
+extern inline long put_reg(struct task_struct *, unsigned int, unsigned long);
 
 /*
  * Called by kernel/ptrace.c when detaching.
@@ -79,7 +50,6 @@ sys_ptrace(long request, long pid, long addr, long data)
 {
        struct task_struct *child;
        int ret;
-       unsigned long __user *datap = (unsigned long __user *)data;
 
        lock_kernel();
        ret = -EPERM;
@@ -132,7 +102,7 @@ sys_ptrace(long request, long pid, long addr, long data)
                        if (copied != sizeof(tmp))
                                break;
                        
-                       ret = put_user(tmp,datap);
+                       ret = put_user(tmp,(unsigned long *) data);
                        break;
                }
 
@@ -145,7 +115,7 @@ sys_ptrace(long request, long pid, long addr, long data)
                                break;
 
                        tmp = get_reg(child, addr >> 2);
-                       ret = put_user(tmp, datap);
+                       ret = put_user(tmp, (unsigned long *)data);
                        break;
                }
                
@@ -206,7 +176,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;
@@ -243,7 +213,7 @@ sys_ptrace(long request, long pid, long addr, long data)
                        for (i = 0; i <= PT_MAX; i++) {
                                tmp = get_reg(child, i);
                                
-                               if (put_user(tmp, datap)) {
+                               if (put_user(tmp, (unsigned long *) data)) {
                                        ret = -EFAULT;
                                        goto out_tsk;
                                }
@@ -261,7 +231,7 @@ sys_ptrace(long request, long pid, long addr, long data)
                        unsigned long tmp;
                        
                        for (i = 0; i <= PT_MAX; i++) {
-                               if (get_user(tmp, datap)) {
+                               if (get_user(tmp, (unsigned long *) data)) {
                                        ret = -EFAULT;
                                        goto out_tsk;
                                }