entry-common.S 14.1 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1
2
3
4
/*
 *  linux/arch/arm/kernel/entry-common.S
 *
 *  Copyright (C) 2000 Russell King
5
 *  Copyright (C) 2005 Stelian Pop.
Linus Torvalds's avatar
Linus Torvalds committed
6
7
8
9
10
11
 *
 * 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.
 */

12
#include <asm/assembler.h>
Linus Torvalds's avatar
Linus Torvalds committed
13
#include <asm/unistd.h>
14
#include <asm/ftrace.h>
15
#include <asm/unwind.h>
16
#include <asm/memory.h>
17
18
19
20
21
#ifdef CONFIG_AEABI
#include <asm/unistd-oabi.h>
#endif

	.equ	NR_syscalls, __NR_syscalls
Linus Torvalds's avatar
Linus Torvalds committed
22

23
24
25
26
27
28
29
#ifdef CONFIG_NEED_RET_TO_USER
#include <mach/entry-macro.S>
#else
	.macro  arch_ret_to_user, tmp1, tmp2
	.endm
#endif

Linus Torvalds's avatar
Linus Torvalds committed
30
31
#include "entry-header.S"

32
saved_psr	.req	r8
Russell King's avatar
Russell King committed
33
34
35
36
#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
saved_pc	.req	r9
#define TRACE(x...) x
#else
37
saved_pc	.req	lr
Russell King's avatar
Russell King committed
38
39
#define TRACE(x...)
#endif
Linus Torvalds's avatar
Linus Torvalds committed
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifdef CONFIG_IPIPE

