Commit 193f087d492c566a211d01942c0f6b395f34f2ab
Committed by
Greg Ungerer
1 parent
588baeac38
Exists in
master
and in
4 other branches
m68knommu: define arch_has_single_step() and friends
Towards adding CONFIG_UTRACE support for non-mmu m68k add arch_has_single_step, and its support functions user_enable_single_step() and user_disable_single_step(). Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Showing 2 changed files with 27 additions and 3 deletions Side-by-side Diff
arch/m68k/include/asm/ptrace.h
... | ... | @@ -82,6 +82,18 @@ |
82 | 82 | #define instruction_pointer(regs) ((regs)->pc) |
83 | 83 | #define profile_pc(regs) instruction_pointer(regs) |
84 | 84 | extern void show_regs(struct pt_regs *); |
85 | + | |
86 | +/* | |
87 | + * These are defined as per linux/ptrace.h. | |
88 | + */ | |
89 | +struct task_struct; | |
90 | + | |
91 | +#ifndef CONFIG_MMU | |
92 | +#define arch_has_single_step() (1) | |
93 | +extern void user_enable_single_step(struct task_struct *); | |
94 | +extern void user_disable_single_step(struct task_struct *); | |
95 | +#endif | |
96 | + | |
85 | 97 | #endif /* __KERNEL__ */ |
86 | 98 | #endif /* __ASSEMBLY__ */ |
87 | 99 | #endif /* _M68K_PTRACE_H */ |
arch/m68knommu/kernel/ptrace.c
... | ... | @@ -86,6 +86,20 @@ |
86 | 86 | return 0; |
87 | 87 | } |
88 | 88 | |
89 | +void user_enable_single_step(struct task_struct *task) | |
90 | +{ | |
91 | + unsigned long srflags; | |
92 | + srflags = get_reg(task, PT_SR) | (TRACE_BITS << 16); | |
93 | + put_reg(task, PT_SR, srflags); | |
94 | +} | |
95 | + | |
96 | +void user_disable_single_step(struct task_struct *task) | |
97 | +{ | |
98 | + unsigned long srflags; | |
99 | + srflags = get_reg(task, PT_SR) & ~(TRACE_BITS << 16); | |
100 | + put_reg(task, PT_SR, srflags); | |
101 | +} | |
102 | + | |
89 | 103 | /* |
90 | 104 | * Called by kernel/ptrace.c when detaching.. |
91 | 105 | * |
92 | 106 | |
... | ... | @@ -93,10 +107,8 @@ |
93 | 107 | */ |
94 | 108 | void ptrace_disable(struct task_struct *child) |
95 | 109 | { |
96 | - unsigned long tmp; | |
97 | 110 | /* make sure the single step bit is not set. */ |
98 | - tmp = get_reg(child, PT_SR) & ~(TRACE_BITS << 16); | |
99 | - put_reg(child, PT_SR, tmp); | |
111 | + user_disable_single_step(child); | |
100 | 112 | } |
101 | 113 | |
102 | 114 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |