blob: 20df608bf343d22f0435d158fc7d11b17b4391f7 [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
Russell King10573ae2018-05-11 11:16:22 +0100245 invoke_syscall tbl, scno, r10, ret_fast_syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246
247 add r1, sp, #S_OFF
Will Deacond95bc252013-09-19 10:32:20 +01002482: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100249 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
Will Deacon377747c2013-05-13 19:16:34 +0100250 bcs arm_syscall
Will Deacond95bc252013-09-19 10:32:20 +0100251 mov why, #0 @ no longer a real syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 b sys_ni_syscall @ not private func
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100253
254#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
255 /*
256 * We failed to handle a fault trying to access the page
257 * containing the swi instruction, but we're not really in a
258 * position to return -EFAULT. Instead, return back to the
259 * instruction and re-enter the user fault handling path trying
260 * to page it in. This will likely result in sending SEGV to the
261 * current task.
262 */
2639001:
Russell King309ee042017-03-24 16:15:45 +0000264 sub lr, saved_pc, #4
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100265 str lr, [sp, #S_PC]
Russell Kingda594e32017-03-24 16:19:12 +0000266 get_thread_info tsk
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100267 b ret_fast_syscall
268#endif
Catalin Marinas93ed3972008-08-28 11:22:32 +0100269ENDPROC(vector_swi)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270
271 /*
272 * This is the really slow path. We're going to be doing
273 * context switches, and waiting for our parent to respond.
274 */
275__sys_trace:
Will Deaconad722542012-07-06 15:50:14 +0100276 mov r1, scno
277 add r0, sp, #S_OFF
278 bl syscall_trace_enter
Russell King10573ae2018-05-11 11:16:22 +0100279 mov scno, r0
280 invoke_syscall tbl, scno, r10, __sys_trace_return, reload=1
Kees Cookad75b512012-11-15 22:12:17 +0100281 cmp scno, #-1 @ skip the syscall?
282 bne 2b
283 add sp, sp, #S_OFF @ restore stack
284 b ret_slow_syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285
286__sys_trace_return:
287 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
Will Deaconad722542012-07-06 15:50:14 +0100288 mov r0, sp
289 bl syscall_trace_exit
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 b ret_slow_syscall
291
Russell King3302cad2015-08-20 16:13:37 +0100292__sys_trace_return_nosave:
Russell Kinge0aa3a62015-08-20 17:39:32 +0100293 enable_irq_notrace
Russell King3302cad2015-08-20 16:13:37 +0100294 mov r0, sp
295 bl syscall_trace_exit
296 b ret_slow_syscall
297
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 .align 5
299#ifdef CONFIG_ALIGNMENT_TRAP
300 .type __cr_alignment, #object
301__cr_alignment:
302 .word cr_alignment
303#endif
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000304 .ltorg
305
Russell King96a8fae2016-10-18 19:57:01 +0100306 .macro syscall_table_start, sym
307 .equ __sys_nr, 0
308 .type \sym, #object
309ENTRY(\sym)
310 .endm
311
312 .macro syscall, nr, func
313 .ifgt __sys_nr - \nr
314 .error "Duplicated/unorded system call entry"
315 .endif
316 .rept \nr - __sys_nr
317 .long sys_ni_syscall
318 .endr
319 .long \func
320 .equ __sys_nr, \nr + 1
321 .endm
322
323 .macro syscall_table_end, sym
324 .ifgt __sys_nr - __NR_syscalls
325 .error "System call table too big"
326 .endif
327 .rept __NR_syscalls - __sys_nr
328 .long sys_ni_syscall
329 .endr
330 .size \sym, . - \sym
331 .endm
332
333#define NATIVE(nr, func) syscall nr, func
334
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000335/*
336 * This is the syscall table declaration for native ABI syscalls.
337 * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
338 */
Russell King96a8fae2016-10-18 19:57:01 +0100339 syscall_table_start sys_call_table
340#define COMPAT(nr, native, compat) syscall nr, native
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000341#ifdef CONFIG_AEABI
Russell King96a8fae2016-10-18 19:57:01 +0100342#include <calls-eabi.S>
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000343#else
Russell King96a8fae2016-10-18 19:57:01 +0100344#include <calls-oabi.S>
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000345#endif
Russell King96a8fae2016-10-18 19:57:01 +0100346#undef COMPAT
347 syscall_table_end sys_call_table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348
349/*============================================================================
350 * Special system call wrappers
351 */
352@ r0 = syscall number
Russell King567bd982005-12-17 15:25:42 +0000353@ r8 = syscall table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354sys_syscall:
Paul Brook52475932006-05-16 14:25:55 +0100355 bic scno, r0, #__NR_OABI_SYSCALL_BASE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 cmp scno, #__NR_syscall - __NR_SYSCALL_BASE
357 cmpne scno, #NR_syscalls @ check range
Russell King10573ae2018-05-11 11:16:22 +0100358#ifdef CONFIG_CPU_SPECTRE
359 movhs scno, #0
360 csdb
361#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 stmloia sp, {r5, r6} @ shuffle args
363 movlo r0, r1
364 movlo r1, r2
365 movlo r2, r3
366 movlo r3, r4
367 ldrlo pc, [tbl, scno, lsl #2]
368 b sys_ni_syscall
Catalin Marinas93ed3972008-08-28 11:22:32 +0100369ENDPROC(sys_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371sys_sigreturn_wrapper:
372 add r0, sp, #S_OFF
Al Viro653d48b2010-09-17 14:34:39 +0100373 mov why, #0 @ prevent syscall restart handling
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374 b sys_sigreturn
Catalin Marinas93ed3972008-08-28 11:22:32 +0100375ENDPROC(sys_sigreturn_wrapper)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376
377sys_rt_sigreturn_wrapper:
378 add r0, sp, #S_OFF
Al Viro653d48b2010-09-17 14:34:39 +0100379 mov why, #0 @ prevent syscall restart handling
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 b sys_rt_sigreturn
Catalin Marinas93ed3972008-08-28 11:22:32 +0100381ENDPROC(sys_rt_sigreturn_wrapper)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382
Nicolas Pitre713c4812006-01-14 16:35:03 +0000383sys_statfs64_wrapper:
384 teq r1, #88
385 moveq r1, #84
386 b sys_statfs64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100387ENDPROC(sys_statfs64_wrapper)
Nicolas Pitre713c4812006-01-14 16:35:03 +0000388
389sys_fstatfs64_wrapper:
390 teq r1, #88
391 moveq r1, #84
392 b sys_fstatfs64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100393ENDPROC(sys_fstatfs64_wrapper)
Nicolas Pitre713c4812006-01-14 16:35:03 +0000394
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395/*
396 * Note: off_4k (r5) is always units of 4K. If we can't do the requested
397 * offset, we return EINVAL.
398 */
399sys_mmap2:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 str r5, [sp, #4]
Al Virof8b72562009-11-30 17:37:04 -0500401 b sys_mmap_pgoff
Catalin Marinas93ed3972008-08-28 11:22:32 +0100402ENDPROC(sys_mmap2)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000403
404#ifdef CONFIG_OABI_COMPAT
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000405
Nicolas Pitre687ad012006-01-14 16:35:31 +0000406/*
407 * These are syscalls with argument register differences
408 */
409
410sys_oabi_pread64:
411 stmia sp, {r3, r4}
412 b sys_pread64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100413ENDPROC(sys_oabi_pread64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000414
415sys_oabi_pwrite64:
416 stmia sp, {r3, r4}
417 b sys_pwrite64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100418ENDPROC(sys_oabi_pwrite64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000419
420sys_oabi_truncate64:
421 mov r3, r2
422 mov r2, r1
423 b sys_truncate64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100424ENDPROC(sys_oabi_truncate64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000425
426sys_oabi_ftruncate64:
427 mov r3, r2
428 mov r2, r1
429 b sys_ftruncate64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100430ENDPROC(sys_oabi_ftruncate64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000431
432sys_oabi_readahead:
433 str r3, [sp]
434 mov r3, r2
435 mov r2, r1
436 b sys_readahead
Catalin Marinas93ed3972008-08-28 11:22:32 +0100437ENDPROC(sys_oabi_readahead)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000438
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000439/*
440 * Let's declare a second syscall table for old ABI binaries
441 * using the compatibility syscall entries.
442 */
Russell King96a8fae2016-10-18 19:57:01 +0100443 syscall_table_start sys_oabi_call_table
444#define COMPAT(nr, native, compat) syscall nr, compat
445#include <calls-oabi.S>
446 syscall_table_end sys_oabi_call_table
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000447
Nicolas Pitre687ad012006-01-14 16:35:31 +0000448#endif
449