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/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/offset.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
41 dsubu t0, v0, __NR_64_Linux # check syscall number
42 sltiu t0, t0, __NR_64_Linux_syscalls + 1
43 #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
44 ld t1, PT_EPC(sp) # skip syscall on return
45 daddiu t1, 4 # skip to next instruction
48 beqz t0, illegal_syscall
50 dsll t0, v0, 3 # offset into table
51 ld t2, (sys_call_table - (__NR_64_Linux * 8))(t0)
54 sd a3, PT_R26(sp) # save a3 for syscall restarting
56 LONG_L t0, TI_FLAGS($28)
57 bltz t0, syscall_trace_entry # syscall tracing enabled?
59 jalr t2 # Do The Real Thing (TM)
61 li t0, -EMAXERRNO - 1 # error?
63 sd t0, PT_R7(sp) # set error flag
67 sd v0, PT_R0(sp) # set flag for syscall
69 1: sd v0, PT_R2(sp) # result
72 local_irq_disable # make sure need_resched and
73 # signals dont change between
75 LONG_L a2, TI_FLAGS($28) # current->work
76 li t0, _TIF_ALLWORK_MASK
78 bnez t0, n64_syscall_exit_work
82 n64_syscall_exit_work:
83 j syscall_exit_work_partial
85 /* ------------------------------------------------------------------------ */
94 ld a0, PT_R4(sp) # Restore argument registers
102 li t0, -EMAXERRNO - 1 # error?
104 sd t0, PT_R7(sp) # set error flag
108 sd v0, PT_R0(sp) # set flag for syscall restarting
109 1: sd v0, PT_R2(sp) # result
114 /* This also isn't a 64-bit syscall, throw an error. */
115 li v0, ENOSYS # error
117 li t0, 1 # set error flag
122 LEAF(mips_atomic_set)
123 andi v0, a1, 3 # must be word aligned
124 bnez v0, bad_alignment
126 LONG_L v1, TI_ADDR_LIMIT($28) # in legal address range?
132 #ifdef CONFIG_CPU_HAS_LLSC
133 /* Ok, this is the ll/sc case. World is sane :-) */
143 .section __ex_table,"a"
160 * At this point the page should be readable and writable unless
161 * there was no more memory available.
166 .section __ex_table,"a"
172 sd zero, PT_R7(sp) # success
173 sd v0, PT_R2(sp) # result
175 /* Success, so skip usual error handling garbage. */
176 LONG_L a2, TI_FLAGS($28) # syscall tracing enabled?
177 li t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
189 no_mem: li v0, -ENOMEM
202 beq a0, MIPS_ATOMIC_SET, mips_atomic_set
208 PTR sys_read /* 5000 */
213 PTR sys_newfstat /* 5005 */
218 PTR sys_mprotect /* 5010 */
222 PTR sys_rt_sigprocmask
223 PTR sys_ioctl /* 5015 */
228 PTR sys_access /* 5020 */
233 PTR sys_msync /* 5025 */
238 PTR sys_shmctl /* 5030 */
243 PTR sys_getitimer /* 5035 */
248 PTR sys_socket /* 5040 */
253 PTR sys_sendmsg /* 5045 */
258 PTR sys_getsockname /* 5050 */
263 PTR sys_clone /* 5055 */
268 PTR sys_kill /* 5060 */
273 PTR sys_shmdt /* 5065 */
278 PTR sys_fcntl /* 5070 */
283 PTR sys_ftruncate /* 5075 */
288 PTR sys_rename /* 5080 */
293 PTR sys_unlink /* 5085 */
298 PTR sys_chown /* 5090 */
303 PTR sys_getrlimit /* 5095 */
308 PTR sys_getuid /* 5100 */
313 PTR sys_geteuid /* 5105 */
318 PTR sys_setsid /* 5110 */
323 PTR sys_setresuid /* 5115 */
328 PTR sys_setfsuid /* 5120 */
333 PTR sys_rt_sigpending /* 5125 */
334 PTR sys_rt_sigtimedwait
335 PTR sys_rt_sigqueueinfo
336 PTR sys_rt_sigsuspend
338 PTR sys_utime /* 5130 */
343 PTR sys_fstatfs /* 5135 */
347 PTR sys_sched_setparam
348 PTR sys_sched_getparam /* 5140 */
349 PTR sys_sched_setscheduler
350 PTR sys_sched_getscheduler
351 PTR sys_sched_get_priority_max
352 PTR sys_sched_get_priority_min
353 PTR sys_sched_rr_get_interval /* 5145 */
358 PTR sys_vhangup /* 5150 */
363 PTR sys_setrlimit /* 5155 */
368 PTR sys_mount /* 5160 */
373 PTR sys_sethostname /* 5165 */
374 PTR sys_setdomainname
375 PTR sys_ni_syscall /* was create_module */
377 PTR sys_delete_module
378 PTR sys_ni_syscall /* 5170, was get_kernel_syms */
379 PTR sys_ni_syscall /* was query_module */
382 PTR sys_ni_syscall /* res. for getpmsg */
383 PTR sys_ni_syscall /* 5175 for putpmsg */
384 PTR sys_ni_syscall /* res. for afs_syscall */
385 PTR sys_ni_syscall /* res. for security */
388 PTR sys_setxattr /* 5180 */
393 PTR sys_fgetxattr /* 5185 */
398 PTR sys_lremovexattr /* 5190 */
403 PTR sys_sched_setaffinity /* 5195 */
404 PTR sys_sched_getaffinity
408 PTR sys_io_setup /* 5200 */
413 PTR sys_exit_group /* 5205 */
414 PTR sys_lookup_dcookie
418 PTR sys_remap_file_pages /* 5210 */
420 PTR sys_set_tid_address
421 PTR sys_restart_syscall
423 PTR sys_fadvise64_64 /* 5215 */
425 PTR sys_timer_settime
426 PTR sys_timer_gettime
427 PTR sys_timer_getoverrun
428 PTR sys_timer_delete /* 5220 */
429 PTR sys_clock_settime
430 PTR sys_clock_gettime
432 PTR sys_clock_nanosleep
433 PTR sys_tgkill /* 5225 */
436 PTR sys_ni_syscall /* sys_get_mempolicy */
437 PTR sys_ni_syscall /* sys_set_mempolicy */
438 PTR sys_mq_open /* 5230 */
441 PTR sys_mq_timedreceive
443 PTR sys_mq_getsetattr /* 5235 */
444 PTR sys_ni_syscall /* sys_vserver */
446 PTR sys_ni_syscall /* available, was setaltroot */
448 PTR sys_request_key /* 5240 */