Commit e0f9f4a6 authored by Russell King's avatar Russell King

[PATCH] ARM: Use __NR_SYSCALL_BASE and __ARM_NR_BASE in asm code

Don't define our own local constants, but use those already defined
in asm/unistd.h instead.
Signed-off-by: default avatarRussell King <rmk@arm.linux.org.uk>
parent 925c8a1a
...@@ -111,7 +111,17 @@ ENTRY(ret_from_fork) ...@@ -111,7 +111,17 @@ ENTRY(ret_from_fork)
ENTRY(vector_swi) ENTRY(vector_swi)
save_user_regs save_user_regs
zero_fp zero_fp
get_scno
/*
* Get the system call number.
*/
#ifdef CONFIG_ARM_THUMB
tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
ldreq scno, [lr, #-4]
#else
ldr scno, [lr, #-4] @ get SWI instruction
#endif
arm710_bug_check scno, ip arm710_bug_check scno, ip
#ifdef CONFIG_ALIGNMENT_TRAP #ifdef CONFIG_ALIGNMENT_TRAP
...@@ -126,7 +136,7 @@ ENTRY(vector_swi) ...@@ -126,7 +136,7 @@ ENTRY(vector_swi)
get_thread_info tsk get_thread_info tsk
ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
bic scno, scno, #0xff000000 @ mask off SWI op-code bic scno, scno, #0xff000000 @ mask off SWI op-code
eor scno, scno, #OS_NUMBER << 20 @ check OS number eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
adr tbl, sys_call_table @ load syscall table pointer adr tbl, sys_call_table @ load syscall table pointer
tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
bne __sys_trace bne __sys_trace
...@@ -137,8 +147,8 @@ ENTRY(vector_swi) ...@@ -137,8 +147,8 @@ ENTRY(vector_swi)
add r1, sp, #S_OFF add r1, sp, #S_OFF
2: mov why, #0 @ no longer a real syscall 2: mov why, #0 @ no longer a real syscall
cmp scno, #ARMSWI_OFFSET cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
eor r0, scno, #OS_NUMBER << 20 @ put OS number back eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
bcs arm_syscall bcs arm_syscall
b sys_ni_syscall @ not private func b sys_ni_syscall @ not private func
...@@ -183,7 +193,7 @@ ENTRY(sys_call_table) ...@@ -183,7 +193,7 @@ ENTRY(sys_call_table)
@ r5 = syscall table @ r5 = syscall table
.type sys_syscall, #function .type sys_syscall, #function
sys_syscall: sys_syscall:
eor scno, r0, #OS_NUMBER << 20 eor scno, r0, #__NR_SYSCALL_BASE
cmp scno, #__NR_syscall - __NR_SYSCALL_BASE cmp scno, #__NR_syscall - __NR_SYSCALL_BASE
cmpne scno, #NR_syscalls @ check range cmpne scno, #NR_syscalls @ check range
stmloia sp, {r5, r6} @ shuffle args stmloia sp, {r5, r6} @ shuffle args
......
...@@ -31,13 +31,6 @@ ...@@ -31,13 +31,6 @@
#define PT_TRACESYS 0x00000002 #define PT_TRACESYS 0x00000002
@ OS version number used in SWIs
@ RISC OS is 0
@ RISC iX is 8
@
#define OS_NUMBER 9
#define ARMSWI_OFFSET 0x000f0000
@ @
@ Most of the stack format comes from struct pt_regs, but with @ Most of the stack format comes from struct pt_regs, but with
@ the addition of 8 bytes for storing syscall args 5 and 6. @ the addition of 8 bytes for storing syscall args 5 and 6.
...@@ -150,18 +143,3 @@ scno .req r7 @ syscall number ...@@ -150,18 +143,3 @@ scno .req r7 @ syscall number
tbl .req r8 @ syscall table pointer tbl .req r8 @ syscall table pointer
why .req r8 @ Linux syscall (!= 0) why .req r8 @ Linux syscall (!= 0)
tsk .req r9 @ current thread_info tsk .req r9 @ current thread_info
/*
* Get the system call number.
*/
.macro get_scno
#ifdef CONFIG_ARM_THUMB
tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
addne scno, r7, #OS_NUMBER << 20 @ put OS number in
ldreq scno, [lr, #-4]
#else
mask_pc lr, lr
ldr scno, [lr, #-4] @ get SWI instruction
#endif
.endm
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment