blob: 3c4f88701f224984bfb5fecaf304d96918b56548 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/kernel/entry-common.S
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
Russell King6ebbf2c2014-06-30 16:29:12 +010011#include <asm/assembler.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/unistd.h>
Abhishek Sagar395a59d2008-06-21 23:47:27 +053013#include <asm/ftrace.h>
Catalin Marinasc4c57162009-02-16 11:42:09 +010014#include <asm/unwind.h>
Thomas Garniere33f8d322017-09-07 08:30:46 -070015#include <asm/memory.h>
Russell King96a8fae2016-10-18 19:57:01 +010016#ifdef CONFIG_AEABI
17#include <asm/unistd-oabi.h>
18#endif
19
20 .equ NR_syscalls, __NR_syscalls
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Rob Herring13a50452012-02-07 09:28:22 -060022#ifdef CONFIG_NEED_RET_TO_USER
23#include <mach/entry-macro.S>
24#else
25 .macro arch_ret_to_user, tmp1, tmp2
26 .endm
27#endif
28
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include "entry-header.S"
30
Russell King309ee042017-03-24 16:15:45 +000031saved_psr .req r8
Russell Kingfcea4522017-03-24 16:22:10 +000032#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
33saved_pc .req r9
34#define TRACE(x...) x
35#else
Russell King309ee042017-03-24 16:15:45 +000036saved_pc .req lr
Russell Kingfcea4522017-03-24 16:22:10 +000037#define TRACE(x...)
38#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Russell Kingc6089062017-11-24 23:54:22 +000040 .section .entry.text,"ax",%progbits
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 .align 5
Russell King3302cad2015-08-20 16:13:37 +010042#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING))
Linus Torvalds1da177e2005-04-16 15:20:36 -070043/*
Russell King3302cad2015-08-20 16:13:37 +010044 * This is the fast syscall return path. We do as little as possible here,
45 * such as avoiding writing r0 to the stack. We only use this path if we
46 * have tracing and context tracking disabled - the overheads from those
47 * features make this path too inefficient.
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 */
49ret_fast_syscall:
Catalin Marinasc4c57162009-02-16 11:42:09 +010050 UNWIND(.fnstart )
51 UNWIND(.cantunwind )
Russell King3302cad2015-08-20 16:13:37 +010052 disable_irq_notrace @ disable interrupts
Thomas Garniere33f8d322017-09-07 08:30:46 -070053 ldr r2, [tsk, #TI_ADDR_LIMIT]
54 cmp r2, #TASK_SIZE
55 blne addr_limit_check_failed
Russell King1b979372015-05-15 11:02:23 +010056 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
Thomas Garnier24042692017-09-07 08:30:45 -070057 tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 bne fast_work_pending
Russell Kingf4dc9a42005-04-26 15:20:34 +010059
Thomas Garniere33f8d322017-09-07 08:30:46 -070060
Dan Williamsf80dff92007-02-16 22:16:32 +010061 /* perform architecture specific actions before user return */
62 arch_ret_to_user r1, lr
63
Catalin Marinasb86040a2009-07-24 12:32:54 +010064 restore_user_regs fast = 1, offset = S_OFF
Catalin Marinasc4c57162009-02-16 11:42:09 +010065 UNWIND(.fnend )
Russell King3302cad2015-08-20 16:13:37 +010066ENDPROC(ret_fast_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Russell King3302cad2015-08-20 16:13:37 +010068 /* Ok, we need to do extra processing, enter the slow path. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070069fast_work_pending:
70 str r0, [sp, #S_R0+S_OFF]! @ returned r0
Russell King3302cad2015-08-20 16:13:37 +010071 /* fall through to work_pending */
72#else
73/*
74 * The "replacement" ret_fast_syscall for when tracing or context tracking
75 * is enabled. As we will need to call out to some C functions, we save
76 * r0 first to avoid needing to save registers around each C function call.
77 */
78ret_fast_syscall:
79 UNWIND(.fnstart )
80 UNWIND(.cantunwind )
81 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
82 disable_irq_notrace @ disable interrupts
Thomas Garniere33f8d322017-09-07 08:30:46 -070083 ldr r2, [tsk, #TI_ADDR_LIMIT]
84 cmp r2, #TASK_SIZE
85 blne addr_limit_check_failed
Russell King3302cad2015-08-20 16:13:37 +010086 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
Thomas Garnier24042692017-09-07 08:30:45 -070087 tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
Russell King3302cad2015-08-20 16:13:37 +010088 beq no_work_pending
89 UNWIND(.fnend )
90ENDPROC(ret_fast_syscall)
91
92 /* Slower path - fall through to work_pending */
93#endif
94
95 tst r1, #_TIF_SYSCALL_WORK
96 bne __sys_trace_return_nosave
97slow_work_pending:
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 mov r0, sp @ 'regs'
99 mov r2, why @ 'syscall'
Al Viro0a267fa2012-07-19 17:47:55 +0100100 bl do_work_pending
Al Viro66285212012-07-19 17:48:50 +0100101 cmp r0, #0
Al Viro81783782012-07-19 17:48:21 +0100102 beq no_work_pending
Al Viro66285212012-07-19 17:48:50 +0100103 movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)
Al Viro81783782012-07-19 17:48:21 +0100104 ldmia sp, {r0 - r6} @ have to reload r0 - r6
105 b local_restart @ ... and off we go
Drew Richardsone83dd372015-08-06 18:50:27 +0100106ENDPROC(ret_fast_syscall)
Al Viro81783782012-07-19 17:48:21 +0100107
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108/*
109 * "slow" syscall return path. "why" tells us if this was a real syscall.
Russell King3302cad2015-08-20 16:13:37 +0100110 * IRQs may be enabled here, so always disable them. Note that we use the
111 * "notrace" version to avoid calling into the tracing code unnecessarily.
112 * do_work_pending() will update this state if necessary.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 */
114ENTRY(ret_to_user)
115ret_slow_syscall:
Russell King3302cad2015-08-20 16:13:37 +0100116 disable_irq_notrace @ disable interrupts
Ming Lei9fc25522011-06-05 02:24:58 +0100117ENTRY(ret_to_user_from_irq)
Thomas Garniere33f8d322017-09-07 08:30:46 -0700118 ldr r2, [tsk, #TI_ADDR_LIMIT]
119 cmp r2, #TASK_SIZE
120 blne addr_limit_check_failed
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 ldr r1, [tsk, #TI_FLAGS]
122 tst r1, #_TIF_WORK_MASK
Russell King3302cad2015-08-20 16:13:37 +0100123 bne slow_work_pending
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124no_work_pending:
Russell King3302cad2015-08-20 16:13:37 +0100125 asm_trace_hardirqs_on save = 0
Russell King651e9492013-03-28 11:44:25 +0000126
Dan Williamsf80dff92007-02-16 22:16:32 +0100127 /* perform architecture specific actions before user return */
128 arch_ret_to_user r1, lr
Kevin Hilmanb0088482013-03-28 22:54:40 +0100129 ct_user_enter save = 0
Dan Williamsf80dff92007-02-16 22:16:32 +0100130
Catalin Marinasb86040a2009-07-24 12:32:54 +0100131 restore_user_regs fast = 0, offset = 0
Ming Lei9fc25522011-06-05 02:24:58 +0100132ENDPROC(ret_to_user_from_irq)
Catalin Marinas93ed3972008-08-28 11:22:32 +0100133ENDPROC(ret_to_user)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134
135/*
136 * This is how we return from a fork.
137 */
138ENTRY(ret_from_fork)
139 bl schedule_tail
Al Viro9fff2fa2012-10-10 22:23:29 -0400140 cmp r5, #0
141 movne r0, r4
Russell King14327c62015-04-21 14:17:25 +0100142 badrne lr, 1f
Russell King6ebbf2c2014-06-30 16:29:12 +0100143 retne r5
Russell King68687c82012-10-15 00:16:49 +01001441: get_thread_info tsk
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 b ret_slow_syscall
Catalin Marinas93ed3972008-08-28 11:22:32 +0100146ENDPROC(ret_from_fork)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148/*=============================================================================
149 * SWI handler
150 *-----------------------------------------------------------------------------
151 */
152
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 .align 5
154ENTRY(vector_swi)
Uwe Kleine-König19c4d592010-05-21 18:06:42 +0100155#ifdef CONFIG_CPU_V7M
156 v7m_exception_entry
157#else
Russell King5745eef62016-05-10 16:34:27 +0100158 sub sp, sp, #PT_REGS_SIZE
Russell Kingf4dc9a42005-04-26 15:20:34 +0100159 stmia sp, {r0 - r12} @ Calling r0 - r12
Catalin Marinasb86040a2009-07-24 12:32:54 +0100160 ARM( add r8, sp, #S_PC )
161 ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr
162 THUMB( mov r8, sp )
163 THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr
Russell King309ee042017-03-24 16:15:45 +0000164 mrs saved_psr, spsr @ called from non-FIQ mode, so ok.
Russell Kingfcea4522017-03-24 16:22:10 +0000165 TRACE( mov saved_pc, lr )
Russell King309ee042017-03-24 16:15:45 +0000166 str saved_pc, [sp, #S_PC] @ Save calling PC
167 str saved_psr, [sp, #S_PSR] @ Save CPSR
Russell Kingf4dc9a42005-04-26 15:20:34 +0100168 str r0, [sp, #S_OLD_R0] @ Save OLD_R0
Uwe Kleine-König19c4d592010-05-21 18:06:42 +0100169#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 zero_fp
Russell King195b58a2014-08-28 13:08:14 +0100171 alignment_trap r10, ip, __cr_alignment
Russell Kingdca778c2017-03-24 16:23:25 +0000172 asm_trace_hardirqs_on save=0
173 enable_irq_notrace
174 ct_user_exit save=0
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100175
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100176 /*
177 * Get the system call number.
178 */
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000179
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000180#if defined(CONFIG_OABI_COMPAT)
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000181
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000182 /*
183 * If we have CONFIG_OABI_COMPAT then we need to look at the swi
184 * value to determine if it is an EABI or an old ABI call.
185 */
186#ifdef CONFIG_ARM_THUMB
Russell King309ee042017-03-24 16:15:45 +0000187 tst saved_psr, #PSR_T_BIT
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000188 movne r10, #0 @ no thumb OABI emulation
Russell King309ee042017-03-24 16:15:45 +0000189 USER( ldreq r10, [saved_pc, #-4] ) @ get SWI instruction
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000190#else
Russell King309ee042017-03-24 16:15:45 +0000191 USER( ldr r10, [saved_pc, #-4] ) @ get SWI instruction
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000192#endif
Ben Dooks457c2402013-02-12 18:59:57 +0000193 ARM_BE8(rev r10, r10) @ little endian instruction
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000194
195#elif defined(CONFIG_AEABI)
196
197 /*
198 * Pure EABI user space always put syscall number into scno (r7).
199 */
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000200#elif defined(CONFIG_ARM_THUMB)
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000201 /* Legacy ABI only, possibly thumb mode. */
Russell King309ee042017-03-24 16:15:45 +0000202 tst saved_psr, #PSR_T_BIT @ this is SPSR from save_user_regs
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100203 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
Russell King309ee042017-03-24 16:15:45 +0000204 USER( ldreq scno, [saved_pc, #-4] )
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000205
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100206#else
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000207 /* Legacy ABI only. */
Russell King309ee042017-03-24 16:15:45 +0000208 USER( ldr scno, [saved_pc, #-4] ) @ get SWI instruction
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100209#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210
Russell King309ee042017-03-24 16:15:45 +0000211 /* saved_psr and saved_pc are now dead */
212
Russell King2190fed2015-08-20 10:32:02 +0100213 uaccess_disable tbl
214
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000215 adr tbl, sys_call_table @ load syscall table pointer
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000216
217#if defined(CONFIG_OABI_COMPAT)
218 /*
219 * If the swi argument is zero, this is an EABI call and we do nothing.
220 *
221 * If this is an old ABI call, get the syscall number into scno and
222 * get the old ABI syscall table address.
223 */
224 bics r10, r10, #0xff000000
225 eorne scno, r10, #__NR_OABI_SYSCALL_BASE
226 ldrne tbl, =sys_oabi_call_table
227#elif !defined(CONFIG_AEABI)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 bic scno, scno, #0xff000000 @ mask off SWI op-code
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100229 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000230#endif
Russell Kingda594e32017-03-24 16:19:12 +0000231 get_thread_info tsk
Russell Kingdca778c2017-03-24 16:23:25 +0000232 /*
233 * Reload the registers that may have been corrupted on entry to
234 * the syscall assembly (by tracing or context tracking.)
235 */
236 TRACE( ldmia sp, {r0 - r3} )
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000237
Al Viro81783782012-07-19 17:48:21 +0100238local_restart:
Nicolas Pitre70c70d92010-08-26 15:08:35 -0700239 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000240 stmdb sp!, {r4, r5} @ push fifth and sixth args
Nicolas Pitre70c70d92010-08-26 15:08:35 -0700241
Nathaniel Husted29ef73b2012-01-03 14:23:09 -0500242 tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls?
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 bne __sys_trace
244
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 cmp scno, #NR_syscalls @ check upper syscall limit
Russell King14327c62015-04-21 14:17:25 +0100246 badr lr, ret_fast_syscall @ return address
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
248
249 add r1, sp, #S_OFF
Will Deacond95bc252013-09-19 10:32:20 +01002502: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100251 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
Will Deacon377747c2013-05-13 19:16:34 +0100252 bcs arm_syscall
Will Deacond95bc252013-09-19 10:32:20 +0100253 mov why, #0 @ no longer a real syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 b sys_ni_syscall @ not private func
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100255
256#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
257 /*
258 * We failed to handle a fault trying to access the page
259 * containing the swi instruction, but we're not really in a
260 * position to return -EFAULT. Instead, return back to the
261 * instruction and re-enter the user fault handling path trying
262 * to page it in. This will likely result in sending SEGV to the
263 * current task.
264 */
2659001:
Russell King309ee042017-03-24 16:15:45 +0000266 sub lr, saved_pc, #4
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100267 str lr, [sp, #S_PC]
Russell Kingda594e32017-03-24 16:19:12 +0000268 get_thread_info tsk
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100269 b ret_fast_syscall
270#endif
Catalin Marinas93ed3972008-08-28 11:22:32 +0100271ENDPROC(vector_swi)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272
273 /*
274 * This is the really slow path. We're going to be doing
275 * context switches, and waiting for our parent to respond.
276 */
277__sys_trace:
Will Deaconad722542012-07-06 15:50:14 +0100278 mov r1, scno
279 add r0, sp, #S_OFF
280 bl syscall_trace_enter
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281
Russell King14327c62015-04-21 14:17:25 +0100282 badr lr, __sys_trace_return @ return address
Nicolas Pitre3f471122006-01-14 19:30:04 +0000283 mov scno, r0 @ syscall number (possibly new)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 add r1, sp, #S_R0 + S_OFF @ pointer to regs
285 cmp scno, #NR_syscalls @ check upper syscall limit
Will Deaconc7aa00d2012-07-19 17:49:22 +0100286 ldmccia r1, {r0 - r6} @ have to reload r0 - r6
287 stmccia sp, {r4, r5} @ and update the stack args
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
Kees Cookad75b512012-11-15 22:12:17 +0100289 cmp scno, #-1 @ skip the syscall?
290 bne 2b
291 add sp, sp, #S_OFF @ restore stack
292 b ret_slow_syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293
294__sys_trace_return:
295 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
Will Deaconad722542012-07-06 15:50:14 +0100296 mov r0, sp
297 bl syscall_trace_exit
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 b ret_slow_syscall
299
Russell King3302cad2015-08-20 16:13:37 +0100300__sys_trace_return_nosave:
Russell Kinge0aa3a62015-08-20 17:39:32 +0100301 enable_irq_notrace
Russell King3302cad2015-08-20 16:13:37 +0100302 mov r0, sp
303 bl syscall_trace_exit
304 b ret_slow_syscall
305
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 .align 5
307#ifdef CONFIG_ALIGNMENT_TRAP
308 .type __cr_alignment, #object
309__cr_alignment:
310 .word cr_alignment
311#endif
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000312 .ltorg
313
Russell King96a8fae2016-10-18 19:57:01 +0100314 .macro syscall_table_start, sym
315 .equ __sys_nr, 0
316 .type \sym, #object
317ENTRY(\sym)
318 .endm
319
320 .macro syscall, nr, func
321 .ifgt __sys_nr - \nr
322 .error "Duplicated/unorded system call entry"
323 .endif
324 .rept \nr - __sys_nr
325 .long sys_ni_syscall
326 .endr
327 .long \func
328 .equ __sys_nr, \nr + 1
329 .endm
330
331 .macro syscall_table_end, sym
332 .ifgt __sys_nr - __NR_syscalls
333 .error "System call table too big"
334 .endif
335 .rept __NR_syscalls - __sys_nr
336 .long sys_ni_syscall
337 .endr
338 .size \sym, . - \sym
339 .endm
340
341#define NATIVE(nr, func) syscall nr, func
342
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000343/*
344 * This is the syscall table declaration for native ABI syscalls.
345 * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
346 */
Russell King96a8fae2016-10-18 19:57:01 +0100347 syscall_table_start sys_call_table
348#define COMPAT(nr, native, compat) syscall nr, native
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000349#ifdef CONFIG_AEABI
Russell King96a8fae2016-10-18 19:57:01 +0100350#include <calls-eabi.S>
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000351#else
Russell King96a8fae2016-10-18 19:57:01 +0100352#include <calls-oabi.S>
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000353#endif
Russell King96a8fae2016-10-18 19:57:01 +0100354#undef COMPAT
355 syscall_table_end sys_call_table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356
357/*============================================================================
358 * Special system call wrappers
359 */
360@ r0 = syscall number
Russell King567bd982005-12-17 15:25:42 +0000361@ r8 = syscall table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362sys_syscall:
Paul Brook52475932006-05-16 14:25:55 +0100363 bic scno, r0, #__NR_OABI_SYSCALL_BASE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 cmp scno, #__NR_syscall - __NR_SYSCALL_BASE
365 cmpne scno, #NR_syscalls @ check range
366 stmloia sp, {r5, r6} @ shuffle args
367 movlo r0, r1
368 movlo r1, r2
369 movlo r2, r3
370 movlo r3, r4
371 ldrlo pc, [tbl, scno, lsl #2]
372 b sys_ni_syscall
Catalin Marinas93ed3972008-08-28 11:22:32 +0100373ENDPROC(sys_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375sys_sigreturn_wrapper:
376 add r0, sp, #S_OFF
Al Viro653d48b2010-09-17 14:34:39 +0100377 mov why, #0 @ prevent syscall restart handling
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 b sys_sigreturn
Catalin Marinas93ed3972008-08-28 11:22:32 +0100379ENDPROC(sys_sigreturn_wrapper)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380
381sys_rt_sigreturn_wrapper:
382 add r0, sp, #S_OFF
Al Viro653d48b2010-09-17 14:34:39 +0100383 mov why, #0 @ prevent syscall restart handling
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 b sys_rt_sigreturn
Catalin Marinas93ed3972008-08-28 11:22:32 +0100385ENDPROC(sys_rt_sigreturn_wrapper)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386
Nicolas Pitre713c4812006-01-14 16:35:03 +0000387sys_statfs64_wrapper:
388 teq r1, #88
389 moveq r1, #84
390 b sys_statfs64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100391ENDPROC(sys_statfs64_wrapper)
Nicolas Pitre713c4812006-01-14 16:35:03 +0000392
393sys_fstatfs64_wrapper:
394 teq r1, #88
395 moveq r1, #84
396 b sys_fstatfs64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100397ENDPROC(sys_fstatfs64_wrapper)
Nicolas Pitre713c4812006-01-14 16:35:03 +0000398
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399/*
400 * Note: off_4k (r5) is always units of 4K. If we can't do the requested
401 * offset, we return EINVAL.
402 */
403sys_mmap2:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 str r5, [sp, #4]
Al Virof8b72562009-11-30 17:37:04 -0500405 b sys_mmap_pgoff
Catalin Marinas93ed3972008-08-28 11:22:32 +0100406ENDPROC(sys_mmap2)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000407
408#ifdef CONFIG_OABI_COMPAT
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000409
Nicolas Pitre687ad012006-01-14 16:35:31 +0000410/*
411 * These are syscalls with argument register differences
412 */
413
414sys_oabi_pread64:
415 stmia sp, {r3, r4}
416 b sys_pread64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100417ENDPROC(sys_oabi_pread64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000418
419sys_oabi_pwrite64:
420 stmia sp, {r3, r4}
421 b sys_pwrite64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100422ENDPROC(sys_oabi_pwrite64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000423
424sys_oabi_truncate64:
425 mov r3, r2
426 mov r2, r1
427 b sys_truncate64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100428ENDPROC(sys_oabi_truncate64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000429
430sys_oabi_ftruncate64:
431 mov r3, r2
432 mov r2, r1
433 b sys_ftruncate64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100434ENDPROC(sys_oabi_ftruncate64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000435
436sys_oabi_readahead:
437 str r3, [sp]
438 mov r3, r2
439 mov r2, r1
440 b sys_readahead
Catalin Marinas93ed3972008-08-28 11:22:32 +0100441ENDPROC(sys_oabi_readahead)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000442
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000443/*
444 * Let's declare a second syscall table for old ABI binaries
445 * using the compatibility syscall entries.
446 */
Russell King96a8fae2016-10-18 19:57:01 +0100447 syscall_table_start sys_oabi_call_table
448#define COMPAT(nr, native, compat) syscall nr, compat
449#include <calls-oabi.S>
450 syscall_table_end sys_oabi_call_table
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000451
Nicolas Pitre687ad012006-01-14 16:35:31 +0000452#endif
453