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/config.h>
11 #include <linux/errno.h>
13 #include <asm/asmmacro.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
40 dsubu t0, v0, __NR_N32_Linux # check syscall number
41 sltiu t0, t0, __NR_N32_Linux_syscalls + 1
43 #ifndef CONFIG_MIPS32_O32
44 ld t1, PT_EPC(sp) # skip syscall on return
45 daddiu t1, 4 # skip to next instruction
48 beqz t0, not_n32_scall
50 dsll t0, v0, 3 # offset into table
51 ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
53 sd a3, PT_R26(sp) # save a3 for syscall restarting
55 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
56 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
58 bnez t0, n32_syscall_trace_entry
60 jalr t2 # Do The Real Thing (TM)
62 li t0, -EMAXERRNO - 1 # error?
64 sd t0, PT_R7(sp) # set error flag
68 sd v0, PT_R0(sp) # set flag for syscall restarting
69 1: sd v0, PT_R2(sp) # result
71 local_irq_disable # make sure need_resched and
72 # signals dont change between
74 LONG_L a2, TI_FLAGS($28) # current->work
75 li t0, _TIF_ALLWORK_MASK
77 bnez t0, n32_syscall_exit_work
81 n32_syscall_exit_work:
82 j syscall_exit_work_partial
84 /* ------------------------------------------------------------------------ */
86 n32_syscall_trace_entry:
93 ld a0, PT_R4(sp) # Restore argument registers
101 li t0, -EMAXERRNO - 1 # error?
103 sd t0, PT_R7(sp) # set error flag
107 sd v0, PT_R0(sp) # set flag for syscall restarting
108 1: sd v0, PT_R2(sp) # result
113 /* This is not an n32 compatibility syscall, pass it on to
114 the n64 syscall handlers. */
119 EXPORT(sysn32_call_table)
120 PTR sys_read /* 6000 */
125 PTR sys_newfstat /* 6005 */
130 PTR sys_mprotect /* 6010 */
133 PTR sys32_rt_sigaction
134 PTR sys32_rt_sigprocmask
135 PTR compat_sys_ioctl /* 6015 */
139 PTR compat_sys_writev
140 PTR sys_access /* 6020 */
142 PTR compat_sys_select
145 PTR sys_msync /* 6025 */
150 PTR sys_shmctl /* 6030 */
154 PTR compat_sys_nanosleep
155 PTR compat_sys_getitimer /* 6035 */
156 PTR compat_sys_setitimer
160 PTR sys_socket /* 6040 */
165 PTR compat_sys_sendmsg /* 6045 */
166 PTR compat_sys_recvmsg
170 PTR sys_getsockname /* 6050 */
173 PTR compat_sys_setsockopt
175 PTR sys_clone /* 6055 */
180 PTR sys_kill /* 6060 */
185 PTR sys_shmdt /* 6065 */
190 PTR compat_sys_fcntl /* 6070 */
195 PTR sys_ftruncate /* 6075 */
200 PTR sys_rename /* 6080 */
205 PTR sys_unlink /* 6085 */
210 PTR sys_chown /* 6090 */
214 PTR sys32_gettimeofday
215 PTR compat_sys_getrlimit /* 6095 */
216 PTR compat_sys_getrusage
220 PTR sys_getuid /* 6100 */
225 PTR sys_geteuid /* 6105 */
230 PTR sys_setsid /* 6110 */
235 PTR sys_setresuid /* 6115 */
240 PTR sys_setfsuid /* 6120 */
245 PTR sys32_rt_sigpending /* 6125 */
246 PTR compat_sys_rt_sigtimedwait
247 PTR sys32_rt_sigqueueinfo
248 PTR sys32_rt_sigsuspend
249 PTR sys32_sigaltstack
250 PTR compat_sys_utime /* 6130 */
252 PTR sys32_personality
254 PTR compat_sys_statfs
255 PTR compat_sys_fstatfs /* 6135 */
259 PTR sys_sched_setparam
260 PTR sys_sched_getparam /* 6140 */
261 PTR sys_sched_setscheduler
262 PTR sys_sched_getscheduler
263 PTR sys_sched_get_priority_max
264 PTR sys_sched_get_priority_min
265 PTR sys32_sched_rr_get_interval /* 6145 */
270 PTR sys_vhangup /* 6150 */
275 PTR compat_sys_setrlimit /* 6155 */
279 PTR sys32_settimeofday
280 PTR sys_mount /* 6160 */
285 PTR sys_sethostname /* 6165 */
286 PTR sys_setdomainname
287 PTR sys_ni_syscall /* was create_module */
289 PTR sys_delete_module
290 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
291 PTR sys_ni_syscall /* was query_module */
294 PTR sys_ni_syscall /* res. for getpmsg */
295 PTR sys_ni_syscall /* 6175 for putpmsg */
296 PTR sys_ni_syscall /* res. for afs_syscall */
297 PTR sys_ni_syscall /* res. for security */
300 PTR sys_setxattr /* 6180 */
305 PTR sys_fgetxattr /* 6185 */
310 PTR sys_lremovexattr /* 6190 */
315 PTR compat_sys_sched_setaffinity /* 6195 */
316 PTR compat_sys_sched_getaffinity
320 PTR sys_io_setup /* 6200 */
325 PTR sys_exit_group /* 6205 */
326 PTR sys_lookup_dcookie
330 PTR sys_remap_file_pages /* 6210 */
331 PTR sysn32_rt_sigreturn
333 PTR sys_set_tid_address
334 PTR sys_restart_syscall
335 PTR sys_semtimedop /* 6215 */
337 PTR compat_sys_statfs64
338 PTR compat_sys_fstatfs64
340 PTR sys_timer_create /* 6220 */
341 PTR sys_timer_settime
342 PTR sys_timer_gettime
343 PTR sys_timer_getoverrun
345 PTR sys_clock_settime /* 6225 */
346 PTR sys_clock_gettime
348 PTR sys_clock_nanosleep
350 PTR compat_sys_utimes /* 6230 */
351 PTR sys_ni_syscall /* sys_mbind */
352 PTR sys_ni_syscall /* sys_get_mempolicy */
353 PTR sys_ni_syscall /* sys_set_mempolicy */
354 PTR compat_sys_mq_open
355 PTR sys_mq_unlink /* 6235 */
356 PTR compat_sys_mq_timedsend
357 PTR compat_sys_mq_timedreceive
358 PTR compat_sys_mq_notify
359 PTR compat_sys_mq_getsetattr
360 PTR sys_ni_syscall /* 6240, sys_vserver */
362 PTR sys_ni_syscall /* available, was setaltroot */
365 PTR sys_keyctl /* 6245 */