diff options
author | Christoph Hellwig <hch@lst.de> | 2005-11-07 03:59:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:42 -0500 |
commit | 481bed454247538e9f57d4ea37b153ccba24ba7b (patch) | |
tree | bb4198296962c08dbf52e8f377dc27206f621640 /include | |
parent | db73e9aa99bf093427b79877f9475392724fd5e5 (diff) |
[PATCH] consolidate sys_ptrace()
The sys_ptrace boilerplate code (everything outside the big switch
statement for the arch-specific requests) is shared by most architectures.
This patch moves it to kernel/ptrace.c and leaves the arch-specific code as
arch_ptrace.
Some architectures have a too different ptrace so we have to exclude them.
They continue to keep their implementations. For sh64 I had to add a
sh64_ptrace wrapper because it does some initialization on the first call.
For um I removed an ifdefed SUBARCH_PTRACE_SPECIAL block, but
SUBARCH_PTRACE_SPECIAL isn't defined anywhere in the tree.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-By: David Howells <dhowells@redhat.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-alpha/ptrace.h | 3 | ||||
-rw-r--r-- | include/asm-ia64/ptrace.h | 3 | ||||
-rw-r--r-- | include/asm-m32r/ptrace.h | 3 | ||||
-rw-r--r-- | include/asm-s390/ptrace.h | 2 | ||||
-rw-r--r-- | include/asm-sparc/ptrace.h | 3 | ||||
-rw-r--r-- | include/asm-sparc64/ptrace.h | 3 | ||||
-rw-r--r-- | include/linux/ptrace.h | 2 |
7 files changed, 19 insertions, 0 deletions
diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h index d462c5e14c13..072375c135b4 100644 --- a/include/asm-alpha/ptrace.h +++ b/include/asm-alpha/ptrace.h | |||
@@ -67,6 +67,9 @@ struct switch_stack { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | #ifdef __KERNEL__ | 69 | #ifdef __KERNEL__ |
70 | |||
71 | #define __ARCH_SYS_PTRACE 1 | ||
72 | |||
70 | #define user_mode(regs) (((regs)->ps & 8) != 0) | 73 | #define user_mode(regs) (((regs)->ps & 8) != 0) |
71 | #define instruction_pointer(regs) ((regs)->pc) | 74 | #define instruction_pointer(regs) ((regs)->pc) |
72 | #define profile_pc(regs) instruction_pointer(regs) | 75 | #define profile_pc(regs) instruction_pointer(regs) |
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index a79d1a7ecc77..2c703d6e0c86 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h | |||
@@ -229,6 +229,9 @@ struct switch_stack { | |||
229 | }; | 229 | }; |
230 | 230 | ||
231 | #ifdef __KERNEL__ | 231 | #ifdef __KERNEL__ |
232 | |||
233 | #define __ARCH_SYS_PTRACE 1 | ||
234 | |||
232 | /* | 235 | /* |
233 | * We use the ia64_psr(regs)->ri to determine which of the three | 236 | * We use the ia64_psr(regs)->ri to determine which of the three |
234 | * instructions in bundle (16 bytes) took the sample. Generate | 237 | * instructions in bundle (16 bytes) took the sample. Generate |
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h index 976417126b2d..55cd7ecfde43 100644 --- a/include/asm-m32r/ptrace.h +++ b/include/asm-m32r/ptrace.h | |||
@@ -145,6 +145,9 @@ struct pt_regs { | |||
145 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | 145 | #define PTRACE_O_TRACESYSGOOD 0x00000001 |
146 | 146 | ||
147 | #ifdef __KERNEL__ | 147 | #ifdef __KERNEL__ |
148 | |||
149 | #define __ARCH_SYS_PTRACE 1 | ||
150 | |||
148 | #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) | 151 | #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) |
149 | #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) | 152 | #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) |
150 | #elif defined(CONFIG_ISA_M32R) | 153 | #elif defined(CONFIG_ISA_M32R) |
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index fc7c96edc697..a949cc077cc7 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h | |||
@@ -468,6 +468,8 @@ struct user_regs_struct | |||
468 | }; | 468 | }; |
469 | 469 | ||
470 | #ifdef __KERNEL__ | 470 | #ifdef __KERNEL__ |
471 | #define __ARCH_SYS_PTRACE 1 | ||
472 | |||
471 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) | 473 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) |
472 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) | 474 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) |
473 | #define profile_pc(regs) instruction_pointer(regs) | 475 | #define profile_pc(regs) instruction_pointer(regs) |
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h index a8ecb2d6977a..714497099a42 100644 --- a/include/asm-sparc/ptrace.h +++ b/include/asm-sparc/ptrace.h | |||
@@ -60,6 +60,9 @@ struct sparc_stackf { | |||
60 | #define STACKFRAME_SZ sizeof(struct sparc_stackf) | 60 | #define STACKFRAME_SZ sizeof(struct sparc_stackf) |
61 | 61 | ||
62 | #ifdef __KERNEL__ | 62 | #ifdef __KERNEL__ |
63 | |||
64 | #define __ARCH_SYS_PTRACE 1 | ||
65 | |||
63 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) | 66 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) |
64 | #define instruction_pointer(regs) ((regs)->pc) | 67 | #define instruction_pointer(regs) ((regs)->pc) |
65 | unsigned long profile_pc(struct pt_regs *); | 68 | unsigned long profile_pc(struct pt_regs *); |
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h index 6194f771e9fc..7eba90c6c753 100644 --- a/include/asm-sparc64/ptrace.h +++ b/include/asm-sparc64/ptrace.h | |||
@@ -94,6 +94,9 @@ struct sparc_trapf { | |||
94 | #define STACKFRAME32_SZ sizeof(struct sparc_stackf32) | 94 | #define STACKFRAME32_SZ sizeof(struct sparc_stackf32) |
95 | 95 | ||
96 | #ifdef __KERNEL__ | 96 | #ifdef __KERNEL__ |
97 | |||
98 | #define __ARCH_SYS_PTRACE 1 | ||
99 | |||
97 | #define force_successful_syscall_return() \ | 100 | #define force_successful_syscall_return() \ |
98 | do { current_thread_info()->syscall_noerror = 1; \ | 101 | do { current_thread_info()->syscall_noerror = 1; \ |
99 | } while (0) | 102 | } while (0) |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index dc6f3647bfbc..b2b3dba1298d 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -78,6 +78,8 @@ | |||
78 | #include <linux/compiler.h> /* For unlikely. */ | 78 | #include <linux/compiler.h> /* For unlikely. */ |
79 | #include <linux/sched.h> /* For struct task_struct. */ | 79 | #include <linux/sched.h> /* For struct task_struct. */ |
80 | 80 | ||
81 | |||
82 | extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); | ||
81 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); | 83 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); |
82 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); | 84 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); |
83 | extern int ptrace_attach(struct task_struct *tsk); | 85 | extern int ptrace_attach(struct task_struct *tsk); |