Skip to content

Commit

Permalink
MN10300: Add utrace/tracehooks support
Browse files Browse the repository at this point in the history
Add utrace/tracehooks support to MN10300.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed Jun 11, 2009
1 parent fd4f683 commit 5d28996
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 239 deletions.
1 change: 1 addition & 0 deletions arch/mn10300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration"
config MN10300
def_bool y
select HAVE_OPROFILE
select HAVE_ARCH_TRACEHOOK

config AM33
def_bool y
Expand Down
3 changes: 2 additions & 1 deletion arch/mn10300/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
typedef unsigned long elf_greg_t;

#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
#define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 1)
typedef elf_greg_t elf_gregset_t[ELF_NGREG];

#define ELF_NFPREG 32
Expand Down Expand Up @@ -76,6 +76,7 @@ do { \
} while (0)

#define USE_ELF_CORE_DUMP
#define CORE_DUMP_USE_REGSET
#define ELF_EXEC_PAGESIZE 4096

/*
Expand Down
8 changes: 1 addition & 7 deletions arch/mn10300/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);

unsigned long get_wchan(struct task_struct *p);

#define task_pt_regs(task) \
({ \
struct pt_regs *__regs__; \
__regs__ = (struct pt_regs *) (KSTK_TOP(task_stack_page(task)) - 8); \
__regs__ - 1; \
})

#define task_pt_regs(task) ((task)->thread.uregs)
#define KSTK_EIP(task) (task_pt_regs(task)->pc)
#define KSTK_ESP(task) (task_pt_regs(task)->sp)

Expand Down
8 changes: 8 additions & 0 deletions arch/mn10300/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ extern struct pt_regs *__frame; /* current frame pointer */
#if defined(__KERNEL__)

#if !defined(__ASSEMBLY__)
struct task_struct;

#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL)
#define instruction_pointer(regs) ((regs)->pc)
#define user_stack_pointer(regs) ((regs)->sp)
extern void show_regs(struct pt_regs *);

#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 /* !__ASSEMBLY */

#define profile_pc(regs) ((regs)->pc)
Expand Down
13 changes: 5 additions & 8 deletions arch/mn10300/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ENTRY(system_call)
cmp nr_syscalls,d0
bcc syscall_badsys
btst _TIF_SYSCALL_TRACE,(TI_flags,a2)
bne syscall_trace_entry
bne syscall_entry_trace
syscall_call:
add d0,d0,a1
add a1,a1
Expand Down Expand Up @@ -104,11 +104,10 @@ restore_all:
syscall_exit_work:
btst _TIF_SYSCALL_TRACE,d2
beq work_pending
__sti # could let do_syscall_trace() call
__sti # could let syscall_trace_exit() call
# schedule() instead
mov fp,d0
mov 1,d1
call do_syscall_trace[],0 # do_syscall_trace(regs,entryexit)
call syscall_trace_exit[],0 # do_syscall_trace(regs)
jmp resume_userspace

ALIGN
Expand Down Expand Up @@ -138,13 +137,11 @@ work_notifysig:
jmp resume_userspace

# perform syscall entry tracing
syscall_trace_entry:
syscall_entry_trace:
mov -ENOSYS,d0
mov d0,(REG_D0,fp)
mov fp,d0
clr d1
call do_syscall_trace[],0
mov (REG_ORIG_D0,fp),d0
call syscall_trace_entry[],0 # returns the syscall number to actually use
mov (REG_D1,fp),d1
cmp nr_syscalls,d0
bcs syscall_call
Expand Down
Loading

0 comments on commit 5d28996

Please sign in to comment.