diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:31:56 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:56 -0500 |
commit | fdadd54db5e9f05e673eb08746bf2bea460d9f0d (patch) | |
tree | a5211e35cc75ed91a0d4ea40b65b83408bb3c237 /arch | |
parent | bb61682b3f31dec7d058cae2f6edd2275248a704 (diff) |
x86: x86 ptrace generic requests
This removes duplicated code by calling the generic ptrace_request and
compat_ptrace_request functions for the things they already handle.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index e6a680c7daf7..3e34b14e8846 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -760,12 +760,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
760 | unsigned long __user *datap = (unsigned long __user *)data; | 760 | unsigned long __user *datap = (unsigned long __user *)data; |
761 | 761 | ||
762 | switch (request) { | 762 | switch (request) { |
763 | /* when I and D space are separate, these will need to be fixed. */ | ||
764 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | ||
765 | case PTRACE_PEEKDATA: | ||
766 | ret = generic_ptrace_peekdata(child, addr, data); | ||
767 | break; | ||
768 | |||
769 | /* read the word at location addr in the USER area. */ | 763 | /* read the word at location addr in the USER area. */ |
770 | case PTRACE_PEEKUSR: { | 764 | case PTRACE_PEEKUSR: { |
771 | unsigned long tmp; | 765 | unsigned long tmp; |
@@ -787,12 +781,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
787 | break; | 781 | break; |
788 | } | 782 | } |
789 | 783 | ||
790 | /* when I and D space are separate, this will have to be fixed. */ | ||
791 | case PTRACE_POKETEXT: /* write the word at location addr. */ | ||
792 | case PTRACE_POKEDATA: | ||
793 | ret = generic_ptrace_pokedata(child, addr, data); | ||
794 | break; | ||
795 | |||
796 | case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ | 784 | case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ |
797 | ret = -EIO; | 785 | ret = -EIO; |
798 | if ((addr & (sizeof(data) - 1)) || addr < 0 || | 786 | if ((addr & (sizeof(data) - 1)) || addr < 0 || |
@@ -1183,24 +1171,6 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) | |||
1183 | childregs = task_pt_regs(child); | 1171 | childregs = task_pt_regs(child); |
1184 | 1172 | ||
1185 | switch (request) { | 1173 | switch (request) { |
1186 | case PTRACE_PEEKDATA: | ||
1187 | case PTRACE_PEEKTEXT: | ||
1188 | ret = 0; | ||
1189 | if (access_process_vm(child, addr, &val, sizeof(u32), 0) != | ||
1190 | sizeof(u32)) | ||
1191 | ret = -EIO; | ||
1192 | else | ||
1193 | ret = put_user(val, (unsigned int __user *)datap); | ||
1194 | break; | ||
1195 | |||
1196 | case PTRACE_POKEDATA: | ||
1197 | case PTRACE_POKETEXT: | ||
1198 | ret = 0; | ||
1199 | if (access_process_vm(child, addr, &data, sizeof(u32), 1) != | ||
1200 | sizeof(u32)) | ||
1201 | ret = -EIO; | ||
1202 | break; | ||
1203 | |||
1204 | case PTRACE_PEEKUSR: | 1174 | case PTRACE_PEEKUSR: |
1205 | ret = getreg32(child, addr, &val); | 1175 | ret = getreg32(child, addr, &val); |
1206 | if (ret == 0) | 1176 | if (ret == 0) |
@@ -1246,13 +1216,8 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) | |||
1246 | sizeof(struct user32_fxsr_struct), | 1216 | sizeof(struct user32_fxsr_struct), |
1247 | datap); | 1217 | datap); |
1248 | 1218 | ||
1249 | case PTRACE_GETEVENTMSG: | ||
1250 | ret = put_user(child->ptrace_message, | ||
1251 | (unsigned int __user *)compat_ptr(data)); | ||
1252 | break; | ||
1253 | |||
1254 | default: | 1219 | default: |
1255 | BUG(); | 1220 | return compat_ptrace_request(child, request, addr, data); |
1256 | } | 1221 | } |
1257 | 1222 | ||
1258 | out: | 1223 | out: |