2 * Compat system call wrappers
4 * Copyright (C) 2012 ARM Ltd.
5 * Authors: Will Deacon <will.deacon@arm.com>
6 * Catalin Marinas <catalin.marinas@arm.com>
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.
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.
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/>.
21 #include <linux/linkage.h>
23 #include <asm/assembler.h>
24 #include <asm/asm-offsets.h>
27 * System call wrappers for the AArch32 compatibility layer.
29 compat_sys_fork_wrapper:
32 ENDPROC(compat_sys_fork_wrapper)
34 compat_sys_vfork_wrapper:
37 ENDPROC(compat_sys_vfork_wrapper)
39 compat_sys_execve_wrapper:
42 ENDPROC(compat_sys_execve_wrapper)
44 compat_sys_clone_wrapper:
47 ENDPROC(compat_sys_clone_wrapper)
49 compat_sys_sigreturn_wrapper:
51 mov x27, #0 // prevent syscall restart handling (why)
52 b compat_sys_sigreturn
53 ENDPROC(compat_sys_sigreturn_wrapper)
55 compat_sys_rt_sigreturn_wrapper:
57 mov x27, #0 // prevent syscall restart handling (why)
58 b compat_sys_rt_sigreturn
59 ENDPROC(compat_sys_rt_sigreturn_wrapper)
61 compat_sys_sigaltstack_wrapper:
62 ldr x2, [sp, #S_COMPAT_SP]
63 b compat_do_sigaltstack
64 ENDPROC(compat_sys_sigaltstack_wrapper)
66 compat_sys_statfs64_wrapper:
71 ENDPROC(compat_sys_statfs64_wrapper)
73 compat_sys_fstatfs64_wrapper:
77 b compat_sys_fstatfs64
78 ENDPROC(compat_sys_fstatfs64_wrapper)
81 * Wrappers for AArch32 syscalls that either take 64-bit parameters
82 * in registers or that take 32-bit parameters which require sign
85 compat_sys_lseek_wrapper:
88 ENDPROC(compat_sys_lseek_wrapper)
90 compat_sys_pread64_wrapper:
91 orr x3, x4, x5, lsl #32
93 ENDPROC(compat_sys_pread64_wrapper)
95 compat_sys_pwrite64_wrapper:
96 orr x3, x4, x5, lsl #32
98 ENDPROC(compat_sys_pwrite64_wrapper)
100 compat_sys_truncate64_wrapper:
101 orr x1, x2, x3, lsl #32
103 ENDPROC(compat_sys_truncate64_wrapper)
105 compat_sys_ftruncate64_wrapper:
106 orr x1, x2, x3, lsl #32
108 ENDPROC(compat_sys_ftruncate64_wrapper)
110 compat_sys_readahead_wrapper:
111 orr x1, x2, x3, lsl #32
114 ENDPROC(compat_sys_readahead_wrapper)
116 compat_sys_lookup_dcookie:
117 orr x0, x0, x1, lsl #32
121 ENDPROC(compat_sys_lookup_dcookie)
123 compat_sys_fadvise64_64_wrapper:
125 orr x1, x2, x3, lsl #32
126 orr x2, x4, x5, lsl #32
129 ENDPROC(compat_sys_fadvise64_64_wrapper)
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)
137 compat_sys_fallocate_wrapper:
138 orr x2, x2, x3, lsl #32
139 orr x3, x4, x5, lsl #32
141 ENDPROC(compat_sys_fallocate_wrapper)
143 compat_sys_fanotify_mark_wrapper:
144 orr x2, x2, x3, lsl #32
148 ENDPROC(compat_sys_fanotify_mark_wrapper)
151 * Use the compat system call wrappers.
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
274 #define __SYSCALL(x, y) .quad y // x
275 #define __SYSCALL_COMPAT
278 * The system calls table must be 4KB aligned.
281 ENTRY(compat_sys_call_table)
282 #include <asm/unistd.h>