blob: 0b60adf4a5d9b4185d651b985c73f50a48ae8850 [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>
Russell King96a8fae2016-10-18 19:57:01 +010015#ifdef CONFIG_AEABI
16#include <asm/unistd-oabi.h>
17#endif
18
19 .equ NR_syscalls, __NR_syscalls
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Rob Herring13a50452012-02-07 09:28:22 -060021#ifdef CONFIG_NEED_RET_TO_USER
22#include <mach/entry-macro.S>
23#else
24 .macro arch_ret_to_user, tmp1, tmp2
25 .endm
26#endif
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include "entry-header.S"
29
Russell King309ee042017-03-24 16:15:45 +000030saved_psr .req r8
Russell Kingfcea4522017-03-24 16:22:10 +000031#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
32saved_pc .req r9
33#define TRACE(x...) x
34#else
Russell King309ee042017-03-24 16:15:45 +000035saved_pc .req lr
Russell Kingfcea4522017-03-24 16:22:10 +000036#define TRACE(x...)
37#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39 .align 5
Russell King3302cad2015-08-20 16:13:37 +010040#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING))
Linus Torvalds1da177e2005-04-16 15:20:36 -070041/*
Russell King3302cad2015-08-20 16:13:37 +010042 * This is the fast syscall return path. We do as little as possible here,
43 * such as avoiding writing r0 to the stack. We only use this path if we
44 * have tracing and context tracking disabled - the overheads from those
45 * features make this path too inefficient.
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 */
47ret_fast_syscall:
Catalin Marinasc4c57162009-02-16 11:42:09 +010048 UNWIND(.fnstart )
49 UNWIND(.cantunwind )
Russell King3302cad2015-08-20 16:13:37 +010050 disable_irq_notrace @ disable interrupts
Russell King1b979372015-05-15 11:02:23 +010051 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
Russell King3302cad2015-08-20 16:13:37 +010052 tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 bne fast_work_pending
Russell Kingf4dc9a42005-04-26 15:20:34 +010054
Dan Williamsf80dff92007-02-16 22:16:32 +010055 /* perform architecture specific actions before user return */
56 arch_ret_to_user r1, lr
57
Catalin Marinasb86040a2009-07-24 12:32:54 +010058 restore_user_regs fast = 1, offset = S_OFF
Catalin Marinasc4c57162009-02-16 11:42:09 +010059 UNWIND(.fnend )
Russell King3302cad2015-08-20 16:13:37 +010060ENDPROC(ret_fast_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Russell King3302cad2015-08-20 16:13:37 +010062 /* Ok, we need to do extra processing, enter the slow path. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063fast_work_pending:
64 str r0, [sp, #S_R0+S_OFF]! @ returned r0
Russell King3302cad2015-08-20 16:13:37 +010065 /* fall through to work_pending */
66#else
67/*
68 * The "replacement" ret_fast_syscall for when tracing or context tracking
69 * is enabled. As we will need to call out to some C functions, we save
70 * r0 first to avoid needing to save registers around each C function call.
71 */
72ret_fast_syscall:
73 UNWIND(.fnstart )
74 UNWIND(.cantunwind )
75 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
76 disable_irq_notrace @ disable interrupts
77 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
78 tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
79 beq no_work_pending
80 UNWIND(.fnend )
81ENDPROC(ret_fast_syscall)
82
83 /* Slower path - fall through to work_pending */
84#endif
85
86 tst r1, #_TIF_SYSCALL_WORK
87 bne __sys_trace_return_nosave
88slow_work_pending:
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 mov r0, sp @ 'regs'
90 mov r2, why @ 'syscall'
Al Viro0a267fa2012-07-19 17:47:55 +010091 bl do_work_pending
Al Viro66285212012-07-19 17:48:50 +010092 cmp r0, #0
Al Viro81783782012-07-19 17:48:21 +010093 beq no_work_pending
Al Viro66285212012-07-19 17:48:50 +010094 movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)
Al Viro81783782012-07-19 17:48:21 +010095 ldmia sp, {r0 - r6} @ have to reload r0 - r6
96 b local_restart @ ... and off we go
Drew Richardsone83dd372015-08-06 18:50:27 +010097ENDPROC(ret_fast_syscall)
Al Viro81783782012-07-19 17:48:21 +010098
Linus Torvalds1da177e2005-04-16 15:20:36 -070099/*
100 * "slow" syscall return path. "why" tells us if this was a real syscall.
Russell King3302cad2015-08-20 16:13:37 +0100101 * IRQs may be enabled here, so always disable them. Note that we use the
102 * "notrace" version to avoid calling into the tracing code unnecessarily.
103 * do_work_pending() will update this state if necessary.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 */
105ENTRY(ret_to_user)
106ret_slow_syscall:
Russell King3302cad2015-08-20 16:13:37 +0100107 disable_irq_notrace @ disable interrupts
Ming Lei9fc25522011-06-05 02:24:58 +0100108ENTRY(ret_to_user_from_irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 ldr r1, [tsk, #TI_FLAGS]
110 tst r1, #_TIF_WORK_MASK
Russell King3302cad2015-08-20 16:13:37 +0100111 bne slow_work_pending
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112no_work_pending:
Russell King3302cad2015-08-20 16:13:37 +0100113 asm_trace_hardirqs_on save = 0
Russell King651e9492013-03-28 11:44:25 +0000114
Dan Williamsf80dff92007-02-16 22:16:32 +0100115 /* perform architecture specific actions before user return */
116 arch_ret_to_user r1, lr
Kevin Hilmanb0088482013-03-28 22:54:40 +0100117 ct_user_enter save = 0
Dan Williamsf80dff92007-02-16 22:16:32 +0100118
Catalin Marinasb86040a2009-07-24 12:32:54 +0100119 restore_user_regs fast = 0, offset = 0
Ming Lei9fc25522011-06-05 02:24:58 +0100120ENDPROC(ret_to_user_from_irq)
Catalin Marinas93ed3972008-08-28 11:22:32 +0100121ENDPROC(ret_to_user)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
123/*
124 * This is how we return from a fork.
125 */
126ENTRY(ret_from_fork)
127 bl schedule_tail
Al Viro9fff2fa2012-10-10 22:23:29 -0400128 cmp r5, #0
129 movne r0, r4
Russell King14327c62015-04-21 14:17:25 +0100130 badrne lr, 1f
Russell King6ebbf2c2014-06-30 16:29:12 +0100131 retne r5
Russell King68687c82012-10-15 00:16:49 +01001321: get_thread_info tsk
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 b ret_slow_syscall
Catalin Marinas93ed3972008-08-28 11:22:32 +0100134ENDPROC(ret_from_fork)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136/*=============================================================================
137 * SWI handler
138 *-----------------------------------------------------------------------------
139 */
140
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 .align 5
142ENTRY(vector_swi)
Uwe Kleine-König19c4d592010-05-21 18:06:42 +0100143#ifdef CONFIG_CPU_V7M
144 v7m_exception_entry
145#else
Russell King5745eef62016-05-10 16:34:27 +0100146 sub sp, sp, #PT_REGS_SIZE
Russell Kingf4dc9a42005-04-26 15:20:34 +0100147 stmia sp, {r0 - r12} @ Calling r0 - r12
Catalin Marinasb86040a2009-07-24 12:32:54 +0100148 ARM( add r8, sp, #S_PC )
149 ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr
150 THUMB( mov r8, sp )
151 THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr
Russell King309ee042017-03-24 16:15:45 +0000152 mrs saved_psr, spsr @ called from non-FIQ mode, so ok.
Russell Kingfcea4522017-03-24 16:22:10 +0000153 TRACE( mov saved_pc, lr )
Russell King309ee042017-03-24 16:15:45 +0000154 str saved_pc, [sp, #S_PC] @ Save calling PC
155 str saved_psr, [sp, #S_PSR] @ Save CPSR
Russell Kingf4dc9a42005-04-26 15:20:34 +0100156 str r0, [sp, #S_OLD_R0] @ Save OLD_R0
Uwe Kleine-König19c4d592010-05-21 18:06:42 +0100157#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 zero_fp
Russell King195b58a2014-08-28 13:08:14 +0100159 alignment_trap r10, ip, __cr_alignment
Russell Kingdca778c2017-03-24 16:23:25 +0000160 asm_trace_hardirqs_on save=0
161 enable_irq_notrace
162 ct_user_exit save=0
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100163
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100164 /*
165 * Get the system call number.
166 */
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000167
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000168#if defined(CONFIG_OABI_COMPAT)
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000169
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000170 /*
171 * If we have CONFIG_OABI_COMPAT then we need to look at the swi
172 * value to determine if it is an EABI or an old ABI call.
173 */
174#ifdef CONFIG_ARM_THUMB
Russell King309ee042017-03-24 16:15:45 +0000175 tst saved_psr, #PSR_T_BIT
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000176 movne r10, #0 @ no thumb OABI emulation
Russell King309ee042017-03-24 16:15:45 +0000177 USER( ldreq r10, [saved_pc, #-4] ) @ get SWI instruction
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000178#else
Russell King309ee042017-03-24 16:15:45 +0000179 USER( ldr r10, [saved_pc, #-4] ) @ get SWI instruction
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000180#endif
Ben Dooks457c2402013-02-12 18:59:57 +0000181 ARM_BE8(rev r10, r10) @ little endian instruction
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000182
183#elif defined(CONFIG_AEABI)
184
185 /*
186 * Pure EABI user space always put syscall number into scno (r7).
187 */
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000188#elif defined(CONFIG_ARM_THUMB)
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000189 /* Legacy ABI only, possibly thumb mode. */
Russell King309ee042017-03-24 16:15:45 +0000190 tst saved_psr, #PSR_T_BIT @ this is SPSR from save_user_regs
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100191 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
Russell King309ee042017-03-24 16:15:45 +0000192 USER( ldreq scno, [saved_pc, #-4] )
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000193
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100194#else
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000195 /* Legacy ABI only. */
Russell King309ee042017-03-24 16:15:45 +0000196 USER( ldr scno, [saved_pc, #-4] ) @ get SWI instruction
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100197#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198
Russell King309ee042017-03-24 16:15:45 +0000199 /* saved_psr and saved_pc are now dead */
200
Russell King2190fed2015-08-20 10:32:02 +0100201 uaccess_disable tbl
202
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000203 adr tbl, sys_call_table @ load syscall table pointer
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000204
205#if defined(CONFIG_OABI_COMPAT)
206 /*
207 * If the swi argument is zero, this is an EABI call and we do nothing.
208 *
209 * If this is an old ABI call, get the syscall number into scno and
210 * get the old ABI syscall table address.
211 */
212 bics r10, r10, #0xff000000
213 eorne scno, r10, #__NR_OABI_SYSCALL_BASE
214 ldrne tbl, =sys_oabi_call_table
215#elif !defined(CONFIG_AEABI)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 bic scno, scno, #0xff000000 @ mask off SWI op-code
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100217 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000218#endif
Russell Kingda594e32017-03-24 16:19:12 +0000219 get_thread_info tsk
Russell Kingdca778c2017-03-24 16:23:25 +0000220 /*
221 * Reload the registers that may have been corrupted on entry to
222 * the syscall assembly (by tracing or context tracking.)
223 */
224 TRACE( ldmia sp, {r0 - r3} )
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000225
Al Viro81783782012-07-19 17:48:21 +0100226local_restart:
Nicolas Pitre70c70d92010-08-26 15:08:35 -0700227 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
Nicolas Pitre3f2829a2006-01-14 16:31:29 +0000228 stmdb sp!, {r4, r5} @ push fifth and sixth args
Nicolas Pitre70c70d92010-08-26 15:08:35 -0700229
Nathaniel Husted29ef73b2012-01-03 14:23:09 -0500230 tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls?
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 bne __sys_trace
232
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 cmp scno, #NR_syscalls @ check upper syscall limit
Russell King14327c62015-04-21 14:17:25 +0100234 badr lr, ret_fast_syscall @ return address
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
236
237 add r1, sp, #S_OFF
Will Deacond95bc252013-09-19 10:32:20 +01002382: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
Russell Kinge0f9f4a2005-04-26 15:19:24 +0100239 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
Will Deacon377747c2013-05-13 19:16:34 +0100240 bcs arm_syscall
Will Deacond95bc252013-09-19 10:32:20 +0100241 mov why, #0 @ no longer a real syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 b sys_ni_syscall @ not private func
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100243
244#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
245 /*
246 * We failed to handle a fault trying to access the page
247 * containing the swi instruction, but we're not really in a
248 * position to return -EFAULT. Instead, return back to the
249 * instruction and re-enter the user fault handling path trying
250 * to page it in. This will likely result in sending SEGV to the
251 * current task.
252 */
2539001:
Russell King309ee042017-03-24 16:15:45 +0000254 sub lr, saved_pc, #4
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100255 str lr, [sp, #S_PC]
Russell Kingda594e32017-03-24 16:19:12 +0000256 get_thread_info tsk
Will Deacon1aa2b3b2013-06-05 11:25:13 +0100257 b ret_fast_syscall
258#endif
Catalin Marinas93ed3972008-08-28 11:22:32 +0100259ENDPROC(vector_swi)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260
261 /*
262 * This is the really slow path. We're going to be doing
263 * context switches, and waiting for our parent to respond.
264 */
265__sys_trace:
Will Deaconad722542012-07-06 15:50:14 +0100266 mov r1, scno
267 add r0, sp, #S_OFF
268 bl syscall_trace_enter
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
Russell King14327c62015-04-21 14:17:25 +0100270 badr lr, __sys_trace_return @ return address
Nicolas Pitre3f471122006-01-14 19:30:04 +0000271 mov scno, r0 @ syscall number (possibly new)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 add r1, sp, #S_R0 + S_OFF @ pointer to regs
273 cmp scno, #NR_syscalls @ check upper syscall limit
Will Deaconc7aa00d2012-07-19 17:49:22 +0100274 ldmccia r1, {r0 - r6} @ have to reload r0 - r6
275 stmccia sp, {r4, r5} @ and update the stack args
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
Kees Cookad75b512012-11-15 22:12:17 +0100277 cmp scno, #-1 @ skip the syscall?
278 bne 2b
279 add sp, sp, #S_OFF @ restore stack
280 b ret_slow_syscall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281
282__sys_trace_return:
283 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
Will Deaconad722542012-07-06 15:50:14 +0100284 mov r0, sp
285 bl syscall_trace_exit
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 b ret_slow_syscall
287
Russell King3302cad2015-08-20 16:13:37 +0100288__sys_trace_return_nosave:
Russell Kinge0aa3a62015-08-20 17:39:32 +0100289 enable_irq_notrace
Russell King3302cad2015-08-20 16:13:37 +0100290 mov r0, sp
291 bl syscall_trace_exit
292 b ret_slow_syscall
293
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294 .align 5
295#ifdef CONFIG_ALIGNMENT_TRAP
296 .type __cr_alignment, #object
297__cr_alignment:
298 .word cr_alignment
299#endif
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000300 .ltorg
301
Russell King96a8fae2016-10-18 19:57:01 +0100302 .macro syscall_table_start, sym
303 .equ __sys_nr, 0
304 .type \sym, #object
305ENTRY(\sym)
306 .endm
307
308 .macro syscall, nr, func
309 .ifgt __sys_nr - \nr
310 .error "Duplicated/unorded system call entry"
311 .endif
312 .rept \nr - __sys_nr
313 .long sys_ni_syscall
314 .endr
315 .long \func
316 .equ __sys_nr, \nr + 1
317 .endm
318
319 .macro syscall_table_end, sym
320 .ifgt __sys_nr - __NR_syscalls
321 .error "System call table too big"
322 .endif
323 .rept __NR_syscalls - __sys_nr
324 .long sys_ni_syscall
325 .endr
326 .size \sym, . - \sym
327 .endm
328
329#define NATIVE(nr, func) syscall nr, func
330
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000331/*
332 * This is the syscall table declaration for native ABI syscalls.
333 * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
334 */
Russell King96a8fae2016-10-18 19:57:01 +0100335 syscall_table_start sys_call_table
336#define COMPAT(nr, native, compat) syscall nr, native
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000337#ifdef CONFIG_AEABI
Russell King96a8fae2016-10-18 19:57:01 +0100338#include <calls-eabi.S>
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000339#else
Russell King96a8fae2016-10-18 19:57:01 +0100340#include <calls-oabi.S>
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000341#endif
Russell King96a8fae2016-10-18 19:57:01 +0100342#undef COMPAT
343 syscall_table_end sys_call_table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344
345/*============================================================================
346 * Special system call wrappers
347 */
348@ r0 = syscall number
Russell King567bd982005-12-17 15:25:42 +0000349@ r8 = syscall table
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350sys_syscall:
Paul Brook52475932006-05-16 14:25:55 +0100351 bic scno, r0, #__NR_OABI_SYSCALL_BASE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 cmp scno, #__NR_syscall - __NR_SYSCALL_BASE
353 cmpne scno, #NR_syscalls @ check range
354 stmloia sp, {r5, r6} @ shuffle args
355 movlo r0, r1
356 movlo r1, r2
357 movlo r2, r3
358 movlo r3, r4
359 ldrlo pc, [tbl, scno, lsl #2]
360 b sys_ni_syscall
Catalin Marinas93ed3972008-08-28 11:22:32 +0100361ENDPROC(sys_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363sys_sigreturn_wrapper:
364 add r0, sp, #S_OFF
Al Viro653d48b2010-09-17 14:34:39 +0100365 mov why, #0 @ prevent syscall restart handling
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 b sys_sigreturn
Catalin Marinas93ed3972008-08-28 11:22:32 +0100367ENDPROC(sys_sigreturn_wrapper)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368
369sys_rt_sigreturn_wrapper:
370 add r0, sp, #S_OFF
Al Viro653d48b2010-09-17 14:34:39 +0100371 mov why, #0 @ prevent syscall restart handling
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 b sys_rt_sigreturn
Catalin Marinas93ed3972008-08-28 11:22:32 +0100373ENDPROC(sys_rt_sigreturn_wrapper)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374
Nicolas Pitre713c4812006-01-14 16:35:03 +0000375sys_statfs64_wrapper:
376 teq r1, #88
377 moveq r1, #84
378 b sys_statfs64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100379ENDPROC(sys_statfs64_wrapper)
Nicolas Pitre713c4812006-01-14 16:35:03 +0000380
381sys_fstatfs64_wrapper:
382 teq r1, #88
383 moveq r1, #84
384 b sys_fstatfs64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100385ENDPROC(sys_fstatfs64_wrapper)
Nicolas Pitre713c4812006-01-14 16:35:03 +0000386
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387/*
388 * Note: off_4k (r5) is always units of 4K. If we can't do the requested
389 * offset, we return EINVAL.
390 */
391sys_mmap2:
392#if PAGE_SHIFT > 12
393 tst r5, #PGOFF_MASK
394 moveq r5, r5, lsr #PAGE_SHIFT - 12
395 streq r5, [sp, #4]
Al Virof8b72562009-11-30 17:37:04 -0500396 beq sys_mmap_pgoff
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397 mov r0, #-EINVAL
Russell King6ebbf2c2014-06-30 16:29:12 +0100398 ret lr
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399#else
400 str r5, [sp, #4]
Al Virof8b72562009-11-30 17:37:04 -0500401 b sys_mmap_pgoff
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402#endif
Catalin Marinas93ed3972008-08-28 11:22:32 +0100403ENDPROC(sys_mmap2)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000404
405#ifdef CONFIG_OABI_COMPAT
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000406
Nicolas Pitre687ad012006-01-14 16:35:31 +0000407/*
408 * These are syscalls with argument register differences
409 */
410
411sys_oabi_pread64:
412 stmia sp, {r3, r4}
413 b sys_pread64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100414ENDPROC(sys_oabi_pread64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000415
416sys_oabi_pwrite64:
417 stmia sp, {r3, r4}
418 b sys_pwrite64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100419ENDPROC(sys_oabi_pwrite64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000420
421sys_oabi_truncate64:
422 mov r3, r2
423 mov r2, r1
424 b sys_truncate64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100425ENDPROC(sys_oabi_truncate64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000426
427sys_oabi_ftruncate64:
428 mov r3, r2
429 mov r2, r1
430 b sys_ftruncate64
Catalin Marinas93ed3972008-08-28 11:22:32 +0100431ENDPROC(sys_oabi_ftruncate64)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000432
433sys_oabi_readahead:
434 str r3, [sp]
435 mov r3, r2
436 mov r2, r1
437 b sys_readahead
Catalin Marinas93ed3972008-08-28 11:22:32 +0100438ENDPROC(sys_oabi_readahead)
Nicolas Pitre687ad012006-01-14 16:35:31 +0000439
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000440/*
441 * Let's declare a second syscall table for old ABI binaries
442 * using the compatibility syscall entries.
443 */
Russell King96a8fae2016-10-18 19:57:01 +0100444 syscall_table_start sys_oabi_call_table
445#define COMPAT(nr, native, compat) syscall nr, compat
446#include <calls-oabi.S>
447 syscall_table_end sys_oabi_call_table
Nicolas Pitredd35afc2006-01-14 16:36:12 +0000448
Nicolas Pitre687ad012006-01-14 16:35:31 +0000449#endif
450