diff options
| author | Christoph Hellwig <hch@lst.de> | 2007-10-16 04:26:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:03 -0400 |
| commit | a5f833f3c1961488733bf645b011b6350ee5c7be (patch) | |
| tree | d7a8d03a5c29d7c820d8680d51f27c4edda9556a /arch/alpha | |
| parent | d9ff5f38727f839dacb2714154fa03e59803d7a5 (diff) | |
alpha: convert to generic sys_ptrace
This patch converts alpha to the generic sys_ptrace. We use
force_successful_syscall_return to avoid having to pass the pt_regs pointer
down to the function. I think the removal of the assemly stub is correct,
but I could only compile-test this patch, so please give it a spin before
commiting :)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha')
| -rw-r--r-- | arch/alpha/kernel/entry.S | 9 | ||||
| -rw-r--r-- | arch/alpha/kernel/ptrace.c | 42 |
2 files changed, 6 insertions, 45 deletions
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index debc8f03886c..5fc61e281ac7 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
| @@ -917,15 +917,6 @@ sys_pipe: | |||
| 917 | .end sys_pipe | 917 | .end sys_pipe |
| 918 | 918 | ||
| 919 | .align 4 | 919 | .align 4 |
| 920 | .globl sys_ptrace | ||
| 921 | .ent sys_ptrace | ||
| 922 | sys_ptrace: | ||
| 923 | .prologue 0 | ||
| 924 | mov $sp, $20 | ||
| 925 | jmp $31, do_sys_ptrace | ||
| 926 | .end sys_ptrace | ||
| 927 | |||
| 928 | .align 4 | ||
| 929 | .globl sys_execve | 920 | .globl sys_execve |
| 930 | .ent sys_execve | 921 | .ent sys_execve |
| 931 | sys_execve: | 922 | sys_execve: |
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index eaf4ee5f0c35..1e9ad52c460e 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c | |||
| @@ -260,38 +260,12 @@ void ptrace_disable(struct task_struct *child) | |||
| 260 | ptrace_cancel_bpt(child); | 260 | ptrace_cancel_bpt(child); |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | asmlinkage long | 263 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
| 264 | do_sys_ptrace(long request, long pid, long addr, long data, | ||
| 265 | struct pt_regs *regs) | ||
| 266 | { | 264 | { |
| 267 | struct task_struct *child; | ||
| 268 | unsigned long tmp; | 265 | unsigned long tmp; |
| 269 | size_t copied; | 266 | size_t copied; |
| 270 | long ret; | 267 | long ret; |
| 271 | 268 | ||
| 272 | lock_kernel(); | ||
| 273 | DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", | ||
| 274 | request, pid, addr, data)); | ||
| 275 | if (request == PTRACE_TRACEME) { | ||
| 276 | ret = ptrace_traceme(); | ||
| 277 | goto out_notsk; | ||
| 278 | } | ||
| 279 | |||
| 280 | child = ptrace_get_task_struct(pid); | ||
| 281 | if (IS_ERR(child)) { | ||
| 282 | ret = PTR_ERR(child); | ||
| 283 | goto out_notsk; | ||
| 284 | } | ||
| 285 | |||
| 286 | if (request == PTRACE_ATTACH) { | ||
| 287 | ret = ptrace_attach(child); | ||
| 288 | goto out; | ||
| 289 | } | ||
| 290 | |||
| 291 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
| 292 | if (ret < 0) | ||
| 293 | goto out; | ||
| 294 | |||
| 295 | switch (request) { | 269 | switch (request) { |
| 296 | /* When I and D space are separate, these will need to be fixed. */ | 270 | /* When I and D space are separate, these will need to be fixed. */ |
| 297 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 271 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
| @@ -301,13 +275,13 @@ do_sys_ptrace(long request, long pid, long addr, long data, | |||
| 301 | if (copied != sizeof(tmp)) | 275 | if (copied != sizeof(tmp)) |
| 302 | break; | 276 | break; |
| 303 | 277 | ||
| 304 | regs->r0 = 0; /* special return: no errors */ | 278 | force_successful_syscall_return(); |
| 305 | ret = tmp; | 279 | ret = tmp; |
| 306 | break; | 280 | break; |
| 307 | 281 | ||
| 308 | /* Read register number ADDR. */ | 282 | /* Read register number ADDR. */ |
| 309 | case PTRACE_PEEKUSR: | 283 | case PTRACE_PEEKUSR: |
| 310 | regs->r0 = 0; /* special return: no errors */ | 284 | force_successful_syscall_return(); |
| 311 | ret = get_reg(child, addr); | 285 | ret = get_reg(child, addr); |
| 312 | DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret)); | 286 | DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret)); |
| 313 | break; | 287 | break; |
| @@ -353,7 +327,7 @@ do_sys_ptrace(long request, long pid, long addr, long data, | |||
| 353 | /* make sure single-step breakpoint is gone. */ | 327 | /* make sure single-step breakpoint is gone. */ |
| 354 | ptrace_cancel_bpt(child); | 328 | ptrace_cancel_bpt(child); |
| 355 | wake_up_process(child); | 329 | wake_up_process(child); |
| 356 | goto out; | 330 | break; |
| 357 | 331 | ||
| 358 | case PTRACE_SINGLESTEP: /* execute single instruction. */ | 332 | case PTRACE_SINGLESTEP: /* execute single instruction. */ |
| 359 | ret = -EIO; | 333 | ret = -EIO; |
| @@ -366,16 +340,12 @@ do_sys_ptrace(long request, long pid, long addr, long data, | |||
| 366 | wake_up_process(child); | 340 | wake_up_process(child); |
| 367 | /* give it a chance to run. */ | 341 | /* give it a chance to run. */ |
| 368 | ret = 0; | 342 | ret = 0; |
| 369 | goto out; | 343 | break; |
| 370 | 344 | ||
| 371 | default: | 345 | default: |
| 372 | ret = ptrace_request(child, request, addr, data); | 346 | ret = ptrace_request(child, request, addr, data); |
| 373 | goto out; | 347 | break; |
| 374 | } | 348 | } |
| 375 | out: | ||
| 376 | put_task_struct(child); | ||
| 377 | out_notsk: | ||
| 378 | unlock_kernel(); | ||
| 379 | return ret; | 349 | return ret; |
| 380 | } | 350 | } |
| 381 | 351 | ||