.macro  ipipe_oabi_save_sysnr, tmp
#ifdef CONFIG_OABI_COMPAT
	ldr	\tmp, [sp, #S_R7 + S_OFF]
	stmdb	sp!, {\tmp}
	ldr	\tmp, =sys_oabi_call_table
	cmp	\tmp, tbl
	moveq	\tmp, scno
	addeq	\tmp, #__NR_SYSCALL_BASE
	streq	\tmp, [sp, #S_R7 + S_OFF + 4]	@ head domain expects sycall number in r7
#elif !defined(CONFIG_AEABI)
	ldr	\tmp, [sp, #S_R7 + S_OFF]
	stmdb	sp!, {\tmp}
	mov	\tmp, scno
	add	\tmp, #__NR_SYSCALL_BASE
	str	\tmp, [sp, #S_R7 + S_OFF + 4]
#endif
.endm

.macro  ipipe_oabi_restore_sysnr, tmp
#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
	ldmia	sp!, {\tmp}
	str	\tmp, [sp, #S_R7 + S_OFF]
#endif
.endm

#endif /* CONFIG_IPIPE */

70
	.section .entry.text,"ax",%progbits
Linus Torvalds's avatar
Linus Torvalds committed
71
	.align	5
72
73
#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING) || \
	IS_ENABLED(CONFIG_DEBUG_RSEQ))
Linus Torvalds's avatar
Linus Torvalds committed
74
/*
Russell King's avatar
Russell King committed
75
76
 * This is the fast syscall return path.  We do as little as possible here,
 * such as avoiding writing r0 to the stack.  We only use this path if we
77
78
 * have tracing, context tracking and rseq debug disabled - the overheads
 * from those features make this path too inefficient.
Linus Torvalds's avatar
Linus Torvalds committed
79
80
 */
ret_fast_syscall:
81
__ret_fast_syscall:
82
83
 UNWIND(.fnstart	)
 UNWIND(.cantunwind	)
Russell King's avatar
Russell King committed
84
	disable_irq_notrace			@ disable interrupts
85
86
87
	ldr	r2, [tsk, #TI_ADDR_LIMIT]
	cmp	r2, #TASK_SIZE
	blne	addr_limit_check_failed
88
	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
89
	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
Linus Torvalds's avatar
Linus Torvalds committed
90
	bne	fast_work_pending
91

92
93
94
	/* perform architecture specific actions before user return */
	arch_ret_to_user r1, lr

95
	restore_user_regs fast = 1, offset = S_OFF
96
97


98
 UNWIND(.fnend		)
Russell King's avatar
Russell King committed
99
ENDPROC(ret_fast_syscall)
Linus Torvalds's avatar
Linus Torvalds committed
100

Russell King's avatar
Russell King committed
101
	/* Ok, we need to do extra processing, enter the slow path. */
Linus Torvalds's avatar
Linus Torvalds committed
102
103
fast_work_pending:
	str	r0, [sp, #S_R0+S_OFF]!		@ returned r0
Russell King's avatar
Russell King committed
104
105
106
	/* fall through to work_pending */
#else
/*
107
108
109
110
 * The "replacement" ret_fast_syscall for when tracing, context tracking,
 * or rseq debug is enabled.  As we will need to call out to some C functions,
 * we save r0 first to avoid needing to save registers around each C function
 * call.
Russell King's avatar
Russell King committed
111
112
 */
ret_fast_syscall:
113
__ret_fast_syscall:
Russell King's avatar
Russell King committed
114
115
116
 UNWIND(.fnstart	)
 UNWIND(.cantunwind	)
	str	r0, [sp, #S_R0 + S_OFF]!	@ save returned r0
117
118
119
120
121
#if IS_ENABLED(CONFIG_DEBUG_RSEQ)
	/* do_rseq_syscall needs interrupts enabled. */
	mov	r0, sp				@ 'regs'
	bl	do_rseq_syscall
#endif
Russell King's avatar
Russell King committed
122
	disable_irq_notrace			@ disable interrupts
123
124
125
	ldr	r2, [tsk, #TI_ADDR_LIMIT]
	cmp	r2, #TASK_SIZE
	blne	addr_limit_check_failed
Russell King's avatar
Russell King committed
126
	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
127
	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
Russell King's avatar
Russell King committed
128
129
130
131
132
133
134
135
136
137
	beq	no_work_pending
 UNWIND(.fnend		)
ENDPROC(ret_fast_syscall)

	/* Slower path - fall through to work_pending */
#endif

	tst	r1, #_TIF_SYSCALL_WORK
	bne	__sys_trace_return_nosave
slow_work_pending:
Linus Torvalds's avatar
Linus Torvalds committed
138
139
	mov	r0, sp				@ 'regs'
	mov	r2, why				@ 'syscall'
140
	bl	do_work_pending
141
	cmp	r0, #0
142
	beq	no_work_pending
143
	movlt	scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)
144
145
	ldmia	sp, {r0 - r6}			@ have to reload r0 - r6
	b	local_restart			@ ... and off we go
146
ENDPROC(ret_fast_syscall)
147

Linus Torvalds's avatar
Linus Torvalds committed
148
149
/*
 * "slow" syscall return path.  "why" tells us if this was a real syscall.
Russell King's avatar
Russell King committed
150
151
152
 * IRQs may be enabled here, so always disable them.  Note that we use the
 * "notrace" version to avoid calling into the tracing code unnecessarily.
 * do_work_pending() will update this state if necessary.
Linus Torvalds's avatar
Linus Torvalds committed
153
154
155
 */
ENTRY(ret_to_user)
ret_slow_syscall:
156
157
158
159
160
161
#if IS_ENABLED(CONFIG_DEBUG_RSEQ)
	/* do_rseq_syscall needs interrupts enabled. */
	enable_irq_notrace			@ enable interrupts
	mov	r0, sp				@ 'regs'
	bl	do_rseq_syscall
#endif
Russell King's avatar
Russell King committed
162
	disable_irq_notrace			@ disable interrupts
163
ENTRY(ret_to_user_from_irq)
164
165
166
	ldr	r2, [tsk, #TI_ADDR_LIMIT]
	cmp	r2, #TASK_SIZE
	blne	addr_limit_check_failed
Linus Torvalds's avatar
Linus Torvalds committed
167
168
	ldr	r1, [tsk, #TI_FLAGS]
	tst	r1, #_TIF_WORK_MASK
Russell King's avatar
Russell King committed
169
	bne	slow_work_pending
Linus Torvalds's avatar
Linus Torvalds committed
170
no_work_pending:
171
172
173
174
175
176
177
#ifdef CONFIG_IPIPE
	get_thread_info tsk
	ldr	r1, [tsk, #TI_IPIPE]
	tst	r1, #_TIP_USERINTRET
	bne	call_user_intret_notifier
goto_user:
#endif
Russell King's avatar
Russell King committed
178
	asm_trace_hardirqs_on save = 0
179
	slow_restore_user_regs
180
181
182
183
184
185
186
187
188
189

#ifdef CONFIG_IPIPE
call_user_intret_notifier:
	enable_irq_notrace
	bl	__ipipe_notify_user_intreturn
	cmp	r0, #0
	beq	ret_slow_syscall
	disable_irq_notrace
	b	goto_user
#endif
190
ENDPROC(ret_to_user_from_irq)
191
ENDPROC(ret_to_user)
Linus Torvalds's avatar
Linus Torvalds committed
192
193
194
195
196

/*
 * This is how we return from a fork.
 */
ENTRY(ret_from_fork)
197
	enable_irq_cond
Linus Torvalds's avatar
Linus Torvalds committed
198
	bl	schedule_tail
199
200
	cmp	r5, #0
	movne	r0, r4
201
	badrne	lr, 1f
202
	retne	r5
203
1:	get_thread_info tsk
Linus Torvalds's avatar
Linus Torvalds committed
204
	b	ret_slow_syscall
205
ENDPROC(ret_from_fork)
Linus Torvalds's avatar
Linus Torvalds committed
206

207
#ifdef CONFIG_IPIPE
208
209
__ipipe_ret_to_user:
	disable_irq				@ disable interrupts
210
211
212
213
214
ENTRY(__ipipe_ret_to_user_irqs_disabled)
	slow_restore_user_regs
ENDPROC(__ipipe_ret_to_user_irqs_disabled)
#endif

Linus Torvalds's avatar
Linus Torvalds committed
215
216
217
218
219
220
221
/*=============================================================================
 * SWI handler
 *-----------------------------------------------------------------------------
 */

	.align	5
ENTRY(vector_swi)
222
223
224
#ifdef CONFIG_CPU_V7M
	v7m_exception_entry
#else
225
	sub	sp, sp, #PT_REGS_SIZE
226
	stmia	sp, {r0 - r12}			@ Calling r0 - r12
227
228
229
230
 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
231
	mrs	saved_psr, spsr			@ called from non-FIQ mode, so ok.
Russell King's avatar
Russell King committed
232
 TRACE(	mov	saved_pc, lr		)
233
234
	str	saved_pc, [sp, #S_PC]		@ Save calling PC
	str	saved_psr, [sp, #S_PSR]		@ Save CPSR
235
	str	r0, [sp, #S_OLD_R0]		@ Save OLD_R0
236
#endif
Linus Torvalds's avatar
Linus Torvalds committed
237
	zero_fp
238
239
240
241
242
243
244
245
246
247
#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
	mov	r4, lr
	mov	r0, #1		/* IPIPE_TRACE_BEGIN */
	mov	r3, #0x90000000
	sub	r2, lr, #4	/* calling PC */
	mov	r1, pc
	bl	ipipe_trace_asm
	mov	lr, r4
	ldm	sp, {r0 - r4}
#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
248
	alignment_trap r10, ip, __cr_alignment
249
250
251
	asm_trace_hardirqs_on save=0
	enable_irq_notrace
	ct_user_exit save=0
252

253
254
255
	/*
	 * Get the system call number.
	 */
256

257
#if defined(CONFIG_OABI_COMPAT)
258

259
260
261
262
263
	/*
	 * 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
264
	tst	saved_psr, #PSR_T_BIT
265
	movne	r10, #0				@ no thumb OABI emulation
266
 USER(	ldreq	r10, [saved_pc, #-4]	)	@ get SWI instruction
267
#else
268
 USER(	ldr	r10, [saved_pc, #-4]	)	@ get SWI instruction
269
#endif
270
 ARM_BE8(rev	r10, r10)			@ little endian instruction
271
272
273
274
275
276

#elif defined(CONFIG_AEABI)

	/*
	 * Pure EABI user space always put syscall number into scno (r7).
	 */
277
#elif defined(CONFIG_ARM_THUMB)
278
	/* Legacy ABI only, possibly thumb mode. */
279
	tst	saved_psr, #PSR_T_BIT		@ this is SPSR from save_user_regs
280
	addne	scno, r7, #__NR_SYSCALL_BASE	@ put OS number in
281
 USER(	ldreq	scno, [saved_pc, #-4]	)
282

283
#else
284
	/* Legacy ABI only. */
285
 USER(	ldr	scno, [saved_pc, #-4]	)	@ get SWI instruction
286
#endif
Linus Torvalds's avatar
Linus Torvalds committed
287

288
289
	/* saved_psr and saved_pc are now dead */

290
291
	uaccess_disable tbl

292
293
294
295
296
297
298
299
300
301
302
303
304
	adr	tbl, sys_call_table		@ load syscall table pointer

#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)
Linus Torvalds's avatar
Linus Torvalds committed
305
	bic	scno, scno, #0xff000000		@ mask off SWI op-code
306
	eor	scno, scno, #__NR_SYSCALL_BASE	@ check OS number
307
#endif
308
	get_thread_info tsk
309
310
311
312
313
	/*
	 * Reload the registers that may have been corrupted on entry to
	 * the syscall assembly (by tracing or context tracking.)
	 */
 TRACE(	ldmia	sp, {r0 - r3}		)
314

315
local_restart:
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#ifdef CONFIG_IPIPE
	ldr	r10, [tsk, #TI_IPIPE]
	ldr	r0, =(__ARM_NR_ipipe - __NR_SYSCALL_BASE)
	cmp	scno, r0
	bne	slow_path
	tst	r10, #_TIP_HEAD
	beq	slow_path
	mov	r0, sp
	ipipe_oabi_save_sysnr r10		@ caution: affects sp
	bl	ipipe_fastcall_hook		@ __IPIPE_SYSCALL_E is assumed
	ipipe_oabi_restore_sysnr r10
	cmp	r0, #0
	blt	no_fastcall
	get_thread_info tsk
	ldr	r10, [tsk, #TI_IPIPE]
	tst	r10, #_TIP_HEAD
	bne	fastcall_exit_check		@ check for MAYDAY
	bl	__ipipe_root_sync
	b	ret_slow_syscall
fastcall_exit_check:
	tst	r10, #_TIP_MAYDAY
	beq	__ipipe_ret_to_user
	mov	r0, sp
	bl	__ipipe_call_mayday
	b	__ipipe_ret_to_user
no_fastcall:
	get_thread_info tsk
	ldr	r0, =(__ARM_NR_ipipe - __NR_SYSCALL_BASE)
	ldr	r10, [tsk, #TI_IPIPE]
slow_path:
	tst	r10, #_TIP_NOTIFY
	bne	pipeline_syscall
	cmp	scno, r0
	bne	root_syscall
pipeline_syscall:
	mov	r0, sp
	ipipe_oabi_save_sysnr r10		@ caution: affects sp
	bl	__ipipe_notify_syscall
	ipipe_oabi_restore_sysnr r10
	get_thread_info tsk
	ldr	r10, [tsk, #TI_IPIPE]
	tst	r10, #_TIP_HEAD
	bne	__ipipe_ret_to_user
	cmp	r0, #0
	bgt	ret_slow_syscall
root_syscall:
	ldmia	sp, { r0 - r3 }
#endif /* CONFIG_IPIPE */

Nicolas Pitre's avatar
Nicolas Pitre committed
365
	ldr	r10, [tsk, #TI_FLAGS]		@ check for syscall tracing
366
	stmdb	sp!, {r4, r5}			@ push fifth and sixth args
Nicolas Pitre's avatar
Nicolas Pitre committed
367

368
	tst	r10, #_TIF_SYSCALL_WORK		@ are we tracing syscalls?
Linus Torvalds's avatar
Linus Torvalds committed
369
370
	bne	__sys_trace

371
	invoke_syscall tbl, scno, r10, __ret_fast_syscall
Linus Torvalds's avatar
Linus Torvalds committed
372
373

	add	r1, sp, #S_OFF
374
2:	cmp	scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
375
	eor	r0, scno, #__NR_SYSCALL_BASE	@ put OS number back
376
	bcs	arm_syscall
377
	mov	why, #0				@ no longer a real syscall
Linus Torvalds's avatar
Linus Torvalds committed
378
	b	sys_ni_syscall			@ not private func
379
380
381
382
383
384
385
386
387
388
389

#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
	/*
	 * We failed to handle a fault trying to access the page
	 * containing the swi instruction, but we're not really in a
	 * position to return -EFAULT. Instead, return back to the
	 * instruction and re-enter the user fault handling path trying
	 * to page it in. This will likely result in sending SEGV to the
	 * current task.
	 */
9001:
390
	sub	lr, saved_pc, #4
391
	str	lr, [sp, #S_PC]
392
	get_thread_info tsk
393
394
	b	ret_fast_syscall
#endif
395
ENDPROC(vector_swi)
Linus Torvalds's avatar
Linus Torvalds committed
396
397
398
399
400
401

	/*
	 * This is the really slow path.  We're going to be doing
	 * context switches, and waiting for our parent to respond.
	 */
__sys_trace:
402
403
404
	mov	r1, scno
	add	r0, sp, #S_OFF
	bl	syscall_trace_enter
405
406
	mov	scno, r0
	invoke_syscall tbl, scno, r10, __sys_trace_return, reload=1
407
408
409
410
	cmp	scno, #-1			@ skip the syscall?
	bne	2b
	add	sp, sp, #S_OFF			@ restore stack
	b	ret_slow_syscall
Linus Torvalds's avatar
Linus Torvalds committed
411
412
413

__sys_trace_return:
	str	r0, [sp, #S_R0 + S_OFF]!	@ save returned r0
414
415
	mov	r0, sp
	bl	syscall_trace_exit
Linus Torvalds's avatar
Linus Torvalds committed
416
417
	b	ret_slow_syscall

Russell King's avatar
Russell King committed
418
__sys_trace_return_nosave:
419
	enable_irq_notrace
Russell King's avatar
Russell King committed
420
421
422
423
	mov	r0, sp
	bl	syscall_trace_exit
	b	ret_slow_syscall

Linus Torvalds's avatar
Linus Torvalds committed
424
425
426
427
428
	.align	5
#ifdef CONFIG_ALIGNMENT_TRAP
	.type	__cr_alignment, #object
__cr_alignment:
	.word	cr_alignment
429
430
431
#endif
	.ltorg

432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
	.macro	syscall_table_start, sym
	.equ	__sys_nr, 0
	.type	\sym, #object
ENTRY(\sym)
	.endm

	.macro	syscall, nr, func
	.ifgt	__sys_nr - \nr
	.error	"Duplicated/unorded system call entry"
	.endif
	.rept	\nr - __sys_nr
	.long	sys_ni_syscall
	.endr
	.long	\func
	.equ	__sys_nr, \nr + 1
	.endm

	.macro	syscall_table_end, sym
	.ifgt	__sys_nr - __NR_syscalls
	.error	"System call table too big"
	.endif
	.rept	__NR_syscalls - __sys_nr
	.long	sys_ni_syscall
	.endr
	.size	\sym, . - \sym
	.endm

#define NATIVE(nr, func) syscall nr, func

461
462
463
464
/*
 * This is the syscall table declaration for native ABI syscalls.
 * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
 */
465
466
	syscall_table_start sys_call_table
#define COMPAT(nr, native, compat) syscall nr, native
467
#ifdef CONFIG_AEABI
468
#include <calls-eabi.S>
469
#else
470
#include <calls-oabi.S>
Linus Torvalds's avatar
Linus Torvalds committed
471
#endif
472
473
#undef COMPAT
	syscall_table_end sys_call_table
Linus Torvalds's avatar
Linus Torvalds committed
474
475
476
477
478

/*============================================================================
 * Special system call wrappers
 */
@ r0 = syscall number
479
@ r8 = syscall table
Linus Torvalds's avatar
Linus Torvalds committed
480
sys_syscall:
481
		bic	scno, r0, #__NR_OABI_SYSCALL_BASE
Linus Torvalds's avatar
Linus Torvalds committed
482
483
		cmp	scno, #__NR_syscall - __NR_SYSCALL_BASE
		cmpne	scno, #NR_syscalls	@ check range
484
485
486
487
#ifdef CONFIG_CPU_SPECTRE
		movhs	scno, #0
		csdb
#endif
Linus Torvalds's avatar
Linus Torvalds committed
488
489
490
491
492
493
494
		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
495
ENDPROC(sys_syscall)
Linus Torvalds's avatar
Linus Torvalds committed
496
497
498

sys_sigreturn_wrapper:
		add	r0, sp, #S_OFF
Al Viro's avatar
Al Viro committed
499
		mov	why, #0		@ prevent syscall restart handling
Linus Torvalds's avatar
Linus Torvalds committed
500
		b	sys_sigreturn
501
ENDPROC(sys_sigreturn_wrapper)
Linus Torvalds's avatar
Linus Torvalds committed
502
503
504

sys_rt_sigreturn_wrapper:
		add	r0, sp, #S_OFF
Al Viro's avatar
Al Viro committed
505
		mov	why, #0		@ prevent syscall restart handling
Linus Torvalds's avatar
Linus Torvalds committed
506
		b	sys_rt_sigreturn
507
ENDPROC(sys_rt_sigreturn_wrapper)
Linus Torvalds's avatar
Linus Torvalds committed
508

509
510
511
512
sys_statfs64_wrapper:
		teq	r1, #88
		moveq	r1, #84
		b	sys_statfs64
513
ENDPROC(sys_statfs64_wrapper)
514
515
516
517
518

sys_fstatfs64_wrapper:
		teq	r1, #88
		moveq	r1, #84
		b	sys_fstatfs64
519
ENDPROC(sys_fstatfs64_wrapper)
520

Linus Torvalds's avatar
Linus Torvalds committed
521
522
523
524
525
526
/*
 * Note: off_4k (r5) is always units of 4K.  If we can't do the requested
 * offset, we return EINVAL.
 */
sys_mmap2:
		str	r5, [sp, #4]
Al Viro's avatar
Al Viro committed
527
		b	sys_mmap_pgoff
528
ENDPROC(sys_mmap2)
529
530

#ifdef CONFIG_OABI_COMPAT
531

532
533
534
535
536
537
538
/*
 * These are syscalls with argument register differences
 */

sys_oabi_pread64:
		stmia	sp, {r3, r4}
		b	sys_pread64
539
ENDPROC(sys_oabi_pread64)
540
541
542
543

sys_oabi_pwrite64:
		stmia	sp, {r3, r4}
		b	sys_pwrite64
544
ENDPROC(sys_oabi_pwrite64)
545
546
547
548
549

sys_oabi_truncate64:
		mov	r3, r2
		mov	r2, r1
		b	sys_truncate64
550
ENDPROC(sys_oabi_truncate64)
551
552
553
554
555

sys_oabi_ftruncate64:
		mov	r3, r2
		mov	r2, r1
		b	sys_ftruncate64
556
ENDPROC(sys_oabi_ftruncate64)
557
558
559
560
561
562

sys_oabi_readahead:
		str	r3, [sp]
		mov	r3, r2
		mov	r2, r1
		b	sys_readahead
563
ENDPROC(sys_oabi_readahead)
564

565
566
567
568
/*
 * Let's declare a second syscall table for old ABI binaries
 * using the compatibility syscall entries.
 */
569
570
571
572
	syscall_table_start sys_oabi_call_table
#define COMPAT(nr, native, compat) syscall nr, compat
#include <calls-oabi.S>
	syscall_table_end sys_oabi_call_table
573

574
575
#endif

576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
#if defined(CONFIG_FRAME_POINTER) && (CONFIG_IPIPE_TRACE)

	.text
	.align 0
	.type arm_return_addr %function
	.global arm_return_addr

arm_return_addr:
	mov	ip, r0
	mov	r0, fp
3:
	cmp	r0, #0
	beq	1f		@ frame list hit end, bail
	cmp	ip, #0
	beq	2f		@ reached desired frame
	ldr	r0, [r0, #-12]  @ else continue, get next fp
	sub	ip, ip, #1
	b	3b
2:
	ldr	r0, [r0, #-4]   @ get target return address
1:
	mov	pc, lr

#endif