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 /* This duplicates the definition from <linux/sched.h> */
21 #define PT_TRACESYS 0x00000002 /* tracing system calls */
23 /* This duplicates the definition from <asm/signal.h> */
24 #define SIGILL 4 /* Illegal instruction (ANSI). */
26 #ifndef CONFIG_MIPS32_O32
27 /* No O32, so define handle_sys here */
28 #define handle_sysn32 handle_sys
32 NESTED(handle_sysn32, PT_SIZE, sp)
33 #ifndef CONFIG_MIPS32_O32
41 dsubu t0, v0, __NR_N32_Linux # check syscall number
42 sltiu t0, t0, __NR_N32_Linux_syscalls + 1
44 #ifndef CONFIG_MIPS32_O32
45 ld t1, PT_EPC(sp) # skip syscall on return
46 daddiu t1, 4 # skip to next instruction
49 beqz t0, not_n32_scall
51 dsll t0, v0, 3 # offset into table
52 ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
54 sd a3, PT_R26(sp) # save a3 for syscall restarting
56 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
57 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
59 bnez t0, n32_syscall_trace_entry
61 jalr t2 # Do The Real Thing (TM)
63 li t0, -EMAXERRNO - 1 # error?
65 sd t0, PT_R7(sp) # set error flag
68 ld t1, PT_R2(sp) # syscall number
70 sd t1, PT_R0(sp) # save it for syscall restarting
71 1: sd v0, PT_R2(sp) # result
73 local_irq_disable # make sure need_resched and
74 # signals dont change between
76 LONG_L a2, TI_FLAGS($28) # current->work
77 li t0, _TIF_ALLWORK_MASK
79 bnez t0, n32_syscall_exit_work
83 n32_syscall_exit_work:
84 j syscall_exit_work_partial
86 /* ------------------------------------------------------------------------ */
88 n32_syscall_trace_entry:
97 ld a0, PT_R4(sp) # Restore argument registers
105 li t0, -EMAXERRNO - 1 # error?
107 sd t0, PT_R7(sp) # set error flag
110 ld t1, PT_R2(sp) # syscall number
112 sd t1, PT_R0(sp) # save it for syscall restarting
113 1: sd v0, PT_R2(sp) # result
118 /* This is not an n32 compatibility syscall, pass it on to
119 the n64 syscall handlers. */
124 EXPORT(sysn32_call_table)
125 PTR sys_read /* 6000 */
130 PTR sys_newfstat /* 6005 */
135 PTR sys_mprotect /* 6010 */
138 PTR sys_32_rt_sigaction
139 PTR sys_32_rt_sigprocmask
140 PTR compat_sys_ioctl /* 6015 */
144 PTR compat_sys_writev
145 PTR sys_access /* 6020 */
147 PTR compat_sys_select
150 PTR sys_msync /* 6025 */
155 PTR compat_sys_shmctl /* 6030 */
159 PTR compat_sys_nanosleep
160 PTR compat_sys_getitimer /* 6035 */
161 PTR compat_sys_setitimer
165 PTR sys_socket /* 6040 */
169 PTR compat_sys_recvfrom
170 PTR compat_sys_sendmsg /* 6045 */
171 PTR compat_sys_recvmsg
175 PTR sys_getsockname /* 6050 */
178 PTR compat_sys_setsockopt
180 PTR sys_clone /* 6055 */
185 PTR sys_kill /* 6060 */
190 PTR sys_shmdt /* 6065 */
194 PTR compat_sys_msgctl
195 PTR compat_sys_fcntl /* 6070 */
200 PTR sys_ftruncate /* 6075 */
201 PTR compat_sys_getdents
205 PTR sys_rename /* 6080 */
210 PTR sys_unlink /* 6085 */
215 PTR sys_chown /* 6090 */
219 PTR compat_sys_gettimeofday
220 PTR compat_sys_getrlimit /* 6095 */
221 PTR compat_sys_getrusage
222 PTR compat_sys_sysinfo
224 PTR compat_sys_ptrace
225 PTR sys_getuid /* 6100 */
230 PTR sys_geteuid /* 6105 */
235 PTR sys_setsid /* 6110 */
240 PTR sys_setresuid /* 6115 */
245 PTR sys_setfsuid /* 6120 */
250 PTR sys_32_rt_sigpending /* 6125 */
251 PTR compat_sys_rt_sigtimedwait
252 PTR sys_32_rt_sigqueueinfo
253 PTR sysn32_rt_sigsuspend
254 PTR sys32_sigaltstack
255 PTR compat_sys_utime /* 6130 */
257 PTR sys_32_personality
259 PTR compat_sys_statfs
260 PTR compat_sys_fstatfs /* 6135 */
264 PTR sys_sched_setparam
265 PTR sys_sched_getparam /* 6140 */
266 PTR sys_sched_setscheduler
267 PTR sys_sched_getscheduler
268 PTR sys_sched_get_priority_max
269 PTR sys_sched_get_priority_min
270 PTR sys_32_sched_rr_get_interval /* 6145 */
275 PTR sys_vhangup /* 6150 */
277 PTR compat_sys_sysctl
279 PTR compat_sys_adjtimex
280 PTR compat_sys_setrlimit /* 6155 */
284 PTR compat_sys_settimeofday
285 PTR compat_sys_mount /* 6160 */
290 PTR sys_sethostname /* 6165 */
291 PTR sys_setdomainname
292 PTR sys_ni_syscall /* was create_module */
294 PTR sys_delete_module
295 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
296 PTR sys_ni_syscall /* was query_module */
298 PTR compat_sys_nfsservctl
299 PTR sys_ni_syscall /* res. for getpmsg */
300 PTR sys_ni_syscall /* 6175 for putpmsg */
301 PTR sys_ni_syscall /* res. for afs_syscall */
302 PTR sys_ni_syscall /* res. for security */
305 PTR sys_setxattr /* 6180 */
310 PTR sys_fgetxattr /* 6185 */
315 PTR sys_lremovexattr /* 6190 */
320 PTR compat_sys_sched_setaffinity /* 6195 */
321 PTR compat_sys_sched_getaffinity
325 PTR compat_sys_io_setup /* 6200 */
327 PTR compat_sys_io_getevents
328 PTR compat_sys_io_submit
330 PTR sys_exit_group /* 6205 */
331 PTR sys_lookup_dcookie
335 PTR sys_remap_file_pages /* 6210 */
336 PTR sysn32_rt_sigreturn
337 PTR compat_sys_fcntl64
338 PTR sys_set_tid_address
339 PTR sys_restart_syscall
340 PTR compat_sys_semtimedop /* 6215 */
342 PTR compat_sys_statfs64
343 PTR compat_sys_fstatfs64
345 PTR compat_sys_timer_create /* 6220 */
346 PTR compat_sys_timer_settime
347 PTR compat_sys_timer_gettime
348 PTR sys_timer_getoverrun
350 PTR compat_sys_clock_settime /* 6225 */
351 PTR compat_sys_clock_gettime
352 PTR compat_sys_clock_getres
353 PTR compat_sys_clock_nanosleep
355 PTR compat_sys_utimes /* 6230 */
356 PTR sys_ni_syscall /* sys_mbind */
357 PTR sys_ni_syscall /* sys_get_mempolicy */
358 PTR sys_ni_syscall /* sys_set_mempolicy */
359 PTR compat_sys_mq_open
360 PTR sys_mq_unlink /* 6235 */
361 PTR compat_sys_mq_timedsend
362 PTR compat_sys_mq_timedreceive
363 PTR compat_sys_mq_notify
364 PTR compat_sys_mq_getsetattr
365 PTR sys_ni_syscall /* 6240, sys_vserver */
366 PTR compat_sys_waitid
367 PTR sys_ni_syscall /* available, was setaltroot */
370 PTR sys_keyctl /* 6245 */
371 PTR sys_set_thread_area
373 PTR sys_inotify_add_watch
374 PTR sys_inotify_rm_watch
375 PTR sys_migrate_pages /* 6250 */
380 PTR compat_sys_futimesat /* 6255 */
385 PTR sys_symlinkat /* 6260 */
389 PTR compat_sys_pselect6
390 PTR compat_sys_ppoll /* 6265 */
393 PTR sys_sync_file_range
395 PTR compat_sys_vmsplice /* 6270 */
397 PTR compat_sys_set_robust_list
398 PTR compat_sys_get_robust_list
399 PTR compat_sys_kexec_load
400 PTR sys_getcpu /* 6275 */
401 PTR compat_sys_epoll_pwait
404 PTR compat_sys_utimensat
405 PTR compat_sys_signalfd /* 6280 */
409 PTR sys_timerfd_create
410 PTR compat_sys_timerfd_gettime /* 6285 */
411 PTR compat_sys_timerfd_settime
414 PTR sys_epoll_create1
415 PTR sys_dup3 /* 6290 */
417 PTR sys_inotify_init1
420 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
421 PTR sys_perf_event_open
423 PTR compat_sys_recvmmsg
425 PTR sys_fanotify_init /* 6300 */
426 PTR sys_fanotify_mark
428 .size sysn32_call_table,.-sysn32_call_table