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>
12 #include <linux/errno.h>
13 #include <asm/mipsregs.h>
14 #include <asm/regdef.h>
15 #include <asm/stackframe.h>
16 #include <asm/unistd.h>
18 /* This duplicates the definition from <linux/sched.h> */
19 #define PT_TRACESYS 0x00000002 /* tracing system calls */
21 /* This duplicates the definition from <asm/signal.h> */
22 #define SIGILL 4 /* Illegal instruction (ANSI). */
24 #ifndef CONFIG_MIPS32_O32
25 /* No O32, so define handle_sys here */
26 #define handle_sysn32 handle_sys
30 NESTED(handle_sysn32, PT_SIZE, sp)
31 #ifndef CONFIG_MIPS32_O32
37 ld t1, PT_EPC(sp) # skip syscall on return
39 subu t0, v0, __NR_N32_Linux # check syscall number
40 sltiu t0, t0, __NR_N32_Linux_syscalls + 1
41 daddiu t1, 4 # skip to next instruction
42 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 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
51 bltz t0, n32_syscall_trace_entry
53 jalr t2 # Do The Real Thing (TM)
55 li t0, -EMAXERRNO - 1 # error?
57 sd t0, PT_R7(sp) # set error flag
61 sd v0, PT_R0(sp) # set flag for syscall restarting
62 1: sd v0, PT_R2(sp) # result
64 FEXPORT(n32_syscall_exit)
65 mfc0 t0, CP0_STATUS # make sure need_resched and
66 xori t0, t0, 1 # signals dont change between
67 ori t0, t0, 1 # sampling and return
71 LONG_L a2, TI_FLAGS($28) # current->work
72 bnez a2, n32_syscall_exit_work
79 n32_syscall_exit_work:
83 /* ------------------------------------------------------------------------ */
85 n32_syscall_trace_entry:
91 ld a0, PT_R4(sp) # Restore argument registers
97 li t0, -EMAXERRNO - 1 # error?
99 sd t0, PT_R7(sp) # set error flag
103 sd v0, PT_R0(sp) # set flag for syscall restarting
104 1: sd v0, PT_R2(sp) # result
109 /* This is not an n32 compatibility syscall, pass it on to
110 the n64 syscall handlers. */
115 EXPORT(sysn32_call_table)
116 PTR sys_read /* 6000 */
121 PTR sys_newfstat /* 6005 */
126 PTR sys_mprotect /* 6010 */
129 PTR sys32_rt_sigaction
130 PTR sys32_rt_sigprocmask
131 PTR compat_sys_ioctl /* 6015 */
136 PTR sys_access /* 6020 */
141 PTR sys_msync /* 6025 */
146 PTR sys_shmctl /* 6030 */
150 PTR compat_sys_nanosleep
151 PTR compat_sys_getitimer /* 6035 */
152 PTR compat_sys_setitimer
156 PTR sys_socket /* 6040 */
161 PTR compat_sys_sendmsg /* 6045 */
162 PTR compat_sys_recvmsg
166 PTR sys_getsockname /* 6050 */
169 PTR compat_sys_setsockopt
171 PTR sys_clone /* 6055 */
176 PTR sys_kill /* 6060 */
181 PTR sys_shmdt /* 6065 */
186 PTR compat_sys_fcntl /* 6070 */
191 PTR sys_ftruncate /* 6075 */
196 PTR sys_rename /* 6080 */
201 PTR sys_unlink /* 6085 */
206 PTR sys_chown /* 6090 */
210 PTR sys32_gettimeofday
211 PTR compat_sys_getrlimit /* 6095 */
212 PTR compat_sys_getrusage
216 PTR sys_getuid /* 6100 */
221 PTR sys_geteuid /* 6105 */
226 PTR sys_setsid /* 6110 */
231 PTR sys_setresuid /* 6115 */
236 PTR sys_setfsuid /* 6120 */
241 PTR sys32_rt_sigpending /* 6125 */
242 PTR sys32_rt_sigtimedwait
243 PTR sys32_rt_sigqueueinfo
244 PTR sys32_rt_sigsuspend
245 PTR sys32_sigaltstack
246 PTR compat_sys_utime /* 6130 */
248 PTR sys32_personality
250 PTR compat_sys_statfs
251 PTR compat_sys_fstatfs /* 6135 */
255 PTR sys_sched_setparam
256 PTR sys_sched_getparam /* 6140 */
257 PTR sys_sched_setscheduler
258 PTR sys_sched_getscheduler
259 PTR sys_sched_get_priority_max
260 PTR sys_sched_get_priority_min
261 PTR sys32_sched_rr_get_interval /* 6145 */
266 PTR sys_vhangup /* 6150 */
271 PTR compat_sys_setrlimit /* 6155 */
275 PTR sys32_settimeofday
276 PTR sys_mount /* 6160 */
281 PTR sys_sethostname /* 6165 */
282 PTR sys_setdomainname
283 PTR sys_ni_syscall /* was create_module */
285 PTR sys_delete_module
286 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
287 PTR sys_ni_syscall /* was query_module */
290 PTR sys_ni_syscall /* res. for getpmsg */
291 PTR sys_ni_syscall /* 6175 for putpmsg */
292 PTR sys_ni_syscall /* res. for afs_syscall */
293 PTR sys_ni_syscall /* res. for security */
296 PTR sys_setxattr /* 6180 */
301 PTR sys_fgetxattr /* 6185 */
306 PTR sys_lremovexattr /* 6190 */
311 PTR sys32_sched_setaffinity /* 6195 */
312 PTR sys32_sched_getaffinity
316 PTR sys_io_setup /* 6200 */
321 PTR sys_exit_group /* 6205 */
322 PTR sys_lookup_dcookie
326 PTR sys_remap_file_pages /* 6210 */
329 PTR sys_set_tid_address
330 PTR sys_restart_syscall
331 PTR sys_semtimedop /* 6215 */