4b2010654c463158b7dee80194de736195c04595
[deliverable/linux.git] / arch / mips / kernel / scall64-n32.S
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10 #include <linux/errno.h>
11 #include <asm/asm.h>
12 #include <asm/asmmacro.h>
13 #include <asm/irqflags.h>
14 #include <asm/mipsregs.h>
15 #include <asm/regdef.h>
16 #include <asm/stackframe.h>
17 #include <asm/thread_info.h>
18 #include <asm/unistd.h>
19
20 #ifndef CONFIG_MIPS32_O32
21 /* No O32, so define handle_sys here */
22 #define handle_sysn32 handle_sys
23 #endif
24
25 .align 5
26 NESTED(handle_sysn32, PT_SIZE, sp)
27 #ifndef CONFIG_MIPS32_O32
28 .set noat
29 SAVE_SOME
30 TRACE_IRQS_ON_RELOAD
31 STI
32 .set at
33 #endif
34
35 dsubu t0, v0, __NR_N32_Linux # check syscall number
36 sltiu t0, t0, __NR_N32_Linux_syscalls + 1
37
38 #ifndef CONFIG_MIPS32_O32
39 ld t1, PT_EPC(sp) # skip syscall on return
40 daddiu t1, 4 # skip to next instruction
41 sd t1, PT_EPC(sp)
42 #endif
43 beqz t0, not_n32_scall
44
45 dsll t0, v0, 3 # offset into table
46 ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
47
48 sd a3, PT_R26(sp) # save a3 for syscall restarting
49
50 li t1, _TIF_WORK_SYSCALL_ENTRY
51 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
52 and t0, t1, t0
53 bnez t0, n32_syscall_trace_entry
54
55 jalr t2 # Do The Real Thing (TM)
56
57 li t0, -EMAXERRNO - 1 # error?
58 sltu t0, t0, v0
59 sd t0, PT_R7(sp) # set error flag
60 beqz t0, 1f
61
62 ld t1, PT_R2(sp) # syscall number
63 dnegu v0 # error
64 sd t1, PT_R0(sp) # save it for syscall restarting
65 1: sd v0, PT_R2(sp) # result
66
67 j syscall_exit_partial
68
69 /* ------------------------------------------------------------------------ */
70
71 n32_syscall_trace_entry:
72 SAVE_STATIC
73 move s0, t2
74 move a0, sp
75 move a1, v0
76 jal syscall_trace_enter
77
78 bltz v0, 2f # seccomp failed? Skip syscall
79
80 move t0, s0
81 RESTORE_STATIC
82 ld a0, PT_R4(sp) # Restore argument registers
83 ld a1, PT_R5(sp)
84 ld a2, PT_R6(sp)
85 ld a3, PT_R7(sp)
86 ld a4, PT_R8(sp)
87 ld a5, PT_R9(sp)
88 jalr t0
89
90 li t0, -EMAXERRNO - 1 # error?
91 sltu t0, t0, v0
92 sd t0, PT_R7(sp) # set error flag
93 beqz t0, 1f
94
95 ld t1, PT_R2(sp) # syscall number
96 dnegu v0 # error
97 sd t1, PT_R0(sp) # save it for syscall restarting
98 1: sd v0, PT_R2(sp) # result
99
100 2: j syscall_exit
101
102 not_n32_scall:
103 /* This is not an n32 compatibility syscall, pass it on to
104 the n64 syscall handlers. */
105 j handle_sys64
106
107 END(handle_sysn32)
108
109 .type sysn32_call_table, @object
110 EXPORT(sysn32_call_table)
111 PTR sys_read /* 6000 */
112 PTR sys_write
113 PTR sys_open
114 PTR sys_close
115 PTR sys_newstat
116 PTR sys_newfstat /* 6005 */
117 PTR sys_newlstat
118 PTR sys_poll
119 PTR sys_lseek
120 PTR sys_mips_mmap
121 PTR sys_mprotect /* 6010 */
122 PTR sys_munmap
123 PTR sys_brk
124 PTR compat_sys_rt_sigaction
125 PTR compat_sys_rt_sigprocmask
126 PTR compat_sys_ioctl /* 6015 */
127 PTR sys_pread64
128 PTR sys_pwrite64
129 PTR compat_sys_readv
130 PTR compat_sys_writev
131 PTR sys_access /* 6020 */
132 PTR sysm_pipe
133 PTR compat_sys_select
134 PTR sys_sched_yield
135 PTR sys_mremap
136 PTR sys_msync /* 6025 */
137 PTR sys_mincore
138 PTR sys_madvise
139 PTR sys_shmget
140 PTR sys_shmat
141 PTR compat_sys_shmctl /* 6030 */
142 PTR sys_dup
143 PTR sys_dup2
144 PTR sys_pause
145 PTR compat_sys_nanosleep
146 PTR compat_sys_getitimer /* 6035 */
147 PTR compat_sys_setitimer
148 PTR sys_alarm
149 PTR sys_getpid
150 PTR compat_sys_sendfile
151 PTR sys_socket /* 6040 */
152 PTR sys_connect
153 PTR sys_accept
154 PTR sys_sendto
155 PTR compat_sys_recvfrom
156 PTR compat_sys_sendmsg /* 6045 */
157 PTR compat_sys_recvmsg
158 PTR sys_shutdown
159 PTR sys_bind
160 PTR sys_listen
161 PTR sys_getsockname /* 6050 */
162 PTR sys_getpeername
163 PTR sys_socketpair
164 PTR compat_sys_setsockopt
165 PTR compat_sys_getsockopt
166 PTR __sys_clone /* 6055 */
167 PTR __sys_fork
168 PTR compat_sys_execve
169 PTR sys_exit
170 PTR compat_sys_wait4
171 PTR sys_kill /* 6060 */
172 PTR sys_newuname
173 PTR sys_semget
174 PTR sys_semop
175 PTR compat_sys_semctl
176 PTR sys_shmdt /* 6065 */
177 PTR sys_msgget
178 PTR compat_sys_msgsnd
179 PTR compat_sys_msgrcv
180 PTR compat_sys_msgctl
181 PTR compat_sys_fcntl /* 6070 */
182 PTR sys_flock
183 PTR sys_fsync
184 PTR sys_fdatasync
185 PTR sys_truncate
186 PTR sys_ftruncate /* 6075 */
187 PTR compat_sys_getdents
188 PTR sys_getcwd
189 PTR sys_chdir
190 PTR sys_fchdir
191 PTR sys_rename /* 6080 */
192 PTR sys_mkdir
193 PTR sys_rmdir
194 PTR sys_creat
195 PTR sys_link
196 PTR sys_unlink /* 6085 */
197 PTR sys_symlink
198 PTR sys_readlink
199 PTR sys_chmod
200 PTR sys_fchmod
201 PTR sys_chown /* 6090 */
202 PTR sys_fchown
203 PTR sys_lchown
204 PTR sys_umask
205 PTR compat_sys_gettimeofday
206 PTR compat_sys_getrlimit /* 6095 */
207 PTR compat_sys_getrusage
208 PTR compat_sys_sysinfo
209 PTR compat_sys_times
210 PTR compat_sys_ptrace
211 PTR sys_getuid /* 6100 */
212 PTR sys_syslog
213 PTR sys_getgid
214 PTR sys_setuid
215 PTR sys_setgid
216 PTR sys_geteuid /* 6105 */
217 PTR sys_getegid
218 PTR sys_setpgid
219 PTR sys_getppid
220 PTR sys_getpgrp
221 PTR sys_setsid /* 6110 */
222 PTR sys_setreuid
223 PTR sys_setregid
224 PTR sys_getgroups
225 PTR sys_setgroups
226 PTR sys_setresuid /* 6115 */
227 PTR sys_getresuid
228 PTR sys_setresgid
229 PTR sys_getresgid
230 PTR sys_getpgid
231 PTR sys_setfsuid /* 6120 */
232 PTR sys_setfsgid
233 PTR sys_getsid
234 PTR sys_capget
235 PTR sys_capset
236 PTR compat_sys_rt_sigpending /* 6125 */
237 PTR compat_sys_rt_sigtimedwait
238 PTR compat_sys_rt_sigqueueinfo
239 PTR compat_sys_rt_sigsuspend
240 PTR compat_sys_sigaltstack
241 PTR compat_sys_utime /* 6130 */
242 PTR sys_mknod
243 PTR sys_32_personality
244 PTR compat_sys_ustat
245 PTR compat_sys_statfs
246 PTR compat_sys_fstatfs /* 6135 */
247 PTR sys_sysfs
248 PTR sys_getpriority
249 PTR sys_setpriority
250 PTR sys_sched_setparam
251 PTR sys_sched_getparam /* 6140 */
252 PTR sys_sched_setscheduler
253 PTR sys_sched_getscheduler
254 PTR sys_sched_get_priority_max
255 PTR sys_sched_get_priority_min
256 PTR compat_sys_sched_rr_get_interval /* 6145 */
257 PTR sys_mlock
258 PTR sys_munlock
259 PTR sys_mlockall
260 PTR sys_munlockall
261 PTR sys_vhangup /* 6150 */
262 PTR sys_pivot_root
263 PTR compat_sys_sysctl
264 PTR sys_prctl
265 PTR compat_sys_adjtimex
266 PTR compat_sys_setrlimit /* 6155 */
267 PTR sys_chroot
268 PTR sys_sync
269 PTR sys_acct
270 PTR compat_sys_settimeofday
271 PTR compat_sys_mount /* 6160 */
272 PTR sys_umount
273 PTR sys_swapon
274 PTR sys_swapoff
275 PTR sys_reboot
276 PTR sys_sethostname /* 6165 */
277 PTR sys_setdomainname
278 PTR sys_ni_syscall /* was create_module */
279 PTR sys_init_module
280 PTR sys_delete_module
281 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
282 PTR sys_ni_syscall /* was query_module */
283 PTR sys_quotactl
284 PTR sys_ni_syscall /* was nfsservctl */
285 PTR sys_ni_syscall /* res. for getpmsg */
286 PTR sys_ni_syscall /* 6175 for putpmsg */
287 PTR sys_ni_syscall /* res. for afs_syscall */
288 PTR sys_ni_syscall /* res. for security */
289 PTR sys_gettid
290 PTR sys_readahead
291 PTR sys_setxattr /* 6180 */
292 PTR sys_lsetxattr
293 PTR sys_fsetxattr
294 PTR sys_getxattr
295 PTR sys_lgetxattr
296 PTR sys_fgetxattr /* 6185 */
297 PTR sys_listxattr
298 PTR sys_llistxattr
299 PTR sys_flistxattr
300 PTR sys_removexattr
301 PTR sys_lremovexattr /* 6190 */
302 PTR sys_fremovexattr
303 PTR sys_tkill
304 PTR sys_ni_syscall
305 PTR compat_sys_futex
306 PTR compat_sys_sched_setaffinity /* 6195 */
307 PTR compat_sys_sched_getaffinity
308 PTR sys_cacheflush
309 PTR sys_cachectl
310 PTR sys_sysmips
311 PTR compat_sys_io_setup /* 6200 */
312 PTR sys_io_destroy
313 PTR compat_sys_io_getevents
314 PTR compat_sys_io_submit
315 PTR sys_io_cancel
316 PTR sys_exit_group /* 6205 */
317 PTR sys_lookup_dcookie
318 PTR sys_epoll_create
319 PTR sys_epoll_ctl
320 PTR sys_epoll_wait
321 PTR sys_remap_file_pages /* 6210 */
322 PTR sysn32_rt_sigreturn
323 PTR compat_sys_fcntl64
324 PTR sys_set_tid_address
325 PTR sys_restart_syscall
326 PTR compat_sys_semtimedop /* 6215 */
327 PTR sys_fadvise64_64
328 PTR compat_sys_statfs64
329 PTR compat_sys_fstatfs64
330 PTR sys_sendfile64
331 PTR compat_sys_timer_create /* 6220 */
332 PTR compat_sys_timer_settime
333 PTR compat_sys_timer_gettime
334 PTR sys_timer_getoverrun
335 PTR sys_timer_delete
336 PTR compat_sys_clock_settime /* 6225 */
337 PTR compat_sys_clock_gettime
338 PTR compat_sys_clock_getres
339 PTR compat_sys_clock_nanosleep
340 PTR sys_tgkill
341 PTR compat_sys_utimes /* 6230 */
342 PTR compat_sys_mbind
343 PTR compat_sys_get_mempolicy
344 PTR compat_sys_set_mempolicy
345 PTR compat_sys_mq_open
346 PTR sys_mq_unlink /* 6235 */
347 PTR compat_sys_mq_timedsend
348 PTR compat_sys_mq_timedreceive
349 PTR compat_sys_mq_notify
350 PTR compat_sys_mq_getsetattr
351 PTR sys_ni_syscall /* 6240, sys_vserver */
352 PTR compat_sys_waitid
353 PTR sys_ni_syscall /* available, was setaltroot */
354 PTR sys_add_key
355 PTR sys_request_key
356 PTR sys_keyctl /* 6245 */
357 PTR sys_set_thread_area
358 PTR sys_inotify_init
359 PTR sys_inotify_add_watch
360 PTR sys_inotify_rm_watch
361 PTR compat_sys_migrate_pages /* 6250 */
362 PTR sys_openat
363 PTR sys_mkdirat
364 PTR sys_mknodat
365 PTR sys_fchownat
366 PTR compat_sys_futimesat /* 6255 */
367 PTR sys_newfstatat
368 PTR sys_unlinkat
369 PTR sys_renameat
370 PTR sys_linkat
371 PTR sys_symlinkat /* 6260 */
372 PTR sys_readlinkat
373 PTR sys_fchmodat
374 PTR sys_faccessat
375 PTR compat_sys_pselect6
376 PTR compat_sys_ppoll /* 6265 */
377 PTR sys_unshare
378 PTR sys_splice
379 PTR sys_sync_file_range
380 PTR sys_tee
381 PTR compat_sys_vmsplice /* 6270 */
382 PTR compat_sys_move_pages
383 PTR compat_sys_set_robust_list
384 PTR compat_sys_get_robust_list
385 PTR compat_sys_kexec_load
386 PTR sys_getcpu /* 6275 */
387 PTR compat_sys_epoll_pwait
388 PTR sys_ioprio_set
389 PTR sys_ioprio_get
390 PTR compat_sys_utimensat
391 PTR compat_sys_signalfd /* 6280 */
392 PTR sys_ni_syscall /* was timerfd */
393 PTR sys_eventfd
394 PTR sys_fallocate
395 PTR sys_timerfd_create
396 PTR compat_sys_timerfd_gettime /* 6285 */
397 PTR compat_sys_timerfd_settime
398 PTR compat_sys_signalfd4
399 PTR sys_eventfd2
400 PTR sys_epoll_create1
401 PTR sys_dup3 /* 6290 */
402 PTR sys_pipe2
403 PTR sys_inotify_init1
404 PTR compat_sys_preadv
405 PTR compat_sys_pwritev
406 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
407 PTR sys_perf_event_open
408 PTR sys_accept4
409 PTR compat_sys_recvmmsg
410 PTR sys_getdents64
411 PTR sys_fanotify_init /* 6300 */
412 PTR sys_fanotify_mark
413 PTR sys_prlimit64
414 PTR sys_name_to_handle_at
415 PTR sys_open_by_handle_at
416 PTR compat_sys_clock_adjtime /* 6305 */
417 PTR sys_syncfs
418 PTR compat_sys_sendmmsg
419 PTR sys_setns
420 PTR compat_sys_process_vm_readv
421 PTR compat_sys_process_vm_writev /* 6310 */
422 PTR sys_kcmp
423 PTR sys_finit_module
424 PTR sys_sched_setattr
425 PTR sys_sched_getattr
426 PTR sys_renameat2 /* 6315 */
427 PTR sys_seccomp
428 PTR sys_getrandom
429 PTR sys_memfd_create
430 PTR sys_bpf
431 PTR compat_sys_execveat /* 6320 */
432 .size sysn32_call_table,.-sysn32_call_table
This page took 0.047289 seconds and 5 git commands to generate.