Commit | Line | Data |
---|---|---|
3dd681d9 WD |
1 | /* |
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 | */ | |
29 | compat_sys_fork_wrapper: | |
30 | mov x0, sp | |
31 | b compat_sys_fork | |
32 | ENDPROC(compat_sys_fork_wrapper) | |
33 | ||
34 | compat_sys_vfork_wrapper: | |
35 | mov x0, sp | |
36 | b compat_sys_vfork | |
37 | ENDPROC(compat_sys_vfork_wrapper) | |
38 | ||
39 | compat_sys_execve_wrapper: | |
40 | mov x3, sp | |
41 | b compat_sys_execve | |
42 | ENDPROC(compat_sys_execve_wrapper) | |
43 | ||
44 | compat_sys_clone_wrapper: | |
45 | mov x5, sp | |
46 | b compat_sys_clone | |
47 | ENDPROC(compat_sys_clone_wrapper) | |
48 | ||
49 | compat_sys_sigreturn_wrapper: | |
50 | mov x0, sp | |
51 | mov x27, #0 // prevent syscall restart handling (why) | |
52 | b compat_sys_sigreturn | |
53 | ENDPROC(compat_sys_sigreturn_wrapper) | |
54 | ||
55 | compat_sys_rt_sigreturn_wrapper: | |
56 | mov x0, sp | |
57 | mov x27, #0 // prevent syscall restart handling (why) | |
58 | b compat_sys_rt_sigreturn | |
59 | ENDPROC(compat_sys_rt_sigreturn_wrapper) | |
60 | ||
61 | compat_sys_sigaltstack_wrapper: | |
62 | ldr x2, [sp, #S_COMPAT_SP] | |
63 | b compat_do_sigaltstack | |
64 | ENDPROC(compat_sys_sigaltstack_wrapper) | |
65 | ||
66 | compat_sys_statfs64_wrapper: | |
67 | mov w3, #84 | |
68 | cmp w1, #88 | |
69 | csel w1, w3, w1, eq | |
70 | b compat_sys_statfs64 | |
71 | ENDPROC(compat_sys_statfs64_wrapper) | |
72 | ||
73 | compat_sys_fstatfs64_wrapper: | |
74 | mov w3, #84 | |
75 | cmp w1, #88 | |
76 | csel w1, w3, w1, eq | |
77 | b compat_sys_fstatfs64 | |
78 | ENDPROC(compat_sys_fstatfs64_wrapper) | |
79 | ||
80 | /* | |
81 | * Wrappers for AArch32 syscalls that either take 64-bit parameters | |
82 | * in registers or that take 32-bit parameters which require sign | |
83 | * extension. | |
84 | */ | |
85 | compat_sys_lseek_wrapper: | |
86 | sxtw x1, w1 | |
87 | b sys_lseek | |
88 | ENDPROC(compat_sys_lseek_wrapper) | |
89 | ||
90 | compat_sys_pread64_wrapper: | |
91 | orr x3, x4, x5, lsl #32 | |
92 | b sys_pread64 | |
93 | ENDPROC(compat_sys_pread64_wrapper) | |
94 | ||
95 | compat_sys_pwrite64_wrapper: | |
96 | orr x3, x4, x5, lsl #32 | |
97 | b sys_pwrite64 | |
98 | ENDPROC(compat_sys_pwrite64_wrapper) | |
99 | ||
100 | compat_sys_truncate64_wrapper: | |
101 | orr x1, x2, x3, lsl #32 | |
102 | b sys_truncate | |
103 | ENDPROC(compat_sys_truncate64_wrapper) | |
104 | ||
105 | compat_sys_ftruncate64_wrapper: | |
106 | orr x1, x2, x3, lsl #32 | |
107 | b sys_ftruncate | |
108 | ENDPROC(compat_sys_ftruncate64_wrapper) | |
109 | ||
110 | compat_sys_readahead_wrapper: | |
111 | orr x1, x2, x3, lsl #32 | |
112 | mov w2, w4 | |
113 | b sys_readahead | |
114 | ENDPROC(compat_sys_readahead_wrapper) | |
115 | ||
116 | compat_sys_lookup_dcookie: | |
117 | orr x0, x0, x1, lsl #32 | |
118 | mov w1, w2 | |
119 | mov w2, w3 | |
120 | b sys_lookup_dcookie | |
121 | ENDPROC(compat_sys_lookup_dcookie) | |
122 | ||
123 | compat_sys_fadvise64_64_wrapper: | |
124 | mov w6, w1 | |
125 | orr x1, x2, x3, lsl #32 | |
126 | orr x2, x4, x5, lsl #32 | |
127 | mov w3, w6 | |
128 | b sys_fadvise64_64 | |
129 | ENDPROC(compat_sys_fadvise64_64_wrapper) | |
130 | ||
131 | compat_sys_sync_file_range2_wrapper: | |
132 | orr x2, x2, x3, lsl #32 | |
133 | orr x3, x4, x5, lsl #32 | |
134 | b sys_sync_file_range2 | |
135 | ENDPROC(compat_sys_sync_file_range2_wrapper) | |
136 | ||
137 | compat_sys_fallocate_wrapper: | |
138 | orr x2, x2, x3, lsl #32 | |
139 | orr x3, x4, x5, lsl #32 | |
140 | b sys_fallocate | |
141 | ENDPROC(compat_sys_fallocate_wrapper) | |
142 | ||
143 | compat_sys_fanotify_mark_wrapper: | |
144 | orr x2, x2, x3, lsl #32 | |
145 | mov w3, w4 | |
146 | mov w4, w5 | |
147 | b sys_fanotify_mark | |
148 | ENDPROC(compat_sys_fanotify_mark_wrapper) | |
149 | ||
150 | /* | |
151 | * Use the compat system call wrappers. | |
152 | */ | |
153 | #define sys_fork compat_sys_fork_wrapper | |
154 | #define sys_open compat_sys_open | |
155 | #define sys_execve compat_sys_execve_wrapper | |
156 | #define sys_lseek compat_sys_lseek_wrapper | |
157 | #define sys_mount compat_sys_mount | |
158 | #define sys_ptrace compat_sys_ptrace | |
159 | #define sys_times compat_sys_times | |
160 | #define sys_ioctl compat_sys_ioctl | |
161 | #define sys_fcntl compat_sys_fcntl | |
162 | #define sys_ustat compat_sys_ustat | |
163 | #define sys_sigaction compat_sys_sigaction | |
164 | #define sys_sigsuspend compat_sys_sigsuspend | |
165 | #define sys_sigpending compat_sys_sigpending | |
166 | #define sys_setrlimit compat_sys_setrlimit | |
167 | #define sys_getrusage compat_sys_getrusage | |
168 | #define sys_gettimeofday compat_sys_gettimeofday | |
169 | #define sys_settimeofday compat_sys_settimeofday | |
170 | #define sys_statfs compat_sys_statfs | |
171 | #define sys_fstatfs compat_sys_fstatfs | |
172 | #define sys_setitimer compat_sys_setitimer | |
173 | #define sys_getitimer compat_sys_getitimer | |
174 | #define sys_newstat compat_sys_newstat | |
175 | #define sys_newlstat compat_sys_newlstat | |
176 | #define sys_newfstat compat_sys_newfstat | |
177 | #define sys_wait4 compat_sys_wait4 | |
178 | #define sys_sysinfo compat_sys_sysinfo | |
179 | #define sys_sigreturn compat_sys_sigreturn_wrapper | |
180 | #define sys_clone compat_sys_clone_wrapper | |
181 | #define sys_adjtimex compat_sys_adjtimex | |
182 | #define sys_sigprocmask compat_sys_sigprocmask | |
183 | #define sys_getdents compat_sys_getdents | |
184 | #define sys_select compat_sys_select | |
185 | #define sys_readv compat_sys_readv | |
186 | #define sys_writev compat_sys_writev | |
187 | #define sys_sysctl compat_sys_sysctl | |
188 | #define sys_sched_rr_get_interval compat_sys_sched_rr_get_interval | |
189 | #define sys_nanosleep compat_sys_nanosleep | |
190 | #define sys_rt_sigreturn compat_sys_rt_sigreturn_wrapper | |
191 | #define sys_rt_sigaction compat_sys_rt_sigaction | |
192 | #define sys_rt_sigprocmask compat_sys_rt_sigprocmask | |
193 | #define sys_rt_sigpending compat_sys_rt_sigpending | |
194 | #define sys_rt_sigtimedwait compat_sys_rt_sigtimedwait | |
195 | #define sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo | |
196 | #define sys_rt_sigsuspend compat_sys_rt_sigsuspend | |
197 | #define sys_pread64 compat_sys_pread64_wrapper | |
198 | #define sys_pwrite64 compat_sys_pwrite64_wrapper | |
199 | #define sys_sigaltstack compat_sys_sigaltstack_wrapper | |
200 | #define sys_sendfile compat_sys_sendfile | |
201 | #define sys_vfork compat_sys_vfork_wrapper | |
202 | #define sys_getrlimit compat_sys_getrlimit | |
203 | #define sys_mmap2 sys_mmap_pgoff | |
204 | #define sys_truncate64 compat_sys_truncate64_wrapper | |
205 | #define sys_ftruncate64 compat_sys_ftruncate64_wrapper | |
206 | #define sys_getdents64 compat_sys_getdents64 | |
207 | #define sys_fcntl64 compat_sys_fcntl64 | |
208 | #define sys_readahead compat_sys_readahead_wrapper | |
209 | #define sys_futex compat_sys_futex | |
210 | #define sys_sched_setaffinity compat_sys_sched_setaffinity | |
211 | #define sys_sched_getaffinity compat_sys_sched_getaffinity | |
212 | #define sys_io_setup compat_sys_io_setup | |
213 | #define sys_io_getevents compat_sys_io_getevents | |
214 | #define sys_io_submit compat_sys_io_submit | |
215 | #define sys_lookup_dcookie compat_sys_lookup_dcookie | |
216 | #define sys_timer_create compat_sys_timer_create | |
217 | #define sys_timer_settime compat_sys_timer_settime | |
218 | #define sys_timer_gettime compat_sys_timer_gettime | |
219 | #define sys_clock_settime compat_sys_clock_settime | |
220 | #define sys_clock_gettime compat_sys_clock_gettime | |
221 | #define sys_clock_getres compat_sys_clock_getres | |
222 | #define sys_clock_nanosleep compat_sys_clock_nanosleep | |
223 | #define sys_statfs64 compat_sys_statfs64_wrapper | |
224 | #define sys_fstatfs64 compat_sys_fstatfs64_wrapper | |
225 | #define sys_utimes compat_sys_utimes | |
226 | #define sys_fadvise64_64 compat_sys_fadvise64_64_wrapper | |
227 | #define sys_mq_open compat_sys_mq_open | |
228 | #define sys_mq_timedsend compat_sys_mq_timedsend | |
229 | #define sys_mq_timedreceive compat_sys_mq_timedreceive | |
230 | #define sys_mq_notify compat_sys_mq_notify | |
231 | #define sys_mq_getsetattr compat_sys_mq_getsetattr | |
232 | #define sys_waitid compat_sys_waitid | |
233 | #define sys_recv compat_sys_recv | |
234 | #define sys_recvfrom compat_sys_recvfrom | |
235 | #define sys_setsockopt compat_sys_setsockopt | |
236 | #define sys_getsockopt compat_sys_getsockopt | |
237 | #define sys_sendmsg compat_sys_sendmsg | |
238 | #define sys_recvmsg compat_sys_recvmsg | |
239 | #define sys_semctl compat_sys_semctl | |
240 | #define sys_msgsnd compat_sys_msgsnd | |
241 | #define sys_msgrcv compat_sys_msgrcv | |
242 | #define sys_msgctl compat_sys_msgctl | |
243 | #define sys_shmat compat_sys_shmat | |
244 | #define sys_shmctl compat_sys_shmctl | |
245 | #define sys_keyctl compat_sys_keyctl | |
246 | #define sys_semtimedop compat_sys_semtimedop | |
247 | #define sys_mbind compat_sys_mbind | |
248 | #define sys_get_mempolicy compat_sys_get_mempolicy | |
249 | #define sys_set_mempolicy compat_sys_set_mempolicy | |
250 | #define sys_openat compat_sys_openat | |
251 | #define sys_futimesat compat_sys_futimesat | |
252 | #define sys_pselect6 compat_sys_pselect6 | |
253 | #define sys_ppoll compat_sys_ppoll | |
254 | #define sys_set_robust_list compat_sys_set_robust_list | |
255 | #define sys_get_robust_list compat_sys_get_robust_list | |
256 | #define sys_sync_file_range2 compat_sys_sync_file_range2_wrapper | |
257 | #define sys_vmsplice compat_sys_vmsplice | |
258 | #define sys_move_pages compat_sys_move_pages | |
259 | #define sys_epoll_pwait compat_sys_epoll_pwait | |
260 | #define sys_kexec_load compat_sys_kexec_load | |
261 | #define sys_utimensat compat_sys_utimensat | |
262 | #define sys_signalfd compat_sys_signalfd | |
263 | #define sys_fallocate compat_sys_fallocate_wrapper | |
264 | #define sys_timerfd_settime compat_sys_timerfd_settime | |
265 | #define sys_timerfd_gettime compat_sys_timerfd_gettime | |
266 | #define sys_signalfd4 compat_sys_signalfd4 | |
267 | #define sys_preadv compat_sys_preadv | |
268 | #define sys_pwritev compat_sys_pwritev | |
269 | #define sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo | |
270 | #define sys_recvmmsg compat_sys_recvmmsg | |
271 | #define sys_fanotify_mark compat_sys_fanotify_mark_wrapper | |
272 | ||
273 | #undef __SYSCALL | |
274 | #define __SYSCALL(x, y) .quad y // x | |
275 | #define __SYSCALL_COMPAT | |
276 | ||
277 | /* | |
278 | * The system calls table must be 4KB aligned. | |
279 | */ | |
280 | .align 12 | |
281 | ENTRY(compat_sys_call_table) | |
282 | #include <asm/unistd.h> |