Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

parisc: Add syscall tracepoint support

This patch adds support for the TIF_SYSCALL_TRACEPOINT on the parisc
architecture. Basically, it calls the appropriate tracepoints on syscall
entry and exit.

Signed-off-by: Helge Deller <deller@gmx.de>

+28 -1
+1
arch/parisc/Kconfig
··· 6 6 select HAVE_OPROFILE 7 7 select HAVE_FUNCTION_TRACER 8 8 select HAVE_FUNCTION_GRAPH_TRACER 9 + select HAVE_SYSCALL_TRACEPOINTS 9 10 select ARCH_WANT_FRAME_POINTERS 10 11 select RTC_CLASS 11 12 select RTC_DRV_GENERIC
+2
arch/parisc/include/asm/ftrace.h
··· 6 6 7 7 #define MCOUNT_INSN_SIZE 4 8 8 9 + extern unsigned long sys_call_table[]; 10 + 9 11 extern unsigned long return_address(unsigned int); 10 12 11 13 #define ftrace_return_address(n) return_address(n)
+9
arch/parisc/include/asm/syscall.h
··· 8 8 #include <linux/err.h> 9 9 #include <asm/ptrace.h> 10 10 11 + #define NR_syscalls (__NR_Linux_syscalls) 12 + 11 13 static inline long syscall_get_nr(struct task_struct *tsk, 12 14 struct pt_regs *regs) 13 15 { ··· 35 33 args[1] = regs->gr[25]; 36 34 case 1: 37 35 args[0] = regs->gr[26]; 36 + case 0: 38 37 break; 39 38 default: 40 39 BUG(); 41 40 } 41 + } 42 + 43 + static inline long syscall_get_return_value(struct task_struct *task, 44 + struct pt_regs *regs) 45 + { 46 + return regs->gr[28]; 42 47 } 43 48 44 49 static inline void syscall_set_return_value(struct task_struct *task,
+3 -1
arch/parisc/include/asm/thread_info.h
··· 55 55 #define TIF_SINGLESTEP 9 /* single stepping? */ 56 56 #define TIF_BLOCKSTEP 10 /* branch stepping? */ 57 57 #define TIF_SECCOMP 11 /* secure computing */ 58 + #define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */ 58 59 59 60 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 60 61 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) ··· 67 66 #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 68 67 #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) 69 68 #define _TIF_SECCOMP (1 << TIF_SECCOMP) 69 + #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 70 70 71 71 #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ 72 72 _TIF_NEED_RESCHED) 73 73 #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 74 74 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \ 75 - _TIF_SECCOMP) 75 + _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT) 76 76 77 77 #ifdef CONFIG_64BIT 78 78 # ifdef CONFIG_COMPAT
+12
arch/parisc/kernel/ptrace.c
··· 30 30 /* PSW bits we allow the debugger to modify */ 31 31 #define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB) 32 32 33 + #define CREATE_TRACE_POINTS 34 + #include <trace/events/syscalls.h> 35 + 33 36 /* 34 37 * Called by kernel/ptrace.c when detaching.. 35 38 * ··· 286 283 regs->gr[20] = -1UL; 287 284 goto out; 288 285 } 286 + #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS 287 + if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 288 + trace_sys_enter(regs, regs->gr[20]); 289 + #endif 289 290 290 291 #ifdef CONFIG_64BIT 291 292 if (!is_compat_task()) ··· 317 310 test_thread_flag(TIF_BLOCKSTEP); 318 311 319 312 audit_syscall_exit(regs); 313 + 314 + #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS 315 + if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 316 + trace_sys_exit(regs, regs->gr[20]); 317 + #endif 320 318 321 319 if (stepping || test_thread_flag(TIF_SYSCALL_TRACE)) 322 320 tracehook_report_syscall_exit(regs, stepping);
+1
arch/parisc/kernel/syscall.S
··· 912 912 913 913 .align 8 914 914 ENTRY(sys_call_table) 915 + .export sys_call_table,data 915 916 #include "syscall_table.S" 916 917 END(sys_call_table) 917 918