aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r--arch/tile/kernel/intvec_32.S10
-rw-r--r--arch/tile/kernel/intvec_64.S24
-rw-r--r--arch/tile/kernel/ptrace.c39
-rw-r--r--arch/tile/kernel/time.c6
4 files changed, 51 insertions, 28 deletions
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index f212bf7cea86..cb52d66343ed 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1201,7 +1201,10 @@ handle_syscall:
1201 lw r30, r31 1201 lw r30, r31
1202 andi r30, r30, _TIF_SYSCALL_TRACE 1202 andi r30, r30, _TIF_SYSCALL_TRACE
1203 bzt r30, .Lrestore_syscall_regs 1203 bzt r30, .Lrestore_syscall_regs
1204 jal do_syscall_trace 1204 {
1205 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1206 jal do_syscall_trace_enter
1207 }
1205 FEEDBACK_REENTER(handle_syscall) 1208 FEEDBACK_REENTER(handle_syscall)
1206 1209
1207 /* 1210 /*
@@ -1252,7 +1255,10 @@ handle_syscall:
1252 lw r30, r31 1255 lw r30, r31
1253 andi r30, r30, _TIF_SYSCALL_TRACE 1256 andi r30, r30, _TIF_SYSCALL_TRACE
1254 bzt r30, 1f 1257 bzt r30, 1f
1255 jal do_syscall_trace 1258 {
1259 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1260 jal do_syscall_trace_exit
1261 }
1256 FEEDBACK_REENTER(handle_syscall) 1262 FEEDBACK_REENTER(handle_syscall)
12571: { 12631: {
1258 movei r30, 0 /* not an NMI */ 1264 movei r30, 0 /* not an NMI */
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 4ea080902654..85d483957027 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1000,13 +1000,19 @@ handle_syscall:
1000 1000
1001 /* Trace syscalls, if requested. */ 1001 /* Trace syscalls, if requested. */
1002 addi r31, r31, THREAD_INFO_FLAGS_OFFSET 1002 addi r31, r31, THREAD_INFO_FLAGS_OFFSET
1003 ld r30, r31 1003 {
1004 andi r30, r30, _TIF_SYSCALL_TRACE 1004 ld r30, r31
1005 moveli r32, _TIF_SYSCALL_ENTRY_WORK
1006 }
1007 and r30, r30, r32
1005 { 1008 {
1006 addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET 1009 addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET
1007 beqzt r30, .Lrestore_syscall_regs 1010 beqzt r30, .Lrestore_syscall_regs
1008 } 1011 }
1009 jal do_syscall_trace 1012 {
1013 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1014 jal do_syscall_trace_enter
1015 }
1010 FEEDBACK_REENTER(handle_syscall) 1016 FEEDBACK_REENTER(handle_syscall)
1011 1017
1012 /* 1018 /*
@@ -1071,13 +1077,19 @@ handle_syscall:
1071 FEEDBACK_REENTER(handle_syscall) 1077 FEEDBACK_REENTER(handle_syscall)
1072 1078
1073 /* Do syscall trace again, if requested. */ 1079 /* Do syscall trace again, if requested. */
1074 ld r30, r31 1080 {
1075 andi r0, r30, _TIF_SYSCALL_TRACE 1081 ld r30, r31
1082 moveli r32, _TIF_SYSCALL_EXIT_WORK
1083 }
1084 and r0, r30, r32
1076 { 1085 {
1077 andi r0, r30, _TIF_SINGLESTEP 1086 andi r0, r30, _TIF_SINGLESTEP
1078 beqzt r0, 1f 1087 beqzt r0, 1f
1079 } 1088 }
1080 jal do_syscall_trace 1089 {
1090 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1091 jal do_syscall_trace_exit
1092 }
1081 FEEDBACK_REENTER(handle_syscall) 1093 FEEDBACK_REENTER(handle_syscall)
1082 andi r0, r30, _TIF_SINGLESTEP 1094 andi r0, r30, _TIF_SINGLESTEP
1083 1095
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 9835312d5a91..0f83ed4602b2 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -21,9 +21,13 @@
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <linux/regset.h> 22#include <linux/regset.h>
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/tracehook.h>
24#include <asm/traps.h> 25#include <asm/traps.h>
25#include <arch/chip.h> 26#include <arch/chip.h>
26 27
28#define CREATE_TRACE_POINTS
29#include <trace/events/syscalls.h>
30
27void user_enable_single_step(struct task_struct *child) 31void user_enable_single_step(struct task_struct *child)
28{ 32{
29 set_tsk_thread_flag(child, TIF_SINGLESTEP); 33 set_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -246,29 +250,26 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
246} 250}
247#endif 251#endif
248 252
249void do_syscall_trace(void) 253int do_syscall_trace_enter(struct pt_regs *regs)
250{ 254{
251 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 255 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
252 return; 256 if (tracehook_report_syscall_entry(regs))
257 regs->regs[TREG_SYSCALL_NR] = -1;
258 }
253 259
254 if (!(current->ptrace & PT_PTRACED)) 260 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
255 return; 261 trace_sys_enter(regs, regs->regs[TREG_SYSCALL_NR]);
256 262
257 /* 263 return regs->regs[TREG_SYSCALL_NR];
258 * The 0x80 provides a way for the tracing parent to distinguish 264}
259 * between a syscall stop and SIGTRAP delivery
260 */
261 ptrace_notify(SIGTRAP|((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
262 265
263 /* 266void do_syscall_trace_exit(struct pt_regs *regs)
264 * this isn't the same as continuing with a signal, but it will do 267{
265 * for normal use. strace only continues with a signal if the 268 if (test_thread_flag(TIF_SYSCALL_TRACE))
266 * stopping signal is not SIGTRAP. -brl 269 tracehook_report_syscall_exit(regs, 0);
267 */ 270
268 if (current->exit_code) { 271 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
269 send_sig(current->exit_code, current, 1); 272 trace_sys_exit(regs, regs->regs[0]);
270 current->exit_code = 0;
271 }
272} 273}
273 274
274void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) 275void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index f6f50f2a5e37..5ac397ec6986 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -230,6 +230,10 @@ int setup_profiling_timer(unsigned int multiplier)
230 */ 230 */
231cycles_t ns2cycles(unsigned long nsecs) 231cycles_t ns2cycles(unsigned long nsecs)
232{ 232{
233 struct clock_event_device *dev = &__get_cpu_var(tile_timer); 233 /*
234 * We do not have to disable preemption here as each core has the same
235 * clock frequency.
236 */
237 struct clock_event_device *dev = &__raw_get_cpu_var(tile_timer);
234 return ((u64)nsecs * dev->mult) >> dev->shift; 238 return ((u64)nsecs * dev->mult) >> dev->shift;
235} 239}