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, 02 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/asm-offsets.h>
18 #include <asm/sysmips.h>
19 #include <asm/thread_info.h>
20 #include <asm/unistd.h>
23 #ifndef CONFIG_BINFMT_ELF32
24 /* Neither O32 nor N32, so define handle_sys here */
25 #define handle_sys64 handle_sys
29 NESTED(handle_sys64, PT_SIZE, sp)
30 #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
32 * When 32-bit compatibility is configured scall_o32.S
42 #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
43 ld t1, PT_EPC(sp) # skip syscall on return
44 daddiu t1, 4 # skip to next instruction
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, syscall_trace_entry
56 dsubu t2, v0, __NR_64_Linux
57 sltiu t0, t2, __NR_64_Linux_syscalls + 1
58 beqz t0, illegal_syscall
60 dsll t0, t2, 3 # offset into table
61 dla t2, sys_call_table
63 ld t2, (t0) # syscall routine
64 beqz t2, illegal_syscall
66 jalr t2 # Do The Real Thing (TM)
68 li t0, -EMAXERRNO - 1 # error?
70 sd t0, PT_R7(sp) # set error flag
73 ld t1, PT_R2(sp) # syscall number
75 sd t1, PT_R0(sp) # save it for syscall restarting
76 1: sd v0, PT_R2(sp) # result
79 j syscall_exit_partial
81 /* ------------------------------------------------------------------------ */
87 jal syscall_trace_enter
89 bltz v0, 1f # seccomp failed? Skip syscall
92 ld v0, PT_R2(sp) # Restore syscall (maybe modified)
93 ld a0, PT_R4(sp) # Restore argument registers
104 /* This also isn't a 64-bit syscall, throw an error. */
105 li v0, ENOSYS # error
107 li t0, 1 # set error flag
113 .type sys_call_table, @object
114 EXPORT(sys_call_table)
115 PTR sys_read /* 5000 */
120 PTR sys_newfstat /* 5005 */
125 PTR sys_mprotect /* 5010 */
129 PTR sys_rt_sigprocmask
130 PTR sys_ioctl /* 5015 */
135 PTR sys_access /* 5020 */
140 PTR sys_msync /* 5025 */
145 PTR sys_shmctl /* 5030 */
150 PTR sys_getitimer /* 5035 */
155 PTR sys_socket /* 5040 */
160 PTR sys_sendmsg /* 5045 */
165 PTR sys_getsockname /* 5050 */
170 PTR __sys_clone /* 5055 */
175 PTR sys_kill /* 5060 */
180 PTR sys_shmdt /* 5065 */
185 PTR sys_fcntl /* 5070 */
190 PTR sys_ftruncate /* 5075 */
195 PTR sys_rename /* 5080 */
200 PTR sys_unlink /* 5085 */
205 PTR sys_chown /* 5090 */
210 PTR sys_getrlimit /* 5095 */
215 PTR sys_getuid /* 5100 */
220 PTR sys_geteuid /* 5105 */
225 PTR sys_setsid /* 5110 */
230 PTR sys_setresuid /* 5115 */
235 PTR sys_setfsuid /* 5120 */
240 PTR sys_rt_sigpending /* 5125 */
241 PTR sys_rt_sigtimedwait
242 PTR sys_rt_sigqueueinfo
243 PTR sys_rt_sigsuspend
245 PTR sys_utime /* 5130 */
250 PTR sys_fstatfs /* 5135 */
254 PTR sys_sched_setparam
255 PTR sys_sched_getparam /* 5140 */
256 PTR sys_sched_setscheduler
257 PTR sys_sched_getscheduler
258 PTR sys_sched_get_priority_max
259 PTR sys_sched_get_priority_min
260 PTR sys_sched_rr_get_interval /* 5145 */
265 PTR sys_vhangup /* 5150 */
270 PTR sys_setrlimit /* 5155 */
275 PTR sys_mount /* 5160 */
280 PTR sys_sethostname /* 5165 */
281 PTR sys_setdomainname
282 PTR sys_ni_syscall /* was create_module */
284 PTR sys_delete_module
285 PTR sys_ni_syscall /* 5170, was get_kernel_syms */
286 PTR sys_ni_syscall /* was query_module */
288 PTR sys_ni_syscall /* was nfsservctl */
289 PTR sys_ni_syscall /* res. for getpmsg */
290 PTR sys_ni_syscall /* 5175 for putpmsg */
291 PTR sys_ni_syscall /* res. for afs_syscall */
292 PTR sys_ni_syscall /* res. for security */
295 PTR sys_setxattr /* 5180 */
300 PTR sys_fgetxattr /* 5185 */
305 PTR sys_lremovexattr /* 5190 */
310 PTR sys_sched_setaffinity /* 5195 */
311 PTR sys_sched_getaffinity
315 PTR sys_io_setup /* 5200 */
320 PTR sys_exit_group /* 5205 */
321 PTR sys_lookup_dcookie
325 PTR sys_remap_file_pages /* 5210 */
327 PTR sys_set_tid_address
328 PTR sys_restart_syscall
330 PTR sys_fadvise64_64 /* 5215 */
332 PTR sys_timer_settime
333 PTR sys_timer_gettime
334 PTR sys_timer_getoverrun
335 PTR sys_timer_delete /* 5220 */
336 PTR sys_clock_settime
337 PTR sys_clock_gettime
339 PTR sys_clock_nanosleep
340 PTR sys_tgkill /* 5225 */
343 PTR sys_get_mempolicy
344 PTR sys_set_mempolicy
345 PTR sys_mq_open /* 5230 */
348 PTR sys_mq_timedreceive
350 PTR sys_mq_getsetattr /* 5235 */
351 PTR sys_ni_syscall /* sys_vserver */
353 PTR sys_ni_syscall /* available, was setaltroot */
355 PTR sys_request_key /* 5240 */
357 PTR sys_set_thread_area
359 PTR sys_inotify_add_watch
360 PTR sys_inotify_rm_watch /* 5245 */
361 PTR sys_migrate_pages
365 PTR sys_fchownat /* 5250 */
370 PTR sys_linkat /* 5255 */
375 PTR sys_pselect6 /* 5260 */
379 PTR sys_sync_file_range
380 PTR sys_tee /* 5265 */
383 PTR sys_set_robust_list
384 PTR sys_get_robust_list
385 PTR sys_kexec_load /* 5270 */
390 PTR sys_utimensat /* 5275 */
392 PTR sys_ni_syscall /* was timerfd */
395 PTR sys_timerfd_create /* 5280 */
396 PTR sys_timerfd_gettime
397 PTR sys_timerfd_settime
400 PTR sys_epoll_create1 /* 5285 */
403 PTR sys_inotify_init1
405 PTR sys_pwritev /* 5290 */
406 PTR sys_rt_tgsigqueueinfo
407 PTR sys_perf_event_open
410 PTR sys_fanotify_init /* 5295 */
411 PTR sys_fanotify_mark
413 PTR sys_name_to_handle_at
414 PTR sys_open_by_handle_at
415 PTR sys_clock_adjtime /* 5300 */
419 PTR sys_process_vm_readv
420 PTR sys_process_vm_writev /* 5305 */
424 PTR sys_sched_setattr
425 PTR sys_sched_getattr /* 5310 */
430 PTR sys_bpf /* 5315 */
435 PTR sys_copy_file_range /* 5320 */
438 PTR sys_pkey_mprotect
440 PTR sys_pkey_free /* 5325 */
442 .size sys_call_table,.-sys_call_table