2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/kernel/entry-common.S
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000 Russell King
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm/unistd.h>
|
2008-06-21 20:17:27 +02:00
|
|
|
#include <asm/ftrace.h>
|
2008-08-05 17:14:15 +02:00
|
|
|
#include <mach/entry-macro.S>
|
2009-02-16 11:42:09 +01:00
|
|
|
#include <asm/unwind.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#include "entry-header.S"
|
|
|
|
|
|
|
|
|
|
|
|
.align 5
|
|
|
|
/*
|
|
|
|
* This is the fast syscall return path. We do as little as
|
|
|
|
* possible here, and this includes saving r0 back into the SVC
|
|
|
|
* stack.
|
|
|
|
*/
|
|
|
|
ret_fast_syscall:
|
2009-02-16 11:42:09 +01:00
|
|
|
UNWIND(.fnstart )
|
|
|
|
UNWIND(.cantunwind )
|
2005-04-26 16:18:26 +02:00
|
|
|
disable_irq @ disable interrupts
|
2005-04-17 00:20:36 +02:00
|
|
|
ldr r1, [tsk, #TI_FLAGS]
|
|
|
|
tst r1, #_TIF_WORK_MASK
|
|
|
|
bne fast_work_pending
|
2005-04-26 16:20:34 +02:00
|
|
|
|
2007-02-16 22:16:32 +01:00
|
|
|
/* perform architecture specific actions before user return */
|
|
|
|
arch_ret_to_user r1, lr
|
|
|
|
|
2009-07-24 13:32:54 +02:00
|
|
|
restore_user_regs fast = 1, offset = S_OFF
|
2009-02-16 11:42:09 +01:00
|
|
|
UNWIND(.fnend )
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ok, we need to do extra processing, enter the slow path.
|
|
|
|
*/
|
|
|
|
fast_work_pending:
|
|
|
|
str r0, [sp, #S_R0+S_OFF]! @ returned r0
|
|
|
|
work_pending:
|
|
|
|
tst r1, #_TIF_NEED_RESCHED
|
|
|
|
bne work_resched
|
2009-09-02 10:14:16 +02:00
|
|
|
tst r1, #_TIF_SIGPENDING|_TIF_NOTIFY_RESUME
|
2005-04-17 00:20:36 +02:00
|
|
|
beq no_work_pending
|
|
|
|
mov r0, sp @ 'regs'
|
|
|
|
mov r2, why @ 'syscall'
|
|
|
|
bl do_notify_resume
|
2005-11-19 11:01:07 +01:00
|
|
|
b ret_slow_syscall @ Check work again
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
work_resched:
|
|
|
|
bl schedule
|
|
|
|
/*
|
|
|
|
* "slow" syscall return path. "why" tells us if this was a real syscall.
|
|
|
|
*/
|
|
|
|
ENTRY(ret_to_user)
|
|
|
|
ret_slow_syscall:
|
2005-04-26 16:18:26 +02:00
|
|
|
disable_irq @ disable interrupts
|
2005-04-17 00:20:36 +02:00
|
|
|
ldr r1, [tsk, #TI_FLAGS]
|
|
|
|
tst r1, #_TIF_WORK_MASK
|
|
|
|
bne work_pending
|
|
|
|
no_work_pending:
|
2007-02-16 22:16:32 +01:00
|
|
|
/* perform architecture specific actions before user return */
|
|
|
|
arch_ret_to_user r1, lr
|
|
|
|
|
2009-07-24 13:32:54 +02:00
|
|
|
restore_user_regs fast = 0, offset = 0
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(ret_to_user)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is how we return from a fork.
|
|
|
|
*/
|
|
|
|
ENTRY(ret_from_fork)
|
|
|
|
bl schedule_tail
|
|
|
|
get_thread_info tsk
|
|
|
|
ldr r1, [tsk, #TI_FLAGS] @ check for syscall tracing
|
|
|
|
mov why, #1
|
|
|
|
tst r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
|
|
|
|
beq ret_slow_syscall
|
|
|
|
mov r1, sp
|
|
|
|
mov r0, #1 @ trace exit [IP = 1]
|
|
|
|
bl syscall_trace
|
|
|
|
b ret_slow_syscall
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(ret_from_fork)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2006-01-19 13:57:01 +01:00
|
|
|
.equ NR_syscalls,0
|
|
|
|
#define CALL(x) .equ NR_syscalls,NR_syscalls+1
|
2005-04-17 00:20:36 +02:00
|
|
|
#include "calls.S"
|
2006-01-19 13:57:01 +01:00
|
|
|
#undef CALL
|
|
|
|
#define CALL(x) .long x
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-10-07 01:06:12 +02:00
|
|
|
#ifdef CONFIG_FUNCTION_TRACER
|
2008-05-31 10:53:50 +02:00
|
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
|
|
|
ENTRY(mcount)
|
|
|
|
stmdb sp!, {r0-r3, lr}
|
|
|
|
mov r0, lr
|
2008-06-21 20:17:27 +02:00
|
|
|
sub r0, r0, #MCOUNT_INSN_SIZE
|
2008-05-31 10:53:50 +02:00
|
|
|
|
|
|
|
.globl mcount_call
|
|
|
|
mcount_call:
|
|
|
|
bl ftrace_stub
|
[ARM] 5418/1: restore lr before leaving mcount
gcc seems to expect that lr isn't clobbered by mcount, because for a
function starting with:
static int func(void)
{
void *ra = __builtin_return_address(0);
printk(KERN_EMERG "__builtin_return_address(0) = %pS\n", ra)
...
the following assembler is generated by gcc 4.3.2:
0: e1a0c00d mov ip, sp
4: e92dd810 push {r4, fp, ip, lr, pc}
8: e24cb004 sub fp, ip, #4 ; 0x4
c: ebfffffe bl 0 <mcount>
10: e59f0034 ldr r0, [pc, #52]
14: e1a0100e mov r1, lr
18: ebfffffe bl 0 <printk>
Without this patch obviously __builtin_return_address(0) yields
func+0x10 instead of the return address of the caller.
Note this patch fixes a similar issue for the routines used with dynamic
ftrace even though this isn't currently selectable for ARM.
Cc: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-03-04 11:48:46 +01:00
|
|
|
ldr lr, [fp, #-4] @ restore lr
|
2008-05-31 10:53:50 +02:00
|
|
|
ldmia sp!, {r0-r3, pc}
|
|
|
|
|
|
|
|
ENTRY(ftrace_caller)
|
|
|
|
stmdb sp!, {r0-r3, lr}
|
|
|
|
ldr r1, [fp, #-4]
|
|
|
|
mov r0, lr
|
2008-06-21 20:17:27 +02:00
|
|
|
sub r0, r0, #MCOUNT_INSN_SIZE
|
2008-05-31 10:53:50 +02:00
|
|
|
|
|
|
|
.globl ftrace_call
|
|
|
|
ftrace_call:
|
|
|
|
bl ftrace_stub
|
[ARM] 5418/1: restore lr before leaving mcount
gcc seems to expect that lr isn't clobbered by mcount, because for a
function starting with:
static int func(void)
{
void *ra = __builtin_return_address(0);
printk(KERN_EMERG "__builtin_return_address(0) = %pS\n", ra)
...
the following assembler is generated by gcc 4.3.2:
0: e1a0c00d mov ip, sp
4: e92dd810 push {r4, fp, ip, lr, pc}
8: e24cb004 sub fp, ip, #4 ; 0x4
c: ebfffffe bl 0 <mcount>
10: e59f0034 ldr r0, [pc, #52]
14: e1a0100e mov r1, lr
18: ebfffffe bl 0 <printk>
Without this patch obviously __builtin_return_address(0) yields
func+0x10 instead of the return address of the caller.
Note this patch fixes a similar issue for the routines used with dynamic
ftrace even though this isn't currently selectable for ARM.
Cc: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-03-04 11:48:46 +01:00
|
|
|
ldr lr, [fp, #-4] @ restore lr
|
2008-05-31 10:53:50 +02:00
|
|
|
ldmia sp!, {r0-r3, pc}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2009-08-13 20:38:16 +02:00
|
|
|
ENTRY(__gnu_mcount_nc)
|
|
|
|
stmdb sp!, {r0-r3, lr}
|
|
|
|
ldr r0, =ftrace_trace_function
|
|
|
|
ldr r2, [r0]
|
|
|
|
adr r0, ftrace_stub
|
|
|
|
cmp r0, r2
|
|
|
|
bne gnu_trace
|
|
|
|
ldmia sp!, {r0-r3, ip, lr}
|
2009-09-29 07:12:37 +02:00
|
|
|
mov pc, ip
|
2009-08-13 20:38:16 +02:00
|
|
|
|
|
|
|
gnu_trace:
|
|
|
|
ldr r1, [sp, #20] @ lr of instrumented routine
|
|
|
|
mov r0, lr
|
|
|
|
sub r0, r0, #MCOUNT_INSN_SIZE
|
|
|
|
mov lr, pc
|
|
|
|
mov pc, r2
|
|
|
|
ldmia sp!, {r0-r3, ip, lr}
|
2009-09-29 07:12:37 +02:00
|
|
|
mov pc, ip
|
2009-08-13 20:38:16 +02:00
|
|
|
|
2008-05-31 10:53:50 +02:00
|
|
|
ENTRY(mcount)
|
|
|
|
stmdb sp!, {r0-r3, lr}
|
|
|
|
ldr r0, =ftrace_trace_function
|
|
|
|
ldr r2, [r0]
|
|
|
|
adr r0, ftrace_stub
|
|
|
|
cmp r0, r2
|
|
|
|
bne trace
|
[ARM] 5418/1: restore lr before leaving mcount
gcc seems to expect that lr isn't clobbered by mcount, because for a
function starting with:
static int func(void)
{
void *ra = __builtin_return_address(0);
printk(KERN_EMERG "__builtin_return_address(0) = %pS\n", ra)
...
the following assembler is generated by gcc 4.3.2:
0: e1a0c00d mov ip, sp
4: e92dd810 push {r4, fp, ip, lr, pc}
8: e24cb004 sub fp, ip, #4 ; 0x4
c: ebfffffe bl 0 <mcount>
10: e59f0034 ldr r0, [pc, #52]
14: e1a0100e mov r1, lr
18: ebfffffe bl 0 <printk>
Without this patch obviously __builtin_return_address(0) yields
func+0x10 instead of the return address of the caller.
Note this patch fixes a similar issue for the routines used with dynamic
ftrace even though this isn't currently selectable for ARM.
Cc: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-03-04 11:48:46 +01:00
|
|
|
ldr lr, [fp, #-4] @ restore lr
|
2008-05-31 10:53:50 +02:00
|
|
|
ldmia sp!, {r0-r3, pc}
|
|
|
|
|
|
|
|
trace:
|
2009-01-31 01:21:56 +01:00
|
|
|
ldr r1, [fp, #-4] @ lr of instrumented routine
|
2008-05-31 10:53:50 +02:00
|
|
|
mov r0, lr
|
2008-06-21 20:17:27 +02:00
|
|
|
sub r0, r0, #MCOUNT_INSN_SIZE
|
2008-05-31 10:53:50 +02:00
|
|
|
mov lr, pc
|
|
|
|
mov pc, r2
|
2009-07-29 20:31:30 +02:00
|
|
|
ldr lr, [fp, #-4] @ restore lr
|
2008-05-31 10:53:50 +02:00
|
|
|
ldmia sp!, {r0-r3, pc}
|
|
|
|
|
|
|
|
#endif /* CONFIG_DYNAMIC_FTRACE */
|
|
|
|
|
|
|
|
.globl ftrace_stub
|
|
|
|
ftrace_stub:
|
|
|
|
mov pc, lr
|
|
|
|
|
2008-10-07 01:06:12 +02:00
|
|
|
#endif /* CONFIG_FUNCTION_TRACER */
|
2008-05-31 10:53:50 +02:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/*=============================================================================
|
|
|
|
* SWI handler
|
|
|
|
*-----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* If we're optimising for StrongARM the resulting code won't
|
|
|
|
run on an ARM7 and we can save a couple of instructions.
|
|
|
|
--pb */
|
|
|
|
#ifdef CONFIG_CPU_ARM710
|
2006-01-14 17:31:29 +01:00
|
|
|
#define A710(code...) code
|
|
|
|
.Larm710bug:
|
2005-04-17 00:20:36 +02:00
|
|
|
ldmia sp, {r0 - lr}^ @ Get calling r0 - lr
|
|
|
|
mov r0, r0
|
|
|
|
add sp, sp, #S_FRAME_SIZE
|
2005-10-12 20:51:24 +02:00
|
|
|
subs pc, lr, #4
|
2005-04-17 00:20:36 +02:00
|
|
|
#else
|
2006-01-14 17:31:29 +01:00
|
|
|
#define A710(code...)
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
.align 5
|
|
|
|
ENTRY(vector_swi)
|
2005-04-26 16:20:34 +02:00
|
|
|
sub sp, sp, #S_FRAME_SIZE
|
|
|
|
stmia sp, {r0 - r12} @ Calling r0 - r12
|
2009-07-24 13:32:54 +02:00
|
|
|
ARM( add r8, sp, #S_PC )
|
|
|
|
ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr
|
|
|
|
THUMB( mov r8, sp )
|
|
|
|
THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr
|
2005-04-26 16:20:34 +02:00
|
|
|
mrs r8, spsr @ called from non-FIQ mode, so ok.
|
|
|
|
str lr, [sp, #S_PC] @ Save calling PC
|
|
|
|
str r8, [sp, #S_PSR] @ Save CPSR
|
|
|
|
str r0, [sp, #S_OLD_R0] @ Save OLD_R0
|
2005-04-17 00:20:36 +02:00
|
|
|
zero_fp
|
2005-04-26 16:19:24 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the system call number.
|
|
|
|
*/
|
2006-01-14 17:31:29 +01:00
|
|
|
|
2006-01-14 17:36:12 +01:00
|
|
|
#if defined(CONFIG_OABI_COMPAT)
|
2006-01-14 17:31:29 +01:00
|
|
|
|
2006-01-14 17:36:12 +01:00
|
|
|
/*
|
|
|
|
* If we have CONFIG_OABI_COMPAT then we need to look at the swi
|
|
|
|
* value to determine if it is an EABI or an old ABI call.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_ARM_THUMB
|
|
|
|
tst r8, #PSR_T_BIT
|
|
|
|
movne r10, #0 @ no thumb OABI emulation
|
|
|
|
ldreq r10, [lr, #-4] @ get SWI instruction
|
|
|
|
#else
|
|
|
|
ldr r10, [lr, #-4] @ get SWI instruction
|
|
|
|
A710( and ip, r10, #0x0f000000 @ check for SWI )
|
|
|
|
A710( teq ip, #0x0f000000 )
|
|
|
|
A710( bne .Larm710bug )
|
|
|
|
#endif
|
2009-05-30 15:00:18 +02:00
|
|
|
#ifdef CONFIG_CPU_ENDIAN_BE8
|
|
|
|
rev r10, r10 @ little endian instruction
|
|
|
|
#endif
|
2006-01-14 17:36:12 +01:00
|
|
|
|
|
|
|
#elif defined(CONFIG_AEABI)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pure EABI user space always put syscall number into scno (r7).
|
|
|
|
*/
|
2006-01-14 17:31:29 +01:00
|
|
|
A710( ldr ip, [lr, #-4] @ get SWI instruction )
|
|
|
|
A710( and ip, ip, #0x0f000000 @ check for SWI )
|
|
|
|
A710( teq ip, #0x0f000000 )
|
|
|
|
A710( bne .Larm710bug )
|
2006-01-14 17:36:12 +01:00
|
|
|
|
2006-01-14 17:31:29 +01:00
|
|
|
#elif defined(CONFIG_ARM_THUMB)
|
2006-01-14 17:36:12 +01:00
|
|
|
|
|
|
|
/* Legacy ABI only, possibly thumb mode. */
|
2005-04-26 16:19:24 +02:00
|
|
|
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]
|
2006-01-14 17:36:12 +01:00
|
|
|
|
2005-04-26 16:19:24 +02:00
|
|
|
#else
|
2006-01-14 17:36:12 +01:00
|
|
|
|
|
|
|
/* Legacy ABI only. */
|
2005-04-26 16:19:24 +02:00
|
|
|
ldr scno, [lr, #-4] @ get SWI instruction
|
2006-01-14 17:31:29 +01:00
|
|
|
A710( and ip, scno, #0x0f000000 @ check for SWI )
|
|
|
|
A710( teq ip, #0x0f000000 )
|
|
|
|
A710( bne .Larm710bug )
|
2006-01-14 17:36:12 +01:00
|
|
|
|
2005-04-26 16:19:24 +02:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_ALIGNMENT_TRAP
|
|
|
|
ldr ip, __cr_alignment
|
|
|
|
ldr ip, [ip]
|
|
|
|
mcr p15, 0, ip, c1, c0 @ update control register
|
|
|
|
#endif
|
2005-04-26 16:18:26 +02:00
|
|
|
enable_irq
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
get_thread_info tsk
|
2006-01-14 17:36:12 +01:00
|
|
|
adr tbl, sys_call_table @ load syscall table pointer
|
2005-04-17 00:20:36 +02:00
|
|
|
ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
|
2006-01-14 17:36:12 +01:00
|
|
|
|
|
|
|
#if defined(CONFIG_OABI_COMPAT)
|
|
|
|
/*
|
|
|
|
* If the swi argument is zero, this is an EABI call and we do nothing.
|
|
|
|
*
|
|
|
|
* If this is an old ABI call, get the syscall number into scno and
|
|
|
|
* get the old ABI syscall table address.
|
|
|
|
*/
|
|
|
|
bics r10, r10, #0xff000000
|
|
|
|
eorne scno, r10, #__NR_OABI_SYSCALL_BASE
|
|
|
|
ldrne tbl, =sys_oabi_call_table
|
|
|
|
#elif !defined(CONFIG_AEABI)
|
2005-04-17 00:20:36 +02:00
|
|
|
bic scno, scno, #0xff000000 @ mask off SWI op-code
|
2005-04-26 16:19:24 +02:00
|
|
|
eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
|
2006-01-14 17:31:29 +01:00
|
|
|
#endif
|
2006-01-14 17:36:12 +01:00
|
|
|
|
2006-01-14 17:31:29 +01:00
|
|
|
stmdb sp!, {r4, r5} @ push fifth and sixth args
|
2005-04-17 00:20:36 +02:00
|
|
|
tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
|
|
|
|
bne __sys_trace
|
|
|
|
|
|
|
|
cmp scno, #NR_syscalls @ check upper syscall limit
|
2009-07-24 13:32:54 +02:00
|
|
|
adr lr, BSYM(ret_fast_syscall) @ return address
|
2005-04-17 00:20:36 +02:00
|
|
|
ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
|
|
|
|
|
|
|
|
add r1, sp, #S_OFF
|
|
|
|
2: mov why, #0 @ no longer a real syscall
|
2005-04-26 16:19:24 +02:00
|
|
|
cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
|
|
|
|
eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
|
2005-04-17 00:20:36 +02:00
|
|
|
bcs arm_syscall
|
|
|
|
b sys_ni_syscall @ not private func
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(vector_swi)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the really slow path. We're going to be doing
|
|
|
|
* context switches, and waiting for our parent to respond.
|
|
|
|
*/
|
|
|
|
__sys_trace:
|
2006-01-14 20:30:04 +01:00
|
|
|
mov r2, scno
|
2005-04-17 00:20:36 +02:00
|
|
|
add r1, sp, #S_OFF
|
|
|
|
mov r0, #0 @ trace entry [IP = 0]
|
|
|
|
bl syscall_trace
|
|
|
|
|
2009-07-24 13:32:54 +02:00
|
|
|
adr lr, BSYM(__sys_trace_return) @ return address
|
2006-01-14 20:30:04 +01:00
|
|
|
mov scno, r0 @ syscall number (possibly new)
|
2005-04-17 00:20:36 +02:00
|
|
|
add r1, sp, #S_R0 + S_OFF @ pointer to regs
|
|
|
|
cmp scno, #NR_syscalls @ check upper syscall limit
|
|
|
|
ldmccia r1, {r0 - r3} @ have to reload r0 - r3
|
|
|
|
ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
|
|
|
|
b 2b
|
|
|
|
|
|
|
|
__sys_trace_return:
|
|
|
|
str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
|
2006-01-14 20:30:04 +01:00
|
|
|
mov r2, scno
|
2005-04-17 00:20:36 +02:00
|
|
|
mov r1, sp
|
|
|
|
mov r0, #1 @ trace exit [IP = 1]
|
|
|
|
bl syscall_trace
|
|
|
|
b ret_slow_syscall
|
|
|
|
|
|
|
|
.align 5
|
|
|
|
#ifdef CONFIG_ALIGNMENT_TRAP
|
|
|
|
.type __cr_alignment, #object
|
|
|
|
__cr_alignment:
|
|
|
|
.word cr_alignment
|
2006-01-14 17:36:12 +01:00
|
|
|
#endif
|
|
|
|
.ltorg
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the syscall table declaration for native ABI syscalls.
|
|
|
|
* With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
|
|
|
|
*/
|
|
|
|
#define ABI(native, compat) native
|
|
|
|
#ifdef CONFIG_AEABI
|
|
|
|
#define OBSOLETE(syscall) sys_ni_syscall
|
|
|
|
#else
|
|
|
|
#define OBSOLETE(syscall) syscall
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
.type sys_call_table, #object
|
|
|
|
ENTRY(sys_call_table)
|
|
|
|
#include "calls.S"
|
2006-01-14 17:36:12 +01:00
|
|
|
#undef ABI
|
|
|
|
#undef OBSOLETE
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*============================================================================
|
|
|
|
* Special system call wrappers
|
|
|
|
*/
|
|
|
|
@ r0 = syscall number
|
2005-12-17 16:25:42 +01:00
|
|
|
@ r8 = syscall table
|
2005-04-17 00:20:36 +02:00
|
|
|
sys_syscall:
|
2006-05-16 15:25:55 +02:00
|
|
|
bic scno, r0, #__NR_OABI_SYSCALL_BASE
|
2005-04-17 00:20:36 +02:00
|
|
|
cmp scno, #__NR_syscall - __NR_SYSCALL_BASE
|
|
|
|
cmpne scno, #NR_syscalls @ check range
|
|
|
|
stmloia sp, {r5, r6} @ shuffle args
|
|
|
|
movlo r0, r1
|
|
|
|
movlo r1, r2
|
|
|
|
movlo r2, r3
|
|
|
|
movlo r3, r4
|
|
|
|
ldrlo pc, [tbl, scno, lsl #2]
|
|
|
|
b sys_ni_syscall
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_syscall)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_fork_wrapper:
|
|
|
|
add r0, sp, #S_OFF
|
|
|
|
b sys_fork
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_fork_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_vfork_wrapper:
|
|
|
|
add r0, sp, #S_OFF
|
|
|
|
b sys_vfork
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_vfork_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_execve_wrapper:
|
|
|
|
add r3, sp, #S_OFF
|
|
|
|
b sys_execve
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_execve_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_clone_wrapper:
|
|
|
|
add ip, sp, #S_OFF
|
|
|
|
str ip, [sp, #4]
|
|
|
|
b sys_clone
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_clone_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_sigreturn_wrapper:
|
|
|
|
add r0, sp, #S_OFF
|
|
|
|
b sys_sigreturn
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_sigreturn_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_rt_sigreturn_wrapper:
|
|
|
|
add r0, sp, #S_OFF
|
|
|
|
b sys_rt_sigreturn
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_rt_sigreturn_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
sys_sigaltstack_wrapper:
|
|
|
|
ldr r2, [sp, #S_OFF + S_SP]
|
|
|
|
b do_sigaltstack
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_sigaltstack_wrapper)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2006-01-14 17:35:03 +01:00
|
|
|
sys_statfs64_wrapper:
|
|
|
|
teq r1, #88
|
|
|
|
moveq r1, #84
|
|
|
|
b sys_statfs64
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_statfs64_wrapper)
|
2006-01-14 17:35:03 +01:00
|
|
|
|
|
|
|
sys_fstatfs64_wrapper:
|
|
|
|
teq r1, #88
|
|
|
|
moveq r1, #84
|
|
|
|
b sys_fstatfs64
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_fstatfs64_wrapper)
|
2006-01-14 17:35:03 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* Note: off_4k (r5) is always units of 4K. If we can't do the requested
|
|
|
|
* offset, we return EINVAL.
|
|
|
|
*/
|
|
|
|
sys_mmap2:
|
|
|
|
#if PAGE_SHIFT > 12
|
|
|
|
tst r5, #PGOFF_MASK
|
|
|
|
moveq r5, r5, lsr #PAGE_SHIFT - 12
|
|
|
|
streq r5, [sp, #4]
|
2009-11-30 23:37:04 +01:00
|
|
|
beq sys_mmap_pgoff
|
2005-04-17 00:20:36 +02:00
|
|
|
mov r0, #-EINVAL
|
2006-06-25 12:17:23 +02:00
|
|
|
mov pc, lr
|
2005-04-17 00:20:36 +02:00
|
|
|
#else
|
|
|
|
str r5, [sp, #4]
|
2009-11-30 23:37:04 +01:00
|
|
|
b sys_mmap_pgoff
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_mmap2)
|
2006-01-14 17:35:31 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_OABI_COMPAT
|
2006-01-14 17:36:12 +01:00
|
|
|
|
2006-01-14 17:35:31 +01:00
|
|
|
/*
|
|
|
|
* These are syscalls with argument register differences
|
|
|
|
*/
|
|
|
|
|
|
|
|
sys_oabi_pread64:
|
|
|
|
stmia sp, {r3, r4}
|
|
|
|
b sys_pread64
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_oabi_pread64)
|
2006-01-14 17:35:31 +01:00
|
|
|
|
|
|
|
sys_oabi_pwrite64:
|
|
|
|
stmia sp, {r3, r4}
|
|
|
|
b sys_pwrite64
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_oabi_pwrite64)
|
2006-01-14 17:35:31 +01:00
|
|
|
|
|
|
|
sys_oabi_truncate64:
|
|
|
|
mov r3, r2
|
|
|
|
mov r2, r1
|
|
|
|
b sys_truncate64
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_oabi_truncate64)
|
2006-01-14 17:35:31 +01:00
|
|
|
|
|
|
|
sys_oabi_ftruncate64:
|
|
|
|
mov r3, r2
|
|
|
|
mov r2, r1
|
|
|
|
b sys_ftruncate64
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_oabi_ftruncate64)
|
2006-01-14 17:35:31 +01:00
|
|
|
|
|
|
|
sys_oabi_readahead:
|
|
|
|
str r3, [sp]
|
|
|
|
mov r3, r2
|
|
|
|
mov r2, r1
|
|
|
|
b sys_readahead
|
2008-08-28 12:22:32 +02:00
|
|
|
ENDPROC(sys_oabi_readahead)
|
2006-01-14 17:35:31 +01:00
|
|
|
|
2006-01-14 17:36:12 +01:00
|
|
|
/*
|
|
|
|
* Let's declare a second syscall table for old ABI binaries
|
|
|
|
* using the compatibility syscall entries.
|
|
|
|
*/
|
|
|
|
#define ABI(native, compat) compat
|
|
|
|
#define OBSOLETE(syscall) syscall
|
|
|
|
|
|
|
|
.type sys_oabi_call_table, #object
|
|
|
|
ENTRY(sys_oabi_call_table)
|
|
|
|
#include "calls.S"
|
|
|
|
#undef ABI
|
|
|
|
#undef OBSOLETE
|
|
|
|
|
2006-01-14 17:35:31 +01:00
|
|
|
#endif
|
|
|
|
|