summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-11-16 06:33:47 +0300
committerMax Filippov <jcmvbkbc@gmail.com>2018-12-18 00:48:21 +0300
commit3aee3e25deeab083df21012060c98e9987ac9177 (patch)
tree002a976fa81d491e15de918c90677eaccf9cd308 /arch
parent6a986984b63990c80252b2208036fe731a6ae113 (diff)
downloadlinux-3aee3e25deeab083df21012060c98e9987ac9177.tar.xz
xtensa: call do_syscall_trace_{enter,leave} selectively
Check whether calls to do_syscall_trace_{enter,leave} are necessary in the system_call function. Define _TIF_WORK_MASK to a bitmask of flags that reuire the calls. Fix comment. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/xtensa/include/asm/thread_info.h5
-rw-r--r--arch/xtensa/kernel/entry.S22
-rw-r--r--arch/xtensa/kernel/ptrace.c5
3 files changed, 20 insertions, 12 deletions
diff --git a/arch/xtensa/include/asm/thread_info.h b/arch/xtensa/include/asm/thread_info.h
index 49aa7879afde..c823dddfebdf 100644
--- a/arch/xtensa/include/asm/thread_info.h
+++ b/arch/xtensa/include/asm/thread_info.h
@@ -101,8 +101,6 @@ static inline struct thread_info *current_thread_info(void)
/*
* thread information flags
* - these are process state flags that various assembly files may need to access
- * - pending work-to-be-done flags are in LSW
- * - other flags in MSW
*/
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
#define TIF_SIGPENDING 1 /* signal pending */
@@ -118,8 +116,7 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
-#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
-#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
+#define _TIF_WORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)
/*
* Thread-synchronous status.
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index e41c1e1ccecb..e50f5124dc6f 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -1846,20 +1846,28 @@ ENTRY(system_call)
/* regs->syscall = regs->areg[2] */
- l32i a3, a2, PT_AREG2
+ l32i a7, a2, PT_AREG2
+ s32i a7, a2, PT_SYSCALL
+
+ GET_THREAD_INFO(a4, a1)
+ l32i a3, a4, TI_FLAGS
+ movi a4, _TIF_WORK_MASK
+ and a3, a3, a4
+ beqz a3, 1f
+
mov a6, a2
- s32i a3, a2, PT_SYSCALL
call4 do_syscall_trace_enter
- mov a3, a6
+ l32i a7, a2, PT_SYSCALL
+1:
/* syscall = sys_call_table[syscall_nr] */
movi a4, sys_call_table
movi a5, __NR_syscalls
movi a6, -ENOSYS
- bgeu a3, a5, 1f
+ bgeu a7, a5, 1f
- addx4 a4, a3, a4
+ addx4 a4, a7, a4
l32i a4, a4, 0
movi a5, sys_ni_syscall;
beq a4, a5, 1f
@@ -1881,6 +1889,10 @@ ENTRY(system_call)
1: /* regs->areg[2] = return_value */
s32i a6, a2, PT_AREG2
+ bnez a3, 1f
+ retw
+
+1:
mov a6, a2
call4 do_syscall_trace_leave
retw
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 86622d4db328..f73a6a71323e 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -487,13 +487,12 @@ long arch_ptrace(struct task_struct *child, long request,
return ret;
}
-unsigned long do_syscall_trace_enter(struct pt_regs *regs)
+void do_syscall_trace_enter(struct pt_regs *regs)
{
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
tracehook_report_syscall_entry(regs))
- return NO_SYSCALL;
+ regs->syscall = NO_SYSCALL;
- return regs->areg[2];
}
void do_syscall_trace_leave(struct pt_regs *regs)