Skip to content

Commit

Permalink
FRV: Shrink TIF_WORK_MASK [ver #2]
Browse files Browse the repository at this point in the history
Shrink TIF_WORK_MASK so that it will fit in the 12-bit signed immediate
operand field of an ANDI instruction.

Suggested-by: Al Viro <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
dhowells authored and Al Viro committed Jun 1, 2012
1 parent 137c3c4 commit 1e5ef91
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
16 changes: 12 additions & 4 deletions arch/frv/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ register struct thread_info *__current_thread_info asm("gr15");
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
#define TIF_POLLING_NRFLAG 6 /* true if poll_idle() is polling TIF_NEED_RESCHED */
#define TIF_MEMDIE 7 /* is terminating due to OOM killer */

#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
Expand All @@ -105,8 +105,16 @@ register struct thread_info *__current_thread_info asm("gr15");
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)

#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 */
/* work to do on interrupt/exception return */
#define _TIF_WORK_MASK \
(_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP)

/* work to do on any return to u-space */
#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)

#if _TIF_ALLWORK_MASK >= 0x2000
#error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)"
#endif

/*
* Thread-synchronous status.
Expand Down
12 changes: 3 additions & 9 deletions arch/frv/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,7 @@ __syscall_exit:
movgs gr23,psr

ldi @(gr15,#TI_FLAGS),gr4
sethi.p %hi(_TIF_ALLWORK_MASK),gr5
setlo %lo(_TIF_ALLWORK_MASK),gr5
andcc gr4,gr5,gr0,icc0
andicc gr4,#_TIF_ALLWORK_MASK,gr0,icc0
bne icc0,#0,__syscall_exit_work

# restore all registers and return
Expand Down Expand Up @@ -1111,9 +1109,7 @@ __entry_resume_userspace:
__entry_return_from_user_interrupt:
LEDS 0x6402
ldi @(gr15,#TI_FLAGS),gr4
sethi.p %hi(_TIF_WORK_MASK),gr5
setlo %lo(_TIF_WORK_MASK),gr5
andcc gr4,gr5,gr0,icc0
andicc gr4,#_TIF_WORK_MASK,gr0,icc0
beq icc0,#1,__entry_return_direct

__entry_work_pending:
Expand All @@ -1133,9 +1129,7 @@ __entry_work_resched:

LEDS 0x6401
ldi @(gr15,#TI_FLAGS),gr4
sethi.p %hi(_TIF_WORK_MASK),gr5
setlo %lo(_TIF_WORK_MASK),gr5
andcc gr4,gr5,gr0,icc0
andicc gr4,#_TIF_WORK_MASK,gr0,icc0
beq icc0,#1,__entry_return_direct
andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0
bne icc0,#1,__entry_work_resched
Expand Down

0 comments on commit 1e5ef91

Please sign in to comment.