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/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/asm-offsets.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
42 #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
43 ld t1, PT_EPC(sp) # skip syscall on return
44 daddiu t1, 4 # skip to next instruction
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, syscall_trace_entry
56 dsubu t2, v0, __NR_64_Linux
57 sltiu t0, t2, __NR_64_Linux_syscalls
58 beqz t0, illegal_syscall
60 dsll t0, t2, 3 # offset into table
61 dla t2, sys_call_table
63 ld t2, (t0) # syscall routine
64 beqz t2, illegal_syscall
66 jalr t2 # Do The Real Thing (TM)
68 li t0, -EMAXERRNO - 1 # error?
70 sd t0, PT_R7(sp) # set error flag
73 ld t1, PT_R2(sp) # syscall number
75 sd t1, PT_R0(sp) # save it for syscall restarting
76 1: sd v0, PT_R2(sp) # result
79 j syscall_exit_partial
81 /* ------------------------------------------------------------------------ */
87 jal syscall_trace_enter
89 bltz v0, 1f # seccomp failed? Skip syscall
92 ld v0, PT_R2(sp) # Restore syscall (maybe modified)
93 ld a0, PT_R4(sp) # Restore argument registers
104 /* This also isn't a 64-bit syscall, throw an error. */
105 li v0, ENOSYS # error
107 li t0, 1 # set error flag
112 #define __SYSCALL(nr, entry) PTR entry
114 .type sys_call_table, @object
115 EXPORT(sys_call_table)
116 #include <asm/syscall_table_64_n64.h>