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 jal syscall_trace_enter
79 ld a0, PT_R4(sp) # Restore argument registers
87 li t0, -EMAXERRNO - 1 # error?
89 sd t0, PT_R7(sp) # set error flag
92 ld t1, PT_R2(sp) # syscall number
94 sd t1, PT_R0(sp) # save it for syscall restarting
95 1: sd v0, PT_R2(sp) # result
100 /* This is not an n32 compatibility syscall, pass it on to
101 the n64 syscall handlers. */
106 .type sysn32_call_table, @object
107 EXPORT(sysn32_call_table)
108 PTR sys_read /* 6000 */
113 PTR sys_newfstat /* 6005 */
118 PTR sys_mprotect /* 6010 */
121 PTR compat_sys_rt_sigaction
122 PTR compat_sys_rt_sigprocmask
123 PTR compat_sys_ioctl /* 6015 */
127 PTR compat_sys_writev
128 PTR sys_access /* 6020 */
130 PTR compat_sys_select
133 PTR sys_msync /* 6025 */
138 PTR compat_sys_shmctl /* 6030 */
142 PTR compat_sys_nanosleep
143 PTR compat_sys_getitimer /* 6035 */
144 PTR compat_sys_setitimer
147 PTR compat_sys_sendfile
148 PTR sys_socket /* 6040 */
152 PTR compat_sys_recvfrom
153 PTR compat_sys_sendmsg /* 6045 */
154 PTR compat_sys_recvmsg
158 PTR sys_getsockname /* 6050 */
161 PTR compat_sys_setsockopt
163 PTR __sys_clone /* 6055 */
165 PTR compat_sys_execve
168 PTR sys_kill /* 6060 */
172 PTR compat_sys_semctl
173 PTR sys_shmdt /* 6065 */
175 PTR compat_sys_msgsnd
176 PTR compat_sys_msgrcv
177 PTR compat_sys_msgctl
178 PTR compat_sys_fcntl /* 6070 */
183 PTR sys_ftruncate /* 6075 */
184 PTR compat_sys_getdents
188 PTR sys_rename /* 6080 */
193 PTR sys_unlink /* 6085 */
198 PTR sys_chown /* 6090 */
202 PTR compat_sys_gettimeofday
203 PTR compat_sys_getrlimit /* 6095 */
204 PTR compat_sys_getrusage
205 PTR compat_sys_sysinfo
207 PTR compat_sys_ptrace
208 PTR sys_getuid /* 6100 */
213 PTR sys_geteuid /* 6105 */
218 PTR sys_setsid /* 6110 */
223 PTR sys_setresuid /* 6115 */
228 PTR sys_setfsuid /* 6120 */
233 PTR compat_sys_rt_sigpending /* 6125 */
234 PTR compat_sys_rt_sigtimedwait
235 PTR compat_sys_rt_sigqueueinfo
236 PTR compat_sys_rt_sigsuspend
237 PTR compat_sys_sigaltstack
238 PTR compat_sys_utime /* 6130 */
240 PTR sys_32_personality
242 PTR compat_sys_statfs
243 PTR compat_sys_fstatfs /* 6135 */
247 PTR sys_sched_setparam
248 PTR sys_sched_getparam /* 6140 */
249 PTR sys_sched_setscheduler
250 PTR sys_sched_getscheduler
251 PTR sys_sched_get_priority_max
252 PTR sys_sched_get_priority_min
253 PTR compat_sys_sched_rr_get_interval /* 6145 */
258 PTR sys_vhangup /* 6150 */
260 PTR compat_sys_sysctl
262 PTR compat_sys_adjtimex
263 PTR compat_sys_setrlimit /* 6155 */
267 PTR compat_sys_settimeofday
268 PTR compat_sys_mount /* 6160 */
273 PTR sys_sethostname /* 6165 */
274 PTR sys_setdomainname
275 PTR sys_ni_syscall /* was create_module */
277 PTR sys_delete_module
278 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
279 PTR sys_ni_syscall /* was query_module */
281 PTR sys_ni_syscall /* was nfsservctl */
282 PTR sys_ni_syscall /* res. for getpmsg */
283 PTR sys_ni_syscall /* 6175 for putpmsg */
284 PTR sys_ni_syscall /* res. for afs_syscall */
285 PTR sys_ni_syscall /* res. for security */
288 PTR sys_setxattr /* 6180 */
293 PTR sys_fgetxattr /* 6185 */
298 PTR sys_lremovexattr /* 6190 */
303 PTR compat_sys_sched_setaffinity /* 6195 */
304 PTR compat_sys_sched_getaffinity
308 PTR compat_sys_io_setup /* 6200 */
310 PTR compat_sys_io_getevents
311 PTR compat_sys_io_submit
313 PTR sys_exit_group /* 6205 */
314 PTR sys_lookup_dcookie
318 PTR sys_remap_file_pages /* 6210 */
319 PTR sysn32_rt_sigreturn
320 PTR compat_sys_fcntl64
321 PTR sys_set_tid_address
322 PTR sys_restart_syscall
323 PTR compat_sys_semtimedop /* 6215 */
325 PTR compat_sys_statfs64
326 PTR compat_sys_fstatfs64
328 PTR compat_sys_timer_create /* 6220 */
329 PTR compat_sys_timer_settime
330 PTR compat_sys_timer_gettime
331 PTR sys_timer_getoverrun
333 PTR compat_sys_clock_settime /* 6225 */
334 PTR compat_sys_clock_gettime
335 PTR compat_sys_clock_getres
336 PTR compat_sys_clock_nanosleep
338 PTR compat_sys_utimes /* 6230 */
339 PTR sys_ni_syscall /* sys_mbind */
340 PTR sys_ni_syscall /* sys_get_mempolicy */
341 PTR sys_ni_syscall /* sys_set_mempolicy */
342 PTR compat_sys_mq_open
343 PTR sys_mq_unlink /* 6235 */
344 PTR compat_sys_mq_timedsend
345 PTR compat_sys_mq_timedreceive
346 PTR compat_sys_mq_notify
347 PTR compat_sys_mq_getsetattr
348 PTR sys_ni_syscall /* 6240, sys_vserver */
349 PTR compat_sys_waitid
350 PTR sys_ni_syscall /* available, was setaltroot */
353 PTR sys_keyctl /* 6245 */
354 PTR sys_set_thread_area
356 PTR sys_inotify_add_watch
357 PTR sys_inotify_rm_watch
358 PTR sys_migrate_pages /* 6250 */
363 PTR compat_sys_futimesat /* 6255 */
368 PTR sys_symlinkat /* 6260 */
372 PTR compat_sys_pselect6
373 PTR compat_sys_ppoll /* 6265 */
376 PTR sys_sync_file_range
378 PTR compat_sys_vmsplice /* 6270 */
380 PTR compat_sys_set_robust_list
381 PTR compat_sys_get_robust_list
382 PTR compat_sys_kexec_load
383 PTR sys_getcpu /* 6275 */
384 PTR compat_sys_epoll_pwait
387 PTR compat_sys_utimensat
388 PTR compat_sys_signalfd /* 6280 */
389 PTR sys_ni_syscall /* was timerfd */
392 PTR sys_timerfd_create
393 PTR compat_sys_timerfd_gettime /* 6285 */
394 PTR compat_sys_timerfd_settime
395 PTR compat_sys_signalfd4
397 PTR sys_epoll_create1
398 PTR sys_dup3 /* 6290 */
400 PTR sys_inotify_init1
401 PTR compat_sys_preadv
402 PTR compat_sys_pwritev
403 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
404 PTR sys_perf_event_open
406 PTR compat_sys_recvmmsg
408 PTR sys_fanotify_init /* 6300 */
409 PTR sys_fanotify_mark
411 PTR sys_name_to_handle_at
412 PTR sys_open_by_handle_at
413 PTR compat_sys_clock_adjtime /* 6305 */
415 PTR compat_sys_sendmmsg
417 PTR compat_sys_process_vm_readv
418 PTR compat_sys_process_vm_writev /* 6310 */
421 PTR sys_sched_setattr
422 PTR sys_sched_getattr
423 .size sysn32_call_table,.-sysn32_call_table