Skip to content

Commit

Permalink
m68knommu: define arch_has_single_step() and friends
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Ungerer authored and Greg Ungerer committed Dec 4, 2009
1 parent 588baea commit 193f087
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
12 changes: 12 additions & 0 deletions arch/m68k/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ struct switch_stack {
#define instruction_pointer(regs) ((regs)->pc)
#define profile_pc(regs) instruction_pointer(regs)
extern void show_regs(struct pt_regs *);

/*
* These are defined as per linux/ptrace.h.
*/
struct task_struct;

#ifndef CONFIG_MMU
#define arch_has_single_step() (1)
extern void user_enable_single_step(struct task_struct *);
extern void user_disable_single_step(struct task_struct *);
#endif

#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */
#endif /* _M68K_PTRACE_H */
18 changes: 15 additions & 3 deletions arch/m68knommu/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,29 @@ static inline int put_reg(struct task_struct *task, int regno,
return 0;
}

void user_enable_single_step(struct task_struct *task)
{
unsigned long srflags;
srflags = get_reg(task, PT_SR) | (TRACE_BITS << 16);
put_reg(task, PT_SR, srflags);
}

void user_disable_single_step(struct task_struct *task)
{
unsigned long srflags;
srflags = get_reg(task, PT_SR) & ~(TRACE_BITS << 16);
put_reg(task, PT_SR, srflags);
}

/*
* Called by kernel/ptrace.c when detaching..
*
* Make sure the single step bit is not set.
*/
void ptrace_disable(struct task_struct *child)
{
unsigned long tmp;
/* make sure the single step bit is not set. */
tmp = get_reg(child, PT_SR) & ~(TRACE_BITS << 16);
put_reg(child, PT_SR, tmp);
user_disable_single_step(child);
}

long arch_ptrace(struct task_struct *child, long request, long addr, long data)
Expand Down

0 comments on commit 193f087

Please sign in to comment.