entry32.S 3.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Compat system call wrappers
 *
 * Copyright (C) 2012 ARM Ltd.
 * Authors: Will Deacon <will.deacon@arm.com>
 *	    Catalin Marinas <catalin.marinas@arm.com>
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <linux/linkage.h>
22
#include <linux/const.h>
23 24 25

#include <asm/assembler.h>
#include <asm/asm-offsets.h>
26 27
#include <asm/errno.h>
#include <asm/page.h>
28 29 30 31 32

/*
 * System call wrappers for the AArch32 compatibility layer.
 */

33
ENTRY(compat_sys_sigreturn_wrapper)
34 35 36 37
	mov	x0, sp
	b	compat_sys_sigreturn
ENDPROC(compat_sys_sigreturn_wrapper)

38
ENTRY(compat_sys_rt_sigreturn_wrapper)
39 40 41 42
	mov	x0, sp
	b	compat_sys_rt_sigreturn
ENDPROC(compat_sys_rt_sigreturn_wrapper)

43
ENTRY(compat_sys_statfs64_wrapper)
44 45 46 47 48 49
	mov	w3, #84
	cmp	w1, #88
	csel	w1, w3, w1, eq
	b	compat_sys_statfs64
ENDPROC(compat_sys_statfs64_wrapper)

50
ENTRY(compat_sys_fstatfs64_wrapper)
51 52 53 54 55 56
	mov	w3, #84
	cmp	w1, #88
	csel	w1, w3, w1, eq
	b	compat_sys_fstatfs64
ENDPROC(compat_sys_fstatfs64_wrapper)

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
/*
 * Note: off_4k (w5) is always in units of 4K. If we can't do the
 * requested offset because it is not page-aligned, we return -EINVAL.
 */
ENTRY(compat_sys_mmap2_wrapper)
#if PAGE_SHIFT > 12
	tst	w5, #~PAGE_MASK >> 12
	b.ne	1f
	lsr	w5, w5, #PAGE_SHIFT - 12
#endif
	b	sys_mmap_pgoff
1:	mov	x0, #-EINVAL
	ret
ENDPROC(compat_sys_mmap2_wrapper)

72 73 74 75 76
/*
 * Wrappers for AArch32 syscalls that either take 64-bit parameters
 * in registers or that take 32-bit parameters which require sign
 * extension.
 */
77
ENTRY(compat_sys_pread64_wrapper)
78
	regs_to_64	x3, x4, x5
79 80 81
	b	sys_pread64
ENDPROC(compat_sys_pread64_wrapper)

82
ENTRY(compat_sys_pwrite64_wrapper)
83
	regs_to_64	x3, x4, x5
84 85 86
	b	sys_pwrite64
ENDPROC(compat_sys_pwrite64_wrapper)

87
ENTRY(compat_sys_truncate64_wrapper)
88
	regs_to_64	x1, x2, x3
89 90 91
	b	sys_truncate
ENDPROC(compat_sys_truncate64_wrapper)

92
ENTRY(compat_sys_ftruncate64_wrapper)
93
	regs_to_64	x1, x2, x3
94 95 96
	b	sys_ftruncate
ENDPROC(compat_sys_ftruncate64_wrapper)

97
ENTRY(compat_sys_readahead_wrapper)
98
	regs_to_64	x1, x2, x3
99 100 101 102
	mov	w2, w4
	b	sys_readahead
ENDPROC(compat_sys_readahead_wrapper)

103
ENTRY(compat_sys_fadvise64_64_wrapper)
104
	mov	w6, w1
105 106
	regs_to_64	x1, x2, x3
	regs_to_64	x2, x4, x5
107 108 109 110
	mov	w3, w6
	b	sys_fadvise64_64
ENDPROC(compat_sys_fadvise64_64_wrapper)

111
ENTRY(compat_sys_sync_file_range2_wrapper)
112 113
	regs_to_64	x2, x2, x3
	regs_to_64	x3, x4, x5
114 115 116
	b	sys_sync_file_range2
ENDPROC(compat_sys_sync_file_range2_wrapper)

117
ENTRY(compat_sys_fallocate_wrapper)
118 119
	regs_to_64	x2, x2, x3
	regs_to_64	x3, x4, x5
120 121
	b	sys_fallocate
ENDPROC(compat_sys_fallocate_wrapper)