aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-09 15:42:56 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-30 11:56:20 -0400
commit9b5bbf729d2db27ecb477b42c0701c1c97eb5603 (patch)
treee48fc575d4f11f9504ebfeb35301c695112195ab /arch/tile/kernel
parent8d8cf0674023da578e0539dc7cf4d824b2cf1f9e (diff)
tile: correct r1 value during syscall tracing
The r1 value is set based on the r0 value as we return to user space. So tracing tools won't automatically see the right value. Fix this by generating the correct r1 value in do_syscall_trace_exit() rather than trying to tamper with the hot path in syscall return. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r--arch/tile/kernel/ptrace.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index bac187498d61..de98c6ddf136 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -265,6 +265,21 @@ int do_syscall_trace_enter(struct pt_regs *regs)
265 265
266void do_syscall_trace_exit(struct pt_regs *regs) 266void do_syscall_trace_exit(struct pt_regs *regs)
267{ 267{
268 long errno;
269
270 /*
271 * The standard tile calling convention returns the value (or negative
272 * errno) in r0, and zero (or positive errno) in r1.
273 * It saves a couple of cycles on the hot path to do this work in
274 * registers only as we return, rather than updating the in-memory
275 * struct ptregs.
276 */
277 errno = (long) regs->regs[0];
278 if (errno < 0 && errno > -4096)
279 regs->regs[1] = -errno;
280 else
281 regs->regs[1] = 0;
282
268 if (test_thread_flag(TIF_SYSCALL_TRACE)) 283 if (test_thread_flag(TIF_SYSCALL_TRACE))
269 tracehook_report_syscall_exit(regs, 0); 284 tracehook_report_syscall_exit(regs, 0);
270 285