blob: 7ef59e9245effa59f360c097bcdd300fa2e0e334 [file] [log] [blame]
Will Deacon3dd681d2012-03-05 11:49:32 +00001/*
2 * Compat system call wrappers
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Authors: Will Deacon <will.deacon@arm.com>
6 * Catalin Marinas <catalin.marinas@arm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <linux/linkage.h>
22
23#include <asm/assembler.h>
24#include <asm/asm-offsets.h>
25
26/*
27 * System call wrappers for the AArch32 compatibility layer.
28 */
Will Deacon3dd681d2012-03-05 11:49:32 +000029
30compat_sys_sigreturn_wrapper:
31 mov x0, sp
32 mov x27, #0 // prevent syscall restart handling (why)
33 b compat_sys_sigreturn
34ENDPROC(compat_sys_sigreturn_wrapper)
35
36compat_sys_rt_sigreturn_wrapper:
37 mov x0, sp
38 mov x27, #0 // prevent syscall restart handling (why)
39 b compat_sys_rt_sigreturn
40ENDPROC(compat_sys_rt_sigreturn_wrapper)
41
42compat_sys_sigaltstack_wrapper:
43 ldr x2, [sp, #S_COMPAT_SP]
44 b compat_do_sigaltstack
45ENDPROC(compat_sys_sigaltstack_wrapper)
46
47compat_sys_statfs64_wrapper:
48 mov w3, #84
49 cmp w1, #88
50 csel w1, w3, w1, eq
51 b compat_sys_statfs64
52ENDPROC(compat_sys_statfs64_wrapper)
53
54compat_sys_fstatfs64_wrapper:
55 mov w3, #84
56 cmp w1, #88
57 csel w1, w3, w1, eq
58 b compat_sys_fstatfs64
59ENDPROC(compat_sys_fstatfs64_wrapper)
60
61/*
62 * Wrappers for AArch32 syscalls that either take 64-bit parameters
63 * in registers or that take 32-bit parameters which require sign
64 * extension.
65 */
66compat_sys_lseek_wrapper:
67 sxtw x1, w1
68 b sys_lseek
69ENDPROC(compat_sys_lseek_wrapper)
70
71compat_sys_pread64_wrapper:
72 orr x3, x4, x5, lsl #32
73 b sys_pread64
74ENDPROC(compat_sys_pread64_wrapper)
75
76compat_sys_pwrite64_wrapper:
77 orr x3, x4, x5, lsl #32
78 b sys_pwrite64
79ENDPROC(compat_sys_pwrite64_wrapper)
80
81compat_sys_truncate64_wrapper:
82 orr x1, x2, x3, lsl #32
83 b sys_truncate
84ENDPROC(compat_sys_truncate64_wrapper)
85
86compat_sys_ftruncate64_wrapper:
87 orr x1, x2, x3, lsl #32
88 b sys_ftruncate
89ENDPROC(compat_sys_ftruncate64_wrapper)
90
91compat_sys_readahead_wrapper:
92 orr x1, x2, x3, lsl #32
93 mov w2, w4
94 b sys_readahead
95ENDPROC(compat_sys_readahead_wrapper)
96
97compat_sys_lookup_dcookie:
98 orr x0, x0, x1, lsl #32
99 mov w1, w2
100 mov w2, w3
101 b sys_lookup_dcookie
102ENDPROC(compat_sys_lookup_dcookie)
103
104compat_sys_fadvise64_64_wrapper:
105 mov w6, w1
106 orr x1, x2, x3, lsl #32
107 orr x2, x4, x5, lsl #32
108 mov w3, w6
109 b sys_fadvise64_64
110ENDPROC(compat_sys_fadvise64_64_wrapper)
111
112compat_sys_sync_file_range2_wrapper:
113 orr x2, x2, x3, lsl #32
114 orr x3, x4, x5, lsl #32
115 b sys_sync_file_range2
116ENDPROC(compat_sys_sync_file_range2_wrapper)
117
118compat_sys_fallocate_wrapper:
119 orr x2, x2, x3, lsl #32
120 orr x3, x4, x5, lsl #32
121 b sys_fallocate
122ENDPROC(compat_sys_fallocate_wrapper)
123
124compat_sys_fanotify_mark_wrapper:
125 orr x2, x2, x3, lsl #32
126 mov w3, w4
127 mov w4, w5
128 b sys_fanotify_mark
129ENDPROC(compat_sys_fanotify_mark_wrapper)
130
Will Deacon3dd681d2012-03-05 11:49:32 +0000131#undef __SYSCALL
132#define __SYSCALL(x, y) .quad y // x
Will Deacon3dd681d2012-03-05 11:49:32 +0000133
134/*
135 * The system calls table must be 4KB aligned.
136 */
137 .align 12
138ENTRY(compat_sys_call_table)
Catalin Marinasf3d447a2012-10-10 15:27:04 +0100139#include <asm/unistd32.h>