PTRACE_POKEDATA consolidation
[linux-2.6-block.git] / arch / um / kernel / ptrace.c
index 9a77fb3c269d667d122c628fec3dd90d8fc4222a..6916c8888dba7156850c16c9eb22009da851674a 100644 (file)
@@ -18,6 +18,7 @@
 #include "kern_util.h"
 #include "skas_ptrace.h"
 #include "sysdep/ptrace.h"
+#include "os.h"
 
 static inline void set_singlestepping(struct task_struct *child, int on)
 {
@@ -51,17 +52,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        switch (request) {
                /* when I and D space are separate, these will need to be fixed. */
        case PTRACE_PEEKTEXT: /* read word at location addr. */ 
-       case PTRACE_PEEKDATA: {
-               unsigned long tmp;
-               int copied;
-
-               ret = -EIO;
-               copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
-               if (copied != sizeof(tmp))
-                       break;
-               ret = put_user(tmp, p);
+       case PTRACE_PEEKDATA:
+               ret = generic_ptrace_peekdata(child, addr, data);
                break;
-       }
 
        /* read the word at location addr in the USER area. */
         case PTRACE_PEEKUSR:
@@ -71,11 +64,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        /* when I and D space are separate, this will have to be fixed. */
        case PTRACE_POKETEXT: /* write the word at location addr. */
        case PTRACE_POKEDATA:
-               ret = -EIO;
-               if (access_process_vm(child, addr, &data, sizeof(data), 
-                                     1) != sizeof(data))
-                       break;
-               ret = 0;
+               ret = generic_ptrace_pokedata(child, addr, data);
                break;
 
        case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
@@ -240,6 +229,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                ret = 0;
                break;
        }
+#endif
+#ifdef PTRACE_ARCH_PRCTL
+        case PTRACE_ARCH_PRCTL:
+                /* XXX Calls ptrace on the host - needs some SMP thinking */
+                ret = arch_prctl_skas(child, data, (void *) addr);
+                break;
 #endif
        default:
                ret = ptrace_request(child, request, addr, data);