csky: Coding convention in entry.S

There is no fixup or feature in the patch, we only cleanup with:

 - Remove unnecessary reg used (r11, r12), just use r9 & r10 &
   syscallid regs as temp useage.
 - Add _TIF_SYSCALL_WORK and _TIF_WORK_MASK to gather macros.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
This commit is contained in:
Guo Ren 2020-05-24 12:14:11 +00:00
parent e0bbb53843
commit 20f69538b9
4 changed files with 42 additions and 40 deletions

View File

@ -174,9 +174,4 @@
movi r6, 0 movi r6, 0
cpwcr r6, cpcr31 cpwcr r6, cpcr31
.endm .endm
.macro ANDI_R3 rx, imm
lsri \rx, 3
andi \rx, (\imm >> 3)
.endm
#endif /* __ASM_CSKY_ENTRY_H */ #endif /* __ASM_CSKY_ENTRY_H */

View File

@ -302,9 +302,4 @@
jmpi 3f /* jump to va */ jmpi 3f /* jump to va */
3: 3:
.endm .endm
.macro ANDI_R3 rx, imm
lsri \rx, 3
andi \rx, (\imm >> 3)
.endm
#endif /* __ASM_CSKY_ENTRY_H */ #endif /* __ASM_CSKY_ENTRY_H */

View File

@ -81,4 +81,10 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_SECCOMP (1 << TIF_SECCOMP)
#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
_TIF_NOTIFY_RESUME | _TIF_UPROBE)
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
_TIF_SYSCALL_TRACEPOINT)
#endif /* _ASM_CSKY_THREAD_INFO_H */ #endif /* _ASM_CSKY_THREAD_INFO_H */

View File

@ -134,31 +134,32 @@ ENTRY(csky_systemcall)
#endif #endif
psrset ee, ie psrset ee, ie
lrw r11, __NR_syscalls lrw r9, __NR_syscalls
cmphs syscallid, r11 /* Check nr of syscall */ cmphs syscallid, r9 /* Check nr of syscall */
bt ret_from_exception bt ret_from_exception
lrw r13, sys_call_table lrw r9, sys_call_table
ixw r13, syscallid ixw r9, syscallid
ldw r11, (r13) ldw syscallid, (r9)
cmpnei r11, 0 cmpnei syscallid, 0
bf ret_from_exception bf ret_from_exception
mov r9, sp mov r9, sp
bmaski r10, THREAD_SHIFT bmaski r10, THREAD_SHIFT
andn r9, r10 andn r9, r10
ldw r12, (r9, TINFO_FLAGS) ldw r10, (r9, TINFO_FLAGS)
ANDI_R3 r12, (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT) lrw r9, _TIF_SYSCALL_WORK
cmpnei r12, 0 and r10, r9
cmpnei r10, 0
bt csky_syscall_trace bt csky_syscall_trace
#if defined(__CSKYABIV2__) #if defined(__CSKYABIV2__)
subi sp, 8 subi sp, 8
stw r5, (sp, 0x4) stw r5, (sp, 0x4)
stw r4, (sp, 0x0) stw r4, (sp, 0x0)
jsr r11 /* Do system call */ jsr syscallid /* Do system call */
addi sp, 8 addi sp, 8
#else #else
jsr r11 jsr syscallid
#endif #endif
stw a0, (sp, LSAVE_A0) /* Save return value */ stw a0, (sp, LSAVE_A0) /* Save return value */
jmpi ret_from_exception jmpi ret_from_exception
@ -177,13 +178,12 @@ csky_syscall_trace:
stw r9, (sp, 0x0) stw r9, (sp, 0x0)
ldw r9, (sp, LSAVE_A5) ldw r9, (sp, LSAVE_A5)
stw r9, (sp, 0x4) stw r9, (sp, 0x4)
jsr syscallid /* Do system call */
addi sp, 8
#else #else
ldw r6, (sp, LSAVE_A4) ldw r6, (sp, LSAVE_A4)
ldw r7, (sp, LSAVE_A5) ldw r7, (sp, LSAVE_A5)
#endif jsr syscallid /* Do system call */
jsr r11 /* Do system call */
#if defined(__CSKYABIV2__)
addi sp, 8
#endif #endif
stw a0, (sp, LSAVE_A0) /* Save return value */ stw a0, (sp, LSAVE_A0) /* Save return value */
@ -202,18 +202,20 @@ ENTRY(ret_from_fork)
mov r9, sp mov r9, sp
bmaski r10, THREAD_SHIFT bmaski r10, THREAD_SHIFT
andn r9, r10 andn r9, r10
ldw r12, (r9, TINFO_FLAGS) ldw r10, (r9, TINFO_FLAGS)
ANDI_R3 r12, (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT) lrw r9, _TIF_SYSCALL_WORK
cmpnei r12, 0 and r10, r9
cmpnei r10, 0
bf ret_from_exception bf ret_from_exception
mov a0, sp /* sp = pt_regs pointer */ mov a0, sp /* sp = pt_regs pointer */
jbsr syscall_trace_exit jbsr syscall_trace_exit
ret_from_exception: ret_from_exception:
psrclr ie psrclr ie
ld syscallid, (sp, LSAVE_PSR) ld r9, (sp, LSAVE_PSR)
btsti syscallid, 31 btsti r9, 31
bt 1f
/* /*
* Load address of current->thread_info, Then get address of task_struct * Load address of current->thread_info, Then get address of task_struct
* Get task_needreshed in task_struct * Get task_needreshed in task_struct
@ -222,15 +224,19 @@ ret_from_exception:
bmaski r10, THREAD_SHIFT bmaski r10, THREAD_SHIFT
andn r9, r10 andn r9, r10
bt 1f ldw r10, (r9, TINFO_FLAGS)
ldw r12, (r9, TINFO_FLAGS) lrw r9, _TIF_WORK_MASK
andi r12, (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | _TIF_UPROBE) and r10, r9
cmpnei r12, 0 cmpnei r10, 0
bt exit_work bt exit_work
1: 1:
#ifdef CONFIG_PREEMPTION #ifdef CONFIG_PREEMPTION
ldw r12, (r9, TINFO_PREEMPT) mov r9, sp
cmpnei r12, 0 bmaski r10, THREAD_SHIFT
andn r9, r10
ldw r10, (r9, TINFO_PREEMPT)
cmpnei r10, 0
bt 2f bt 2f
jbsr preempt_schedule_irq /* irq en/disable is done inside */ jbsr preempt_schedule_irq /* irq en/disable is done inside */
2: 2:
@ -246,15 +252,15 @@ ret_from_exception:
RESTORE_ALL RESTORE_ALL
exit_work: exit_work:
lrw syscallid, ret_from_exception lrw r9, ret_from_exception
mov lr, syscallid mov lr, r9
btsti r12, TIF_NEED_RESCHED btsti r10, TIF_NEED_RESCHED
bt work_resched bt work_resched
psrset ie psrset ie
mov a0, sp mov a0, sp
mov a1, r12 mov a1, r10
jmpi do_notify_resume jmpi do_notify_resume
work_resched: work_resched: