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
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.
10 #include <linux/errno.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>
20 #ifndef CONFIG_MIPS32_O32
21 /* No O32, so define handle_sys here */
22 #define handle_sysn32 handle_sys
26 NESTED(handle_sysn32, PT_SIZE, sp)
27 #ifndef CONFIG_MIPS32_O32
35 dsubu t0, v0, __NR_N32_Linux # check syscall number
36 sltiu t0, t0, __NR_N32_Linux_syscalls + 1
38 #ifndef CONFIG_MIPS32_O32
39 ld t1, PT_EPC(sp) # skip syscall on return
40 daddiu t1, 4 # skip to next instruction
43 beqz t0, not_n32_scall
45 dsll t0, v0, 3 # offset into table
46 ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
48 sd a3, PT_R26(sp) # save a3 for syscall restarting
50 li t1, _TIF_WORK_SYSCALL_ENTRY
51 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
53 bnez t0, n32_syscall_trace_entry
55 jalr t2 # Do The Real Thing (TM)
57 li t0, -EMAXERRNO - 1 # error?
59 sd t0, PT_R7(sp) # set error flag
62 ld t1, PT_R2(sp) # syscall number
64 sd t1, PT_R0(sp) # save it for syscall restarting
65 1: sd v0, PT_R2(sp) # result
67 j syscall_exit_partial
69 /* ------------------------------------------------------------------------ */
71 n32_syscall_trace_entry:
75 daddiu a1, v0, __NR_N32_Linux
76 jal syscall_trace_enter
78 bltz v0, 2f # seccomp failed? Skip syscall
82 ld a0, PT_R4(sp) # Restore argument registers
90 li t0, -EMAXERRNO - 1 # error?
92 sd t0, PT_R7(sp) # set error flag
95 ld t1, PT_R2(sp) # syscall number
97 sd t1, PT_R0(sp) # save it for syscall restarting
98 1: sd v0, PT_R2(sp) # result
103 /* This is not an n32 compatibility syscall, pass it on to
104 the n64 syscall handlers. */
109 .type sysn32_call_table, @object
110 EXPORT(sysn32_call_table)
111 PTR sys_read /* 6000 */
116 PTR sys_newfstat /* 6005 */
121 PTR sys_mprotect /* 6010 */
124 PTR compat_sys_rt_sigaction
125 PTR compat_sys_rt_sigprocmask
126 PTR compat_sys_ioctl /* 6015 */
130 PTR compat_sys_writev
131 PTR sys_access /* 6020 */
133 PTR compat_sys_select
136 PTR sys_msync /* 6025 */
141 PTR compat_sys_shmctl /* 6030 */
145 PTR compat_sys_nanosleep
146 PTR compat_sys_getitimer /* 6035 */
147 PTR compat_sys_setitimer
150 PTR compat_sys_sendfile
151 PTR sys_socket /* 6040 */
155 PTR compat_sys_recvfrom
156 PTR compat_sys_sendmsg /* 6045 */
157 PTR compat_sys_recvmsg
161 PTR sys_getsockname /* 6050 */
164 PTR compat_sys_setsockopt
166 PTR __sys_clone /* 6055 */
168 PTR compat_sys_execve
171 PTR sys_kill /* 6060 */
175 PTR compat_sys_semctl
176 PTR sys_shmdt /* 6065 */
178 PTR compat_sys_msgsnd
179 PTR compat_sys_msgrcv
180 PTR compat_sys_msgctl
181 PTR compat_sys_fcntl /* 6070 */
186 PTR sys_ftruncate /* 6075 */
187 PTR compat_sys_getdents
191 PTR sys_rename /* 6080 */
196 PTR sys_unlink /* 6085 */
201 PTR sys_chown /* 6090 */
205 PTR compat_sys_gettimeofday
206 PTR compat_sys_getrlimit /* 6095 */
207 PTR compat_sys_getrusage
208 PTR compat_sys_sysinfo
210 PTR compat_sys_ptrace
211 PTR sys_getuid /* 6100 */
216 PTR sys_geteuid /* 6105 */
221 PTR sys_setsid /* 6110 */
226 PTR sys_setresuid /* 6115 */
231 PTR sys_setfsuid /* 6120 */
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 */
243 PTR sys_32_personality
245 PTR compat_sys_statfs
246 PTR compat_sys_fstatfs /* 6135 */
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 */
261 PTR sys_vhangup /* 6150 */
263 PTR compat_sys_sysctl
265 PTR compat_sys_adjtimex
266 PTR compat_sys_setrlimit /* 6155 */
270 PTR compat_sys_settimeofday
271 PTR compat_sys_mount /* 6160 */
276 PTR sys_sethostname /* 6165 */
277 PTR sys_setdomainname
278 PTR sys_ni_syscall /* was create_module */
280 PTR sys_delete_module
281 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
282 PTR sys_ni_syscall /* was query_module */
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 */
291 PTR sys_setxattr /* 6180 */
296 PTR sys_fgetxattr /* 6185 */
301 PTR sys_lremovexattr /* 6190 */
306 PTR compat_sys_sched_setaffinity /* 6195 */
307 PTR compat_sys_sched_getaffinity
311 PTR compat_sys_io_setup /* 6200 */
313 PTR compat_sys_io_getevents
314 PTR compat_sys_io_submit
316 PTR sys_exit_group /* 6205 */
317 PTR sys_lookup_dcookie
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 */
328 PTR compat_sys_statfs64
329 PTR compat_sys_fstatfs64
331 PTR compat_sys_timer_create /* 6220 */
332 PTR compat_sys_timer_settime
333 PTR compat_sys_timer_gettime
334 PTR sys_timer_getoverrun
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
341 PTR compat_sys_utimes /* 6230 */
342 PTR sys_ni_syscall /* sys_mbind */
343 PTR sys_ni_syscall /* sys_get_mempolicy */
344 PTR sys_ni_syscall /* 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 */
356 PTR sys_keyctl /* 6245 */
357 PTR sys_set_thread_area
359 PTR sys_inotify_add_watch
360 PTR sys_inotify_rm_watch
361 PTR sys_migrate_pages /* 6250 */
366 PTR compat_sys_futimesat /* 6255 */
371 PTR sys_symlinkat /* 6260 */
375 PTR compat_sys_pselect6
376 PTR compat_sys_ppoll /* 6265 */
379 PTR sys_sync_file_range
381 PTR compat_sys_vmsplice /* 6270 */
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
390 PTR compat_sys_utimensat
391 PTR compat_sys_signalfd /* 6280 */
392 PTR sys_ni_syscall /* was timerfd */
395 PTR sys_timerfd_create
396 PTR compat_sys_timerfd_gettime /* 6285 */
397 PTR compat_sys_timerfd_settime
398 PTR compat_sys_signalfd4
400 PTR sys_epoll_create1
401 PTR sys_dup3 /* 6290 */
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
409 PTR compat_sys_recvmmsg
411 PTR sys_fanotify_init /* 6300 */
412 PTR sys_fanotify_mark
414 PTR sys_name_to_handle_at
415 PTR sys_open_by_handle_at
416 PTR compat_sys_clock_adjtime /* 6305 */
418 PTR compat_sys_sendmmsg
420 PTR compat_sys_process_vm_readv
421 PTR compat_sys_process_vm_writev /* 6310 */
424 PTR sys_sched_setattr
425 PTR sys_sched_getattr
426 .size sysn32_call_table,.-sysn32_call_table