summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/kernel/ptrace.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-11-11 21:51:49 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2018-12-17 13:50:25 -0800
commitaf5395c214c15c18de3decf2229373a8c88c4fde (patch)
treed378a62b132af1c2532f745e22c99ac69c40bba2 /arch/xtensa/kernel/ptrace.c
parent9f24f3c1067c8e4ffbbcd759180b422c9a761b1b (diff)
downloadlinux-af5395c214c15c18de3decf2229373a8c88c4fde.tar.bz2
xtensa: implement syscall tracepoints
Add TIF_SYSCALL_TRACEPOINT flag definition; add _TIF_SYSCALL_TRACEPOINT to _TIF_WORK_MASK. Call trace_sys_enter from do_syscall_trace_enter and trace_sys_exit from do_syscall_trace_leave when TIF_SYSCALL_TRACEPOINT flag is set. Add declaration of sys_call_table to arch/xtensa/include/asm/syscall.h Add definition of NR_syscalls to arch/xtensa/include/asm/unistd.h Select HAVE_SYSCALL_TRACEPOINTS. This change allows tracing each syscall entry and exit through the ftrace mechanism. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/kernel/ptrace.c')
-rw-r--r--arch/xtensa/kernel/ptrace.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 207aa272b48c..b964f0b2d886 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -27,6 +27,9 @@
#include <linux/tracehook.h>
#include <linux/uaccess.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/syscalls.h>
+
#include <asm/coprocessor.h>
#include <asm/elf.h>
#include <asm/page.h>
@@ -545,12 +548,17 @@ void do_syscall_trace_enter(struct pt_regs *regs)
tracehook_report_syscall_entry(regs))
regs->syscall = NO_SYSCALL;
+ if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+ trace_sys_enter(regs, syscall_get_nr(current, regs));
}
void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;
+ if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+ trace_sys_exit(regs, regs_return_value(regs));
+
step = test_thread_flag(TIF_SINGLESTEP);
if (step || test_thread_flag(TIF_SYSCALL_TRACE))