Commit 5d289964 authored by David Howells's avatar David Howells Committed by Linus Torvalds

MN10300: Add utrace/tracehooks support

Add utrace/tracehooks support to MN10300.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fd4f683d
...@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration" ...@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration"
config MN10300 config MN10300
def_bool y def_bool y
select HAVE_OPROFILE select HAVE_OPROFILE
select HAVE_ARCH_TRACEHOOK
config AM33 config AM33
def_bool y def_bool y
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
typedef unsigned long elf_greg_t; 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]; typedef elf_greg_t elf_gregset_t[ELF_NGREG];
#define ELF_NFPREG 32 #define ELF_NFPREG 32
...@@ -76,6 +76,7 @@ do { \ ...@@ -76,6 +76,7 @@ do { \
} while (0) } while (0)
#define USE_ELF_CORE_DUMP #define USE_ELF_CORE_DUMP
#define CORE_DUMP_USE_REGSET
#define ELF_EXEC_PAGESIZE 4096 #define ELF_EXEC_PAGESIZE 4096
/* /*
......
...@@ -143,13 +143,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); ...@@ -143,13 +143,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
unsigned long get_wchan(struct task_struct *p); unsigned long get_wchan(struct task_struct *p);
#define task_pt_regs(task) \ #define task_pt_regs(task) ((task)->thread.uregs)
({ \
struct pt_regs *__regs__; \
__regs__ = (struct pt_regs *) (KSTK_TOP(task_stack_page(task)) - 8); \
__regs__ - 1; \
})
#define KSTK_EIP(task) (task_pt_regs(task)->pc) #define KSTK_EIP(task) (task_pt_regs(task)->pc)
#define KSTK_ESP(task) (task_pt_regs(task)->sp) #define KSTK_ESP(task) (task_pt_regs(task)->sp)
......
...@@ -91,9 +91,17 @@ extern struct pt_regs *__frame; /* current frame pointer */ ...@@ -91,9 +91,17 @@ extern struct pt_regs *__frame; /* current frame pointer */
#if defined(__KERNEL__) #if defined(__KERNEL__)
#if !defined(__ASSEMBLY__) #if !defined(__ASSEMBLY__)
struct task_struct;
#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) #define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL)
#define instruction_pointer(regs) ((regs)->pc) #define instruction_pointer(regs) ((regs)->pc)
#define user_stack_pointer(regs) ((regs)->sp)
extern void show_regs(struct pt_regs *); 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 */ #endif /* !__ASSEMBLY */
#define profile_pc(regs) ((regs)->pc) #define profile_pc(regs) ((regs)->pc)
......
...@@ -76,7 +76,7 @@ ENTRY(system_call) ...@@ -76,7 +76,7 @@ ENTRY(system_call)
cmp nr_syscalls,d0 cmp nr_syscalls,d0
bcc syscall_badsys bcc syscall_badsys
btst _TIF_SYSCALL_TRACE,(TI_flags,a2) btst _TIF_SYSCALL_TRACE,(TI_flags,a2)
bne syscall_trace_entry bne syscall_entry_trace
syscall_call: syscall_call:
add d0,d0,a1 add d0,d0,a1
add a1,a1 add a1,a1
...@@ -104,11 +104,10 @@ restore_all: ...@@ -104,11 +104,10 @@ restore_all:
syscall_exit_work: syscall_exit_work:
btst _TIF_SYSCALL_TRACE,d2 btst _TIF_SYSCALL_TRACE,d2
beq work_pending beq work_pending
__sti # could let do_syscall_trace() call __sti # could let syscall_trace_exit() call
# schedule() instead # schedule() instead
mov fp,d0 mov fp,d0
mov 1,d1 call syscall_trace_exit[],0 # do_syscall_trace(regs)
call do_syscall_trace[],0 # do_syscall_trace(regs,entryexit)
jmp resume_userspace jmp resume_userspace
ALIGN ALIGN
...@@ -138,13 +137,11 @@ work_notifysig: ...@@ -138,13 +137,11 @@ work_notifysig:
jmp resume_userspace jmp resume_userspace
# perform syscall entry tracing # perform syscall entry tracing
syscall_trace_entry: syscall_entry_trace:
mov -ENOSYS,d0 mov -ENOSYS,d0
mov d0,(REG_D0,fp) mov d0,(REG_D0,fp)
mov fp,d0 mov fp,d0
clr d1 call syscall_trace_entry[],0 # returns the syscall number to actually use
call do_syscall_trace[],0
mov (REG_ORIG_D0,fp),d0
mov (REG_D1,fp),d1 mov (REG_D1,fp),d1
cmp nr_syscalls,d0 cmp nr_syscalls,d0
bcs syscall_call bcs syscall_call
......
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/tracehook.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/ucontext.h> #include <asm/ucontext.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -511,6 +512,9 @@ static void do_signal(struct pt_regs *regs) ...@@ -511,6 +512,9 @@ static void do_signal(struct pt_regs *regs)
* clear the TIF_RESTORE_SIGMASK flag */ * clear the TIF_RESTORE_SIGMASK flag */
if (test_thread_flag(TIF_RESTORE_SIGMASK)) if (test_thread_flag(TIF_RESTORE_SIGMASK))
clear_thread_flag(TIF_RESTORE_SIGMASK); clear_thread_flag(TIF_RESTORE_SIGMASK);
tracehook_signal_handler(signr, &info, &ka, regs,
test_thread_flag(TIF_SINGLESTEP));
} }
return; return;
...@@ -561,4 +565,9 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) ...@@ -561,4 +565,9 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
/* deal with pending signal delivery */ /* deal with pending signal delivery */
if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
do_signal(regs); do_signal(regs);
if (thread_info_flags & _TIF_NOTIFY_RESUME) {
clear_thread_flag(TIF_NOTIFY_RESUME);
tracehook_notify_resume(__frame);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment