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 sd a3, PT_R26(sp) # save a3 for syscall restarting
47 li t1, _TIF_WORK_SYSCALL_ENTRY
48 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
50 bnez t0, n32_syscall_trace_entry
53 dsll t0, v0, 3 # offset into table
54 ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
56 jalr t2 # Do The Real Thing (TM)
58 li t0, -EMAXERRNO - 1 # error?
60 sd t0, PT_R7(sp) # set error flag
63 ld t1, PT_R2(sp) # syscall number
65 sd t1, PT_R0(sp) # save it for syscall restarting
66 1: sd v0, PT_R2(sp) # result
68 j syscall_exit_partial
70 /* ------------------------------------------------------------------------ */
72 n32_syscall_trace_entry:
76 jal syscall_trace_enter
78 bltz v0, 1f # seccomp failed? Skip syscall
81 ld v0, PT_R2(sp) # Restore syscall (maybe modified)
82 ld a0, PT_R4(sp) # Restore argument registers
89 dsubu t2, v0, __NR_N32_Linux # check (new) syscall number
90 sltiu t0, t2, __NR_N32_Linux_syscalls + 1
91 beqz t0, not_n32_scall
98 /* This is not an n32 compatibility syscall, pass it on to
99 the n64 syscall handlers. */
104 .type sysn32_call_table, @object
105 EXPORT(sysn32_call_table)
106 PTR sys_read /* 6000 */
111 PTR sys_newfstat /* 6005 */
116 PTR sys_mprotect /* 6010 */
119 PTR compat_sys_rt_sigaction
120 PTR compat_sys_rt_sigprocmask
121 PTR compat_sys_ioctl /* 6015 */
125 PTR compat_sys_writev
126 PTR sys_access /* 6020 */
128 PTR compat_sys_select
131 PTR sys_msync /* 6025 */
136 PTR compat_sys_shmctl /* 6030 */
140 PTR compat_sys_nanosleep
141 PTR compat_sys_getitimer /* 6035 */
142 PTR compat_sys_setitimer
145 PTR compat_sys_sendfile
146 PTR sys_socket /* 6040 */
150 PTR compat_sys_recvfrom
151 PTR compat_sys_sendmsg /* 6045 */
152 PTR compat_sys_recvmsg
156 PTR sys_getsockname /* 6050 */
159 PTR compat_sys_setsockopt
160 PTR compat_sys_getsockopt
161 PTR __sys_clone /* 6055 */
163 PTR compat_sys_execve
166 PTR sys_kill /* 6060 */
170 PTR compat_sys_semctl
171 PTR sys_shmdt /* 6065 */
173 PTR compat_sys_msgsnd
174 PTR compat_sys_msgrcv
175 PTR compat_sys_msgctl
176 PTR compat_sys_fcntl /* 6070 */
181 PTR sys_ftruncate /* 6075 */
182 PTR compat_sys_getdents
186 PTR sys_rename /* 6080 */
191 PTR sys_unlink /* 6085 */
196 PTR sys_chown /* 6090 */
200 PTR compat_sys_gettimeofday
201 PTR compat_sys_getrlimit /* 6095 */
202 PTR compat_sys_getrusage
203 PTR compat_sys_sysinfo
205 PTR compat_sys_ptrace
206 PTR sys_getuid /* 6100 */
211 PTR sys_geteuid /* 6105 */
216 PTR sys_setsid /* 6110 */
221 PTR sys_setresuid /* 6115 */
226 PTR sys_setfsuid /* 6120 */
231 PTR compat_sys_rt_sigpending /* 6125 */
232 PTR compat_sys_rt_sigtimedwait
233 PTR compat_sys_rt_sigqueueinfo
234 PTR compat_sys_rt_sigsuspend
235 PTR compat_sys_sigaltstack
236 PTR compat_sys_utime /* 6130 */
238 PTR sys_32_personality
240 PTR compat_sys_statfs
241 PTR compat_sys_fstatfs /* 6135 */
245 PTR sys_sched_setparam
246 PTR sys_sched_getparam /* 6140 */
247 PTR sys_sched_setscheduler
248 PTR sys_sched_getscheduler
249 PTR sys_sched_get_priority_max
250 PTR sys_sched_get_priority_min
251 PTR compat_sys_sched_rr_get_interval /* 6145 */
256 PTR sys_vhangup /* 6150 */
258 PTR compat_sys_sysctl
260 PTR compat_sys_adjtimex
261 PTR compat_sys_setrlimit /* 6155 */
265 PTR compat_sys_settimeofday
266 PTR compat_sys_mount /* 6160 */
271 PTR sys_sethostname /* 6165 */
272 PTR sys_setdomainname
273 PTR sys_ni_syscall /* was create_module */
275 PTR sys_delete_module
276 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
277 PTR sys_ni_syscall /* was query_module */
279 PTR sys_ni_syscall /* was nfsservctl */
280 PTR sys_ni_syscall /* res. for getpmsg */
281 PTR sys_ni_syscall /* 6175 for putpmsg */
282 PTR sys_ni_syscall /* res. for afs_syscall */
283 PTR sys_ni_syscall /* res. for security */
286 PTR sys_setxattr /* 6180 */
291 PTR sys_fgetxattr /* 6185 */
296 PTR sys_lremovexattr /* 6190 */
301 PTR compat_sys_sched_setaffinity /* 6195 */
302 PTR compat_sys_sched_getaffinity
306 PTR compat_sys_io_setup /* 6200 */
308 PTR compat_sys_io_getevents
309 PTR compat_sys_io_submit
311 PTR sys_exit_group /* 6205 */
312 PTR sys_lookup_dcookie
316 PTR sys_remap_file_pages /* 6210 */
317 PTR sysn32_rt_sigreturn
318 PTR compat_sys_fcntl64
319 PTR sys_set_tid_address
320 PTR sys_restart_syscall
321 PTR compat_sys_semtimedop /* 6215 */
323 PTR compat_sys_statfs64
324 PTR compat_sys_fstatfs64
326 PTR compat_sys_timer_create /* 6220 */
327 PTR compat_sys_timer_settime
328 PTR compat_sys_timer_gettime
329 PTR sys_timer_getoverrun
331 PTR compat_sys_clock_settime /* 6225 */
332 PTR compat_sys_clock_gettime
333 PTR compat_sys_clock_getres
334 PTR compat_sys_clock_nanosleep
336 PTR compat_sys_utimes /* 6230 */
338 PTR compat_sys_get_mempolicy
339 PTR compat_sys_set_mempolicy
340 PTR compat_sys_mq_open
341 PTR sys_mq_unlink /* 6235 */
342 PTR compat_sys_mq_timedsend
343 PTR compat_sys_mq_timedreceive
344 PTR compat_sys_mq_notify
345 PTR compat_sys_mq_getsetattr
346 PTR sys_ni_syscall /* 6240, sys_vserver */
347 PTR compat_sys_waitid
348 PTR sys_ni_syscall /* available, was setaltroot */
351 PTR compat_sys_keyctl /* 6245 */
352 PTR sys_set_thread_area
354 PTR sys_inotify_add_watch
355 PTR sys_inotify_rm_watch
356 PTR compat_sys_migrate_pages /* 6250 */
361 PTR compat_sys_futimesat /* 6255 */
366 PTR sys_symlinkat /* 6260 */
370 PTR compat_sys_pselect6
371 PTR compat_sys_ppoll /* 6265 */
374 PTR sys_sync_file_range
376 PTR compat_sys_vmsplice /* 6270 */
377 PTR compat_sys_move_pages
378 PTR compat_sys_set_robust_list
379 PTR compat_sys_get_robust_list
380 PTR compat_sys_kexec_load
381 PTR sys_getcpu /* 6275 */
382 PTR compat_sys_epoll_pwait
385 PTR compat_sys_utimensat
386 PTR compat_sys_signalfd /* 6280 */
387 PTR sys_ni_syscall /* was timerfd */
390 PTR sys_timerfd_create
391 PTR compat_sys_timerfd_gettime /* 6285 */
392 PTR compat_sys_timerfd_settime
393 PTR compat_sys_signalfd4
395 PTR sys_epoll_create1
396 PTR sys_dup3 /* 6290 */
398 PTR sys_inotify_init1
399 PTR compat_sys_preadv
400 PTR compat_sys_pwritev
401 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
402 PTR sys_perf_event_open
404 PTR compat_sys_recvmmsg
406 PTR sys_fanotify_init /* 6300 */
407 PTR sys_fanotify_mark
409 PTR sys_name_to_handle_at
410 PTR sys_open_by_handle_at
411 PTR compat_sys_clock_adjtime /* 6305 */
413 PTR compat_sys_sendmmsg
415 PTR compat_sys_process_vm_readv
416 PTR compat_sys_process_vm_writev /* 6310 */
419 PTR sys_sched_setattr
420 PTR sys_sched_getattr
421 PTR sys_renameat2 /* 6315 */
426 PTR compat_sys_execveat /* 6320 */
430 PTR sys_copy_file_range
431 PTR compat_sys_preadv2 /* 6325 */
432 PTR compat_sys_pwritev2
433 PTR sys_pkey_mprotect
436 PTR sys_statx /* 6330 */
437 .size sysn32_call_table,.-sysn32_call_table