diff options
author | Christoph Hellwig <hch@lst.de> | 2007-10-16 04:26:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:04 -0400 |
commit | 0ac15559150a20d39d381a6be44cdea373584222 (patch) | |
tree | 10be83ffe3197f029beffd242b7ddf21dcc25a35 /arch/m32r/kernel | |
parent | dab8f4963ae0a79b945b8ed297e30d390a9d9f50 (diff) |
m32r: convert to generic sys_ptrace
Convert m32r to the generic sys_ptrace. The conversion requires an
architecture hook after ptrace_attach which this patch adds. The hook
will also be needed for a conersion of ia64 to the generic ptrace code.
Thanks to Hirokazu Takata for fixing a bug in the first version of this
code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m32r/kernel')
-rw-r--r-- | arch/m32r/kernel/ptrace.c | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index abbeaf8f6d0a..ed4d0756c5db 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c | |||
@@ -570,7 +570,7 @@ withdraw_debug_trap(struct pt_regs *regs) | |||
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||
573 | static void | 573 | void |
574 | init_debug_traps(struct task_struct *child) | 574 | init_debug_traps(struct task_struct *child) |
575 | { | 575 | { |
576 | struct debug_trap *p = &child->thread.debug_trap; | 576 | struct debug_trap *p = &child->thread.debug_trap; |
@@ -593,8 +593,8 @@ void ptrace_disable(struct task_struct *child) | |||
593 | /* nothing to do.. */ | 593 | /* nothing to do.. */ |
594 | } | 594 | } |
595 | 595 | ||
596 | static int | 596 | long |
597 | do_ptrace(long request, struct task_struct *child, long addr, long data) | 597 | arch_ptrace(struct task_struct *child, long request, long addr, long data) |
598 | { | 598 | { |
599 | int ret; | 599 | int ret; |
600 | 600 | ||
@@ -720,42 +720,6 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) | |||
720 | return ret; | 720 | return ret; |
721 | } | 721 | } |
722 | 722 | ||
723 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | ||
724 | { | ||
725 | struct task_struct *child; | ||
726 | int ret; | ||
727 | |||
728 | lock_kernel(); | ||
729 | if (request == PTRACE_TRACEME) { | ||
730 | ret = ptrace_traceme(); | ||
731 | goto out; | ||
732 | } | ||
733 | |||
734 | child = ptrace_get_task_struct(pid); | ||
735 | if (IS_ERR(child)) { | ||
736 | ret = PTR_ERR(child); | ||
737 | goto out; | ||
738 | } | ||
739 | |||
740 | if (request == PTRACE_ATTACH) { | ||
741 | ret = ptrace_attach(child); | ||
742 | if (ret == 0) | ||
743 | init_debug_traps(child); | ||
744 | goto out_tsk; | ||
745 | } | ||
746 | |||
747 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
748 | if (ret == 0) | ||
749 | ret = do_ptrace(request, child, addr, data); | ||
750 | |||
751 | out_tsk: | ||
752 | put_task_struct(child); | ||
753 | out: | ||
754 | unlock_kernel(); | ||
755 | |||
756 | return ret; | ||
757 | } | ||
758 | |||
759 | /* notification of system call entry/exit | 723 | /* notification of system call entry/exit |
760 | * - triggered by current->work.syscall_trace | 724 | * - triggered by current->work.syscall_trace |
761 | */ | 725 | */ |