aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/ptrace32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/ptrace32.c')
-rw-r--r--arch/mips/kernel/ptrace32.c59
1 files changed, 18 insertions, 41 deletions
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 76818be6ba7c..1ca34104e593 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>
@@ -36,47 +37,17 @@
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37#include <asm/bootinfo.h> 38#include <asm/bootinfo.h>
38 39
39int ptrace_getregs(struct task_struct *child, __s64 __user *data);
40int ptrace_setregs(struct task_struct *child, __s64 __user *data);
41
42int ptrace_getfpregs(struct task_struct *child, __u32 __user *data);
43int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
44
45/* 40/*
46 * Tracing a 32-bit process with a 64-bit strace and vice versa will not 41 * 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. 42 * work. I don't know how to fix this.
48 */ 43 */
49asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) 44long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
45 compat_ulong_t caddr, compat_ulong_t cdata)
50{ 46{
51 struct task_struct *child; 47 int addr = caddr;
48 int data = cdata;
52 int ret; 49 int ret;
53 50
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) { 51 switch (request) {
81 /* when I and D space are separate, these will need to be fixed. */ 52 /* when I and D space are separate, these will need to be fixed. */
82 case PTRACE_PEEKTEXT: /* read word at location addr. */ 53 case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -214,7 +185,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
214 if (!cpu_has_dsp) { 185 if (!cpu_has_dsp) {
215 tmp = 0; 186 tmp = 0;
216 ret = -EIO; 187 ret = -EIO;
217 goto out_tsk; 188 goto out;
218 } 189 }
219 dregs = __get_dsp_regs(child); 190 dregs = __get_dsp_regs(child);
220 tmp = (unsigned long) (dregs[addr - DSP_BASE]); 191 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
@@ -224,14 +195,14 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
224 if (!cpu_has_dsp) { 195 if (!cpu_has_dsp) {
225 tmp = 0; 196 tmp = 0;
226 ret = -EIO; 197 ret = -EIO;
227 goto out_tsk; 198 goto out;
228 } 199 }
229 tmp = child->thread.dsp.dspcontrol; 200 tmp = child->thread.dsp.dspcontrol;
230 break; 201 break;
231 default: 202 default:
232 tmp = 0; 203 tmp = 0;
233 ret = -EIO; 204 ret = -EIO;
234 goto out_tsk; 205 goto out;
235 } 206 }
236 ret = put_user(tmp, (unsigned __user *) (unsigned long) data); 207 ret = put_user(tmp, (unsigned __user *) (unsigned long) data);
237 break; 208 break;
@@ -410,14 +381,20 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
410 (unsigned long __user *) (unsigned long) data); 381 (unsigned long __user *) (unsigned long) data);
411 break; 382 break;
412 383
384 case PTRACE_GET_WATCH_REGS:
385 ret = ptrace_get_watch_regs(child,
386 (struct pt_watch_regs __user *) (unsigned long) addr);
387 break;
388
389 case PTRACE_SET_WATCH_REGS:
390 ret = ptrace_set_watch_regs(child,
391 (struct pt_watch_regs __user *) (unsigned long) addr);
392 break;
393
413 default: 394 default:
414 ret = ptrace_request(child, request, addr, data); 395 ret = ptrace_request(child, request, addr, data);
415 break; 396 break;
416 } 397 }
417
418out_tsk:
419 put_task_struct(child);
420out: 398out:
421 unlock_kernel();
422 return ret; 399 return ret;
423} 400}