Skip to content

Commit cec3fd3

Browse files
committed
sh: Tidy up the _TIF work masks, and fix syscall trace bug on singlestep.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent daf423d commit cec3fd3

3 files changed

Lines changed: 31 additions & 15 deletions

File tree

‎arch/sh/include/asm/thread_info.h‎

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,34 @@ static inline struct thread_info *current_thread_info(void)
123123
#define TIF_MEMDIE 18
124124
#define TIF_FREEZE 19
125125

126-
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
127-
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
128-
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
129-
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
130-
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
131-
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
132-
#define _TIF_USEDFPU (1<<TIF_USEDFPU)
133-
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
134-
#define _TIF_FREEZE (1<<TIF_FREEZE)
135-
136-
#define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */
137-
#define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */
126+
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
127+
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
128+
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
129+
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
130+
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
131+
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
132+
#define _TIF_USEDFPU (1 << TIF_USEDFPU)
133+
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
134+
#define _TIF_FREEZE (1 << TIF_FREEZE)
135+
136+
/*
137+
* _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within a byte, or we
138+
* blow the tst immediate size constraints and need to fix up
139+
* arch/sh/kernel/entry-common.S.
140+
*/
141+
142+
/* work to do in syscall trace */
143+
#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
144+
_TIF_SYSCALL_AUDIT)
145+
146+
/* work to do on any return to u-space */
147+
#define _TIF_ALLWORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING | \
148+
_TIF_NEED_RESCHED | _TIF_SYSCALL_AUDIT | \
149+
_TIF_SINGLESTEP | _TIF_RESTORE_SIGMASK)
150+
151+
/* work to do on interrupt/exception return */
152+
#define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
153+
_TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
138154

139155
#endif /* __KERNEL__ */
140156

‎arch/sh/kernel/cpu/sh5/entry.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ syscall_allowed:
13001300

13011301
getcon KCR0, r2
13021302
ld.l r2, TI_FLAGS, r4
1303-
movi (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT), r6
1303+
movi _TIF_WORK_SYSCALL_MASK, r6
13041304
and r6, r4, r6
13051305
beq/l r6, ZERO, tr0
13061306

‎arch/sh/kernel/entry-common.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ work_resched:
202202
syscall_exit_work:
203203
! r0: current_thread_info->flags
204204
! r8: current_thread_info
205-
tst #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT, r0
205+
tst #_TIF_WORK_SYSCALL_MASK, r0
206206
bt/s work_pending
207207
tst #_TIF_NEED_RESCHED, r0
208208
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -351,7 +351,7 @@ ENTRY(system_call)
351351
!
352352
get_current_thread_info r8, r10
353353
mov.l @(TI_FLAGS,r8), r8
354-
mov #(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT), r10
354+
mov #_TIF_WORK_SYSCALL_MASK, r10
355355
tst r10, r8
356356
bf syscall_trace_entry
357357
!

0 commit comments

Comments
 (0)