aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/ptrace32.c
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2008-08-17 10:49:25 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-11 11:18:41 -0400
commit5d9a76cd0ed367d01b0b237253adb7607e86a277 (patch)
tree1c239a7cc3044a6ddc077148e97c1182aa8eb065 /arch/mips/kernel/ptrace32.c
parentb922df7383749a1c0b7ea64c50fa839263d3816b (diff)
MIPS: Use compat_sys_ptrace
This replaces mips's sys_ptrace32 with a compat_arch_ptrace and enables the new generic definition of compat_sys_ptrace instead. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/ptrace32.c')
-rw-r--r--arch/mips/kernel/ptrace32.c43
1 files changed, 8 insertions, 35 deletions
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 76818be6ba7c..cac56a8c8679 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -15,6 +15,7 @@
15 * binaries. 15 * binaries.
16 */ 16 */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/compat.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/mm.h> 21#include <linux/mm.h>
@@ -46,37 +47,13 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
46 * Tracing a 32-bit process with a 64-bit strace and vice versa will not 47 * Tracing a 32-bit process with a 64-bit strace and vice versa will not
47 * work. I don't know how to fix this. 48 * work. I don't know how to fix this.
48 */ 49 */
49asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) 50long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
51 compat_ulong_t caddr, compat_ulong_t cdata)
50{ 52{
51 struct task_struct *child; 53 int addr = caddr;
54 int data = cdata;
52 int ret; 55 int ret;
53 56
54#if 0
55 printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
56 (int) request, (int) pid, (unsigned long) addr,
57 (unsigned long) data);
58#endif
59 lock_kernel();
60 if (request == PTRACE_TRACEME) {
61 ret = ptrace_traceme();
62 goto out;
63 }
64
65 child = ptrace_get_task_struct(pid);
66 if (IS_ERR(child)) {
67 ret = PTR_ERR(child);
68 goto out;
69 }
70
71 if (request == PTRACE_ATTACH) {
72 ret = ptrace_attach(child);
73 goto out_tsk;
74 }
75
76 ret = ptrace_check_attach(child, request == PTRACE_KILL);
77 if (ret < 0)
78 goto out_tsk;
79
80 switch (request) { 57 switch (request) {
81 /* when I and D space are separate, these will need to be fixed. */ 58 /* when I and D space are separate, these will need to be fixed. */
82 case PTRACE_PEEKTEXT: /* read word at location addr. */ 59 case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -214,7 +191,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
214 if (!cpu_has_dsp) { 191 if (!cpu_has_dsp) {
215 tmp = 0; 192 tmp = 0;
216 ret = -EIO; 193 ret = -EIO;
217 goto out_tsk; 194 goto out;
218 } 195 }
219 dregs = __get_dsp_regs(child); 196 dregs = __get_dsp_regs(child);
220 tmp = (unsigned long) (dregs[addr - DSP_BASE]); 197 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
@@ -224,14 +201,14 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
224 if (!cpu_has_dsp) { 201 if (!cpu_has_dsp) {
225 tmp = 0; 202 tmp = 0;
226 ret = -EIO; 203 ret = -EIO;
227 goto out_tsk; 204 goto out;
228 } 205 }
229 tmp = child->thread.dsp.dspcontrol; 206 tmp = child->thread.dsp.dspcontrol;
230 break; 207 break;
231 default: 208 default:
232 tmp = 0; 209 tmp = 0;
233 ret = -EIO; 210 ret = -EIO;
234 goto out_tsk; 211 goto out;
235 } 212 }
236 ret = put_user(tmp, (unsigned __user *) (unsigned long) data); 213 ret = put_user(tmp, (unsigned __user *) (unsigned long) data);
237 break; 214 break;
@@ -414,10 +391,6 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
414 ret = ptrace_request(child, request, addr, data); 391 ret = ptrace_request(child, request, addr, data);
415 break; 392 break;
416 } 393 }
417
418out_tsk:
419 put_task_struct(child);
420out: 394out:
421 unlock_kernel();
422 return ret; 395 return ret;
423} 396}