11da177e4SLinus Torvalds/* 21da177e4SLinus Torvalds * This file is subject to the terms and conditions of the GNU General Public 31da177e4SLinus Torvalds * License. See the file "COPYING" in the main directory of this archive 41da177e4SLinus Torvalds * for more details. 51da177e4SLinus Torvalds * 6192ef366SRalf Baechle * Copyright (C) 1995-99, 2000- 02, 06 Ralf Baechle <ralf@linux-mips.org> 71da177e4SLinus Torvalds * Copyright (C) 2001 MIPS Technologies, Inc. 81da177e4SLinus Torvalds * Copyright (C) 2004 Thiemo Seufer 91da177e4SLinus Torvalds */ 101da177e4SLinus Torvalds#include <linux/errno.h> 111da177e4SLinus Torvalds#include <asm/asm.h> 121da177e4SLinus Torvalds#include <asm/asmmacro.h> 13192ef366SRalf Baechle#include <asm/irqflags.h> 141da177e4SLinus Torvalds#include <asm/mipsregs.h> 151da177e4SLinus Torvalds#include <asm/regdef.h> 161da177e4SLinus Torvalds#include <asm/stackframe.h> 171da177e4SLinus Torvalds#include <asm/isadep.h> 181da177e4SLinus Torvalds#include <asm/sysmips.h> 191da177e4SLinus Torvalds#include <asm/thread_info.h> 201da177e4SLinus Torvalds#include <asm/unistd.h> 211da177e4SLinus Torvalds#include <asm/war.h> 22048eb582SSam Ravnborg#include <asm/asm-offsets.h> 231da177e4SLinus Torvalds 241da177e4SLinus Torvalds/* Highest syscall used of any syscall flavour */ 251da177e4SLinus Torvalds#define MAX_SYSCALL_NO __NR_O32_Linux + __NR_O32_Linux_syscalls 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds .align 5 281da177e4SLinus TorvaldsNESTED(handle_sys, PT_SIZE, sp) 291da177e4SLinus Torvalds .set noat 301da177e4SLinus Torvalds SAVE_SOME 31eae6c0daSAtsushi Nemoto TRACE_IRQS_ON_RELOAD 321da177e4SLinus Torvalds STI 331da177e4SLinus Torvalds .set at 341da177e4SLinus Torvalds 351da177e4SLinus Torvalds lw t1, PT_EPC(sp) # skip syscall on return 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds subu v0, v0, __NR_O32_Linux # check syscall number 381da177e4SLinus Torvalds sltiu t0, v0, __NR_O32_Linux_syscalls + 1 391da177e4SLinus Torvalds addiu t1, 4 # skip to next instruction 401da177e4SLinus Torvalds sw t1, PT_EPC(sp) 411da177e4SLinus Torvalds beqz t0, illegal_syscall 421da177e4SLinus Torvalds 431da177e4SLinus Torvalds sll t0, v0, 3 441da177e4SLinus Torvalds la t1, sys_call_table 451da177e4SLinus Torvalds addu t1, t0 461da177e4SLinus Torvalds lw t2, (t1) # syscall routine 471da177e4SLinus Torvalds lw t3, 4(t1) # >= 0 if we need stack arguments 481da177e4SLinus Torvalds beqz t2, illegal_syscall 491da177e4SLinus Torvalds 501da177e4SLinus Torvalds sw a3, PT_R26(sp) # save a3 for syscall restarting 511da177e4SLinus Torvalds bgez t3, stackargs 521da177e4SLinus Torvalds 531da177e4SLinus Torvaldsstack_done: 541da177e4SLinus Torvalds lw t0, TI_FLAGS($28) # syscall tracing enabled? 551da177e4SLinus Torvalds li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT 561da177e4SLinus Torvalds and t0, t1 571da177e4SLinus Torvalds bnez t0, syscall_trace_entry # -> yes 581da177e4SLinus Torvalds 591da177e4SLinus Torvalds jalr t2 # Do The Real Thing (TM) 601da177e4SLinus Torvalds 611da177e4SLinus Torvalds li t0, -EMAXERRNO - 1 # error? 621da177e4SLinus Torvalds sltu t0, t0, v0 631da177e4SLinus Torvalds sw t0, PT_R7(sp) # set error flag 641da177e4SLinus Torvalds beqz t0, 1f 651da177e4SLinus Torvalds 661da177e4SLinus Torvalds negu v0 # error 671da177e4SLinus Torvalds sw v0, PT_R0(sp) # set flag for syscall 681da177e4SLinus Torvalds # restarting 691da177e4SLinus Torvalds1: sw v0, PT_R2(sp) # result 701da177e4SLinus Torvalds 711da177e4SLinus Torvaldso32_syscall_exit: 721da177e4SLinus Torvalds local_irq_disable # make sure need_resched and 731da177e4SLinus Torvalds # signals dont change between 741da177e4SLinus Torvalds # sampling and return 751da177e4SLinus Torvalds lw a2, TI_FLAGS($28) # current->work 761da177e4SLinus Torvalds li t0, _TIF_ALLWORK_MASK 771da177e4SLinus Torvalds and t0, a2 781da177e4SLinus Torvalds bnez t0, o32_syscall_exit_work 791da177e4SLinus Torvalds 801da177e4SLinus Torvalds j restore_partial 811da177e4SLinus Torvalds 821da177e4SLinus Torvaldso32_syscall_exit_work: 831da177e4SLinus Torvalds j syscall_exit_work_partial 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds/* ------------------------------------------------------------------------ */ 861da177e4SLinus Torvalds 871da177e4SLinus Torvaldssyscall_trace_entry: 881da177e4SLinus Torvalds SAVE_STATIC 891da177e4SLinus Torvalds move s0, t2 901da177e4SLinus Torvalds move a0, sp 911da177e4SLinus Torvalds li a1, 0 921da177e4SLinus Torvalds jal do_syscall_trace 931da177e4SLinus Torvalds 9404a7052cSRalf Baechle move t0, s0 9504a7052cSRalf Baechle RESTORE_STATIC 961da177e4SLinus Torvalds lw a0, PT_R4(sp) # Restore argument registers 971da177e4SLinus Torvalds lw a1, PT_R5(sp) 981da177e4SLinus Torvalds lw a2, PT_R6(sp) 991da177e4SLinus Torvalds lw a3, PT_R7(sp) 10004a7052cSRalf Baechle jalr t0 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds li t0, -EMAXERRNO - 1 # error? 1031da177e4SLinus Torvalds sltu t0, t0, v0 1041da177e4SLinus Torvalds sw t0, PT_R7(sp) # set error flag 1051da177e4SLinus Torvalds beqz t0, 1f 1061da177e4SLinus Torvalds 1071da177e4SLinus Torvalds negu v0 # error 1081da177e4SLinus Torvalds sw v0, PT_R0(sp) # set flag for syscall 1091da177e4SLinus Torvalds # restarting 1101da177e4SLinus Torvalds1: sw v0, PT_R2(sp) # result 1111da177e4SLinus Torvalds 1121da177e4SLinus Torvalds j syscall_exit 1131da177e4SLinus Torvalds 1141da177e4SLinus Torvalds/* ------------------------------------------------------------------------ */ 1151da177e4SLinus Torvalds 1161da177e4SLinus Torvalds /* 1171da177e4SLinus Torvalds * More than four arguments. Try to deal with it by copying the 1181da177e4SLinus Torvalds * stack arguments from the user stack to the kernel stack. 1191da177e4SLinus Torvalds * This Sucks (TM). 1201da177e4SLinus Torvalds */ 1211da177e4SLinus Torvaldsstackargs: 1221da177e4SLinus Torvalds lw t0, PT_R29(sp) # get old user stack pointer 1231da177e4SLinus Torvalds 1241da177e4SLinus Torvalds /* 1251da177e4SLinus Torvalds * We intentionally keep the kernel stack a little below the top of 1261da177e4SLinus Torvalds * userspace so we don't have to do a slower byte accurate check here. 1271da177e4SLinus Torvalds */ 1281da177e4SLinus Torvalds lw t5, TI_ADDR_LIMIT($28) 1291da177e4SLinus Torvalds addu t4, t0, 32 1301da177e4SLinus Torvalds and t5, t4 1311da177e4SLinus Torvalds bltz t5, bad_stack # -> sp is bad 1321da177e4SLinus Torvalds 1331da177e4SLinus Torvalds /* Ok, copy the args from the luser stack to the kernel stack. 1341da177e4SLinus Torvalds * t3 is the precomputed number of instruction bytes needed to 1351da177e4SLinus Torvalds * load or store arguments 6-8. 1361da177e4SLinus Torvalds */ 1371da177e4SLinus Torvalds 1381da177e4SLinus Torvalds la t1, 5f # load up to 3 arguments 1391da177e4SLinus Torvalds subu t1, t3 1401da177e4SLinus Torvalds1: lw t5, 16(t0) # argument #5 from usp 1411da177e4SLinus Torvalds .set push 1421da177e4SLinus Torvalds .set noreorder 1431da177e4SLinus Torvalds .set nomacro 1441da177e4SLinus Torvalds jr t1 1451da177e4SLinus Torvalds addiu t1, 6f - 5f 1461da177e4SLinus Torvalds 1471da177e4SLinus Torvalds2: lw t8, 28(t0) # argument #8 from usp 1481da177e4SLinus Torvalds3: lw t7, 24(t0) # argument #7 from usp 1491da177e4SLinus Torvalds4: lw t6, 20(t0) # argument #6 from usp 1501da177e4SLinus Torvalds5: jr t1 1511da177e4SLinus Torvalds sw t5, 16(sp) # argument #5 to ksp 1521da177e4SLinus Torvalds 1531da177e4SLinus Torvalds sw t8, 28(sp) # argument #8 to ksp 1541da177e4SLinus Torvalds sw t7, 24(sp) # argument #7 to ksp 1551da177e4SLinus Torvalds sw t6, 20(sp) # argument #6 to ksp 1561da177e4SLinus Torvalds6: j stack_done # go back 1571da177e4SLinus Torvalds nop 1581da177e4SLinus Torvalds .set pop 1591da177e4SLinus Torvalds 1601da177e4SLinus Torvalds .section __ex_table,"a" 1611da177e4SLinus Torvalds PTR 1b,bad_stack 1621da177e4SLinus Torvalds PTR 2b,bad_stack 1631da177e4SLinus Torvalds PTR 3b,bad_stack 1641da177e4SLinus Torvalds PTR 4b,bad_stack 1651da177e4SLinus Torvalds .previous 1661da177e4SLinus Torvalds 1671da177e4SLinus Torvalds /* 1681da177e4SLinus Torvalds * The stackpointer for a call with more than 4 arguments is bad. 1691da177e4SLinus Torvalds * We probably should handle this case a bit more drastic. 1701da177e4SLinus Torvalds */ 1711da177e4SLinus Torvaldsbad_stack: 1721da177e4SLinus Torvalds negu v0 # error 1731da177e4SLinus Torvalds sw v0, PT_R0(sp) 1741da177e4SLinus Torvalds sw v0, PT_R2(sp) 1751da177e4SLinus Torvalds li t0, 1 # set error flag 1761da177e4SLinus Torvalds sw t0, PT_R7(sp) 1771da177e4SLinus Torvalds j o32_syscall_exit 1781da177e4SLinus Torvalds 1791da177e4SLinus Torvalds /* 1801da177e4SLinus Torvalds * The system call does not exist in this kernel 1811da177e4SLinus Torvalds */ 1821da177e4SLinus Torvaldsillegal_syscall: 183*bda8229bSAtsushi Nemoto li v0, ENOSYS # error 1841da177e4SLinus Torvalds sw v0, PT_R2(sp) 1851da177e4SLinus Torvalds li t0, 1 # set error flag 1861da177e4SLinus Torvalds sw t0, PT_R7(sp) 1871da177e4SLinus Torvalds j o32_syscall_exit 1881da177e4SLinus Torvalds END(handle_sys) 1891da177e4SLinus Torvalds 1901da177e4SLinus Torvalds LEAF(mips_atomic_set) 1911da177e4SLinus Torvalds andi v0, a1, 3 # must be word aligned 1921da177e4SLinus Torvalds bnez v0, bad_alignment 1931da177e4SLinus Torvalds 1941da177e4SLinus Torvalds lw v1, TI_ADDR_LIMIT($28) # in legal address range? 1951da177e4SLinus Torvalds addiu a0, a1, 4 1961da177e4SLinus Torvalds or a0, a0, a1 1971da177e4SLinus Torvalds and a0, a0, v1 1981da177e4SLinus Torvalds bltz a0, bad_address 1991da177e4SLinus Torvalds 2001da177e4SLinus Torvalds#ifdef CONFIG_CPU_HAS_LLSC 2011da177e4SLinus Torvalds /* Ok, this is the ll/sc case. World is sane :-) */ 2021da177e4SLinus Torvalds1: ll v0, (a1) 2031da177e4SLinus Torvalds move a0, a2 2041da177e4SLinus Torvalds2: sc a0, (a1) 2051da177e4SLinus Torvalds#if R10000_LLSC_WAR 2061da177e4SLinus Torvalds beqzl a0, 1b 2071da177e4SLinus Torvalds#else 2081da177e4SLinus Torvalds beqz a0, 1b 2091da177e4SLinus Torvalds#endif 2101da177e4SLinus Torvalds 2111da177e4SLinus Torvalds .section __ex_table,"a" 2121da177e4SLinus Torvalds PTR 1b, bad_stack 2131da177e4SLinus Torvalds PTR 2b, bad_stack 2141da177e4SLinus Torvalds .previous 2151da177e4SLinus Torvalds#else 2161da177e4SLinus Torvalds sw a1, 16(sp) 2171da177e4SLinus Torvalds sw a2, 20(sp) 2181da177e4SLinus Torvalds 2191da177e4SLinus Torvalds move a0, sp 2201da177e4SLinus Torvalds move a2, a1 2211da177e4SLinus Torvalds li a1, 1 2221da177e4SLinus Torvalds jal do_page_fault 2231da177e4SLinus Torvalds 2241da177e4SLinus Torvalds lw a1, 16(sp) 2251da177e4SLinus Torvalds lw a2, 20(sp) 2261da177e4SLinus Torvalds 2271da177e4SLinus Torvalds /* 2281da177e4SLinus Torvalds * At this point the page should be readable and writable unless 2291da177e4SLinus Torvalds * there was no more memory available. 2301da177e4SLinus Torvalds */ 2311da177e4SLinus Torvalds1: lw v0, (a1) 2321da177e4SLinus Torvalds2: sw a2, (a1) 2331da177e4SLinus Torvalds 2341da177e4SLinus Torvalds .section __ex_table,"a" 2351da177e4SLinus Torvalds PTR 1b, no_mem 2361da177e4SLinus Torvalds PTR 2b, no_mem 2371da177e4SLinus Torvalds .previous 2381da177e4SLinus Torvalds#endif 2391da177e4SLinus Torvalds 2401da177e4SLinus Torvalds sw zero, PT_R7(sp) # success 2411da177e4SLinus Torvalds sw v0, PT_R2(sp) # result 2421da177e4SLinus Torvalds 243edcb98d1SRalf Baechle j o32_syscall_exit # continue like a normal syscall 2441da177e4SLinus Torvalds 2451da177e4SLinus Torvaldsno_mem: li v0, -ENOMEM 2461da177e4SLinus Torvalds jr ra 2471da177e4SLinus Torvalds 2481da177e4SLinus Torvaldsbad_address: 2491da177e4SLinus Torvalds li v0, -EFAULT 2501da177e4SLinus Torvalds jr ra 2511da177e4SLinus Torvalds 2521da177e4SLinus Torvaldsbad_alignment: 2531da177e4SLinus Torvalds li v0, -EINVAL 2541da177e4SLinus Torvalds jr ra 2551da177e4SLinus Torvalds END(mips_atomic_set) 2561da177e4SLinus Torvalds 2571da177e4SLinus Torvalds LEAF(sys_sysmips) 2581da177e4SLinus Torvalds beq a0, MIPS_ATOMIC_SET, mips_atomic_set 2591da177e4SLinus Torvalds j _sys_sysmips 2601da177e4SLinus Torvalds END(sys_sysmips) 2611da177e4SLinus Torvalds 2621da177e4SLinus Torvalds LEAF(sys_syscall) 2631da177e4SLinus Torvalds subu t0, a0, __NR_O32_Linux # check syscall number 2641da177e4SLinus Torvalds sltiu v0, t0, __NR_O32_Linux_syscalls + 1 2651da177e4SLinus Torvalds sll t1, t0, 3 2661da177e4SLinus Torvalds beqz v0, einval 2671da177e4SLinus Torvalds 2681da177e4SLinus Torvalds lw t2, sys_call_table(t1) # syscall routine 2691da177e4SLinus Torvalds 2701da177e4SLinus Torvalds li v1, 4000 - __NR_O32_Linux # index of sys_syscall 2711da177e4SLinus Torvalds beq t0, v1, einval # do not recurse 2721da177e4SLinus Torvalds 2731da177e4SLinus Torvalds /* Some syscalls like execve get their arguments from struct pt_regs 2741da177e4SLinus Torvalds and claim zero arguments in the syscall table. Thus we have to 2751da177e4SLinus Torvalds assume the worst case and shuffle around all potential arguments. 2761da177e4SLinus Torvalds If you want performance, don't use indirect syscalls. */ 2771da177e4SLinus Torvalds 2781da177e4SLinus Torvalds move a0, a1 # shift argument registers 2791da177e4SLinus Torvalds move a1, a2 2801da177e4SLinus Torvalds move a2, a3 2811da177e4SLinus Torvalds lw a3, 16(sp) 2821da177e4SLinus Torvalds lw t4, 20(sp) 2831da177e4SLinus Torvalds lw t5, 24(sp) 2841da177e4SLinus Torvalds lw t6, 28(sp) 2851da177e4SLinus Torvalds sw t4, 16(sp) 2861da177e4SLinus Torvalds sw t5, 20(sp) 2871da177e4SLinus Torvalds sw t6, 24(sp) 2881da177e4SLinus Torvalds sw a0, PT_R4(sp) # .. and push back a0 - a3, some 2891da177e4SLinus Torvalds sw a1, PT_R5(sp) # syscalls expect them there 2901da177e4SLinus Torvalds sw a2, PT_R6(sp) 2911da177e4SLinus Torvalds sw a3, PT_R7(sp) 2921da177e4SLinus Torvalds sw a3, PT_R26(sp) # update a3 for syscall restarting 2931da177e4SLinus Torvalds jr t2 2941da177e4SLinus Torvalds /* Unreached */ 2951da177e4SLinus Torvalds 2961da177e4SLinus Torvaldseinval: li v0, -EINVAL 2971da177e4SLinus Torvalds jr ra 2981da177e4SLinus Torvalds END(sys_syscall) 2991da177e4SLinus Torvalds 3001da177e4SLinus Torvalds .macro fifty ptr, nargs, from=1, to=50 3011da177e4SLinus Torvalds sys \ptr \nargs 3021da177e4SLinus Torvalds .if \to-\from 3031da177e4SLinus Torvalds fifty \ptr,\nargs,"(\from+1)",\to 3041da177e4SLinus Torvalds .endif 3051da177e4SLinus Torvalds .endm 3061da177e4SLinus Torvalds 3071da177e4SLinus Torvalds .macro mille ptr, nargs, from=1, to=20 3081da177e4SLinus Torvalds fifty \ptr,\nargs 3091da177e4SLinus Torvalds .if \to-\from 3101da177e4SLinus Torvalds mille \ptr,\nargs,"(\from+1)",\to 3111da177e4SLinus Torvalds .endif 3121da177e4SLinus Torvalds .endm 3131da177e4SLinus Torvalds 3141da177e4SLinus Torvalds .macro syscalltable 3151da177e4SLinus Torvalds sys sys_syscall 8 /* 4000 */ 3161da177e4SLinus Torvalds sys sys_exit 1 3171da177e4SLinus Torvalds sys sys_fork 0 3181da177e4SLinus Torvalds sys sys_read 3 3191da177e4SLinus Torvalds sys sys_write 3 3201da177e4SLinus Torvalds sys sys_open 3 /* 4005 */ 3211da177e4SLinus Torvalds sys sys_close 1 3221da177e4SLinus Torvalds sys sys_waitpid 3 3231da177e4SLinus Torvalds sys sys_creat 2 3241da177e4SLinus Torvalds sys sys_link 2 3251da177e4SLinus Torvalds sys sys_unlink 1 /* 4010 */ 3261da177e4SLinus Torvalds sys sys_execve 0 3271da177e4SLinus Torvalds sys sys_chdir 1 3281da177e4SLinus Torvalds sys sys_time 1 3291da177e4SLinus Torvalds sys sys_mknod 3 3301da177e4SLinus Torvalds sys sys_chmod 2 /* 4015 */ 3311da177e4SLinus Torvalds sys sys_lchown 3 3321da177e4SLinus Torvalds sys sys_ni_syscall 0 3331da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_stat */ 3341da177e4SLinus Torvalds sys sys_lseek 3 3351da177e4SLinus Torvalds sys sys_getpid 0 /* 4020 */ 3361da177e4SLinus Torvalds sys sys_mount 5 3371da177e4SLinus Torvalds sys sys_oldumount 1 3381da177e4SLinus Torvalds sys sys_setuid 1 3391da177e4SLinus Torvalds sys sys_getuid 0 3401da177e4SLinus Torvalds sys sys_stime 1 /* 4025 */ 3411da177e4SLinus Torvalds sys sys_ptrace 4 3421da177e4SLinus Torvalds sys sys_alarm 1 3431da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_fstat */ 3441da177e4SLinus Torvalds sys sys_pause 0 3451da177e4SLinus Torvalds sys sys_utime 2 /* 4030 */ 3461da177e4SLinus Torvalds sys sys_ni_syscall 0 3471da177e4SLinus Torvalds sys sys_ni_syscall 0 3481da177e4SLinus Torvalds sys sys_access 2 3491da177e4SLinus Torvalds sys sys_nice 1 3501da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4035 */ 3511da177e4SLinus Torvalds sys sys_sync 0 3521da177e4SLinus Torvalds sys sys_kill 2 3531da177e4SLinus Torvalds sys sys_rename 2 3541da177e4SLinus Torvalds sys sys_mkdir 2 3551da177e4SLinus Torvalds sys sys_rmdir 1 /* 4040 */ 3561da177e4SLinus Torvalds sys sys_dup 1 3578213bbf9SRalf Baechle sys sysm_pipe 0 3581da177e4SLinus Torvalds sys sys_times 1 3591da177e4SLinus Torvalds sys sys_ni_syscall 0 3601da177e4SLinus Torvalds sys sys_brk 1 /* 4045 */ 3611da177e4SLinus Torvalds sys sys_setgid 1 3621da177e4SLinus Torvalds sys sys_getgid 0 3631da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was signal(2) */ 3641da177e4SLinus Torvalds sys sys_geteuid 0 3651da177e4SLinus Torvalds sys sys_getegid 0 /* 4050 */ 3661da177e4SLinus Torvalds sys sys_acct 1 3671da177e4SLinus Torvalds sys sys_umount 2 3681da177e4SLinus Torvalds sys sys_ni_syscall 0 3691da177e4SLinus Torvalds sys sys_ioctl 3 3701da177e4SLinus Torvalds sys sys_fcntl 3 /* 4055 */ 3711da177e4SLinus Torvalds sys sys_ni_syscall 2 3721da177e4SLinus Torvalds sys sys_setpgid 2 3731da177e4SLinus Torvalds sys sys_ni_syscall 0 3741da177e4SLinus Torvalds sys sys_olduname 1 3751da177e4SLinus Torvalds sys sys_umask 1 /* 4060 */ 3761da177e4SLinus Torvalds sys sys_chroot 1 3771da177e4SLinus Torvalds sys sys_ustat 2 3781da177e4SLinus Torvalds sys sys_dup2 2 3791da177e4SLinus Torvalds sys sys_getppid 0 3801da177e4SLinus Torvalds sys sys_getpgrp 0 /* 4065 */ 3811da177e4SLinus Torvalds sys sys_setsid 0 3821da177e4SLinus Torvalds sys sys_sigaction 3 3831da177e4SLinus Torvalds sys sys_sgetmask 0 3841da177e4SLinus Torvalds sys sys_ssetmask 1 3851da177e4SLinus Torvalds sys sys_setreuid 2 /* 4070 */ 3861da177e4SLinus Torvalds sys sys_setregid 2 3871da177e4SLinus Torvalds sys sys_sigsuspend 0 3881da177e4SLinus Torvalds sys sys_sigpending 1 3891da177e4SLinus Torvalds sys sys_sethostname 2 3901da177e4SLinus Torvalds sys sys_setrlimit 2 /* 4075 */ 3911da177e4SLinus Torvalds sys sys_getrlimit 2 3921da177e4SLinus Torvalds sys sys_getrusage 2 3931da177e4SLinus Torvalds sys sys_gettimeofday 2 3941da177e4SLinus Torvalds sys sys_settimeofday 2 3951da177e4SLinus Torvalds sys sys_getgroups 2 /* 4080 */ 3961da177e4SLinus Torvalds sys sys_setgroups 2 3971da177e4SLinus Torvalds sys sys_ni_syscall 0 /* old_select */ 3981da177e4SLinus Torvalds sys sys_symlink 2 3991da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_lstat */ 4001da177e4SLinus Torvalds sys sys_readlink 3 /* 4085 */ 4011da177e4SLinus Torvalds sys sys_uselib 1 4021da177e4SLinus Torvalds sys sys_swapon 2 4031da177e4SLinus Torvalds sys sys_reboot 3 4041da177e4SLinus Torvalds sys old_readdir 3 4051da177e4SLinus Torvalds sys old_mmap 6 /* 4090 */ 4061da177e4SLinus Torvalds sys sys_munmap 2 4071da177e4SLinus Torvalds sys sys_truncate 2 4081da177e4SLinus Torvalds sys sys_ftruncate 2 4091da177e4SLinus Torvalds sys sys_fchmod 2 4101da177e4SLinus Torvalds sys sys_fchown 3 /* 4095 */ 4111da177e4SLinus Torvalds sys sys_getpriority 2 4121da177e4SLinus Torvalds sys sys_setpriority 3 4131da177e4SLinus Torvalds sys sys_ni_syscall 0 4141da177e4SLinus Torvalds sys sys_statfs 2 4151da177e4SLinus Torvalds sys sys_fstatfs 2 /* 4100 */ 4161da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was ioperm(2) */ 4171da177e4SLinus Torvalds sys sys_socketcall 2 4181da177e4SLinus Torvalds sys sys_syslog 3 4191da177e4SLinus Torvalds sys sys_setitimer 3 4201da177e4SLinus Torvalds sys sys_getitimer 2 /* 4105 */ 4211da177e4SLinus Torvalds sys sys_newstat 2 4221da177e4SLinus Torvalds sys sys_newlstat 2 4231da177e4SLinus Torvalds sys sys_newfstat 2 4241da177e4SLinus Torvalds sys sys_uname 1 4251da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4110 was iopl(2) */ 4261da177e4SLinus Torvalds sys sys_vhangup 0 4271da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_idle() */ 4281da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_vm86 */ 4291da177e4SLinus Torvalds sys sys_wait4 4 4301da177e4SLinus Torvalds sys sys_swapoff 1 /* 4115 */ 4311da177e4SLinus Torvalds sys sys_sysinfo 1 4321da177e4SLinus Torvalds sys sys_ipc 6 4331da177e4SLinus Torvalds sys sys_fsync 1 4341da177e4SLinus Torvalds sys sys_sigreturn 0 4351da177e4SLinus Torvalds sys sys_clone 0 /* 4120 */ 4361da177e4SLinus Torvalds sys sys_setdomainname 2 4371da177e4SLinus Torvalds sys sys_newuname 1 4381da177e4SLinus Torvalds sys sys_ni_syscall 0 /* sys_modify_ldt */ 4391da177e4SLinus Torvalds sys sys_adjtimex 1 4401da177e4SLinus Torvalds sys sys_mprotect 3 /* 4125 */ 4411da177e4SLinus Torvalds sys sys_sigprocmask 3 4421da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was create_module */ 4431da177e4SLinus Torvalds sys sys_init_module 5 4441da177e4SLinus Torvalds sys sys_delete_module 1 4451da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4130 was get_kernel_syms */ 4461da177e4SLinus Torvalds sys sys_quotactl 4 4471da177e4SLinus Torvalds sys sys_getpgid 1 4481da177e4SLinus Torvalds sys sys_fchdir 1 4491da177e4SLinus Torvalds sys sys_bdflush 2 4501da177e4SLinus Torvalds sys sys_sysfs 3 /* 4135 */ 4511da177e4SLinus Torvalds sys sys_personality 1 4521da177e4SLinus Torvalds sys sys_ni_syscall 0 /* for afs_syscall */ 4531da177e4SLinus Torvalds sys sys_setfsuid 1 4541da177e4SLinus Torvalds sys sys_setfsgid 1 4551da177e4SLinus Torvalds sys sys_llseek 5 /* 4140 */ 4561da177e4SLinus Torvalds sys sys_getdents 3 4571da177e4SLinus Torvalds sys sys_select 5 4581da177e4SLinus Torvalds sys sys_flock 2 4591da177e4SLinus Torvalds sys sys_msync 3 4601da177e4SLinus Torvalds sys sys_readv 3 /* 4145 */ 4611da177e4SLinus Torvalds sys sys_writev 3 4621da177e4SLinus Torvalds sys sys_cacheflush 3 4631da177e4SLinus Torvalds sys sys_cachectl 3 4641da177e4SLinus Torvalds sys sys_sysmips 4 4651da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4150 */ 4661da177e4SLinus Torvalds sys sys_getsid 1 4671da177e4SLinus Torvalds sys sys_fdatasync 1 4681da177e4SLinus Torvalds sys sys_sysctl 1 4691da177e4SLinus Torvalds sys sys_mlock 2 4701da177e4SLinus Torvalds sys sys_munlock 2 /* 4155 */ 4711da177e4SLinus Torvalds sys sys_mlockall 1 4721da177e4SLinus Torvalds sys sys_munlockall 0 4731da177e4SLinus Torvalds sys sys_sched_setparam 2 4741da177e4SLinus Torvalds sys sys_sched_getparam 2 4751da177e4SLinus Torvalds sys sys_sched_setscheduler 3 /* 4160 */ 4761da177e4SLinus Torvalds sys sys_sched_getscheduler 1 4771da177e4SLinus Torvalds sys sys_sched_yield 0 4781da177e4SLinus Torvalds sys sys_sched_get_priority_max 1 4791da177e4SLinus Torvalds sys sys_sched_get_priority_min 1 4801da177e4SLinus Torvalds sys sys_sched_rr_get_interval 2 /* 4165 */ 4811da177e4SLinus Torvalds sys sys_nanosleep, 2 4827dbdf43cSYoichi Yuasa sys sys_mremap, 5 4831da177e4SLinus Torvalds sys sys_accept 3 4841da177e4SLinus Torvalds sys sys_bind 3 4851da177e4SLinus Torvalds sys sys_connect 3 /* 4170 */ 4861da177e4SLinus Torvalds sys sys_getpeername 3 4871da177e4SLinus Torvalds sys sys_getsockname 3 4881da177e4SLinus Torvalds sys sys_getsockopt 5 4891da177e4SLinus Torvalds sys sys_listen 2 4901da177e4SLinus Torvalds sys sys_recv 4 /* 4175 */ 4911da177e4SLinus Torvalds sys sys_recvfrom 6 4921da177e4SLinus Torvalds sys sys_recvmsg 3 4931da177e4SLinus Torvalds sys sys_send 4 4941da177e4SLinus Torvalds sys sys_sendmsg 3 4951da177e4SLinus Torvalds sys sys_sendto 6 /* 4180 */ 4961da177e4SLinus Torvalds sys sys_setsockopt 5 4971da177e4SLinus Torvalds sys sys_shutdown 2 4981da177e4SLinus Torvalds sys sys_socket 3 4991da177e4SLinus Torvalds sys sys_socketpair 4 5001da177e4SLinus Torvalds sys sys_setresuid 3 /* 4185 */ 5011da177e4SLinus Torvalds sys sys_getresuid 3 5021da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_query_module */ 5031da177e4SLinus Torvalds sys sys_poll 3 5041da177e4SLinus Torvalds sys sys_nfsservctl 3 5051da177e4SLinus Torvalds sys sys_setresgid 3 /* 4190 */ 5061da177e4SLinus Torvalds sys sys_getresgid 3 5071da177e4SLinus Torvalds sys sys_prctl 5 5081da177e4SLinus Torvalds sys sys_rt_sigreturn 0 5091da177e4SLinus Torvalds sys sys_rt_sigaction 4 5101da177e4SLinus Torvalds sys sys_rt_sigprocmask 4 /* 4195 */ 5111da177e4SLinus Torvalds sys sys_rt_sigpending 2 5121da177e4SLinus Torvalds sys sys_rt_sigtimedwait 4 5131da177e4SLinus Torvalds sys sys_rt_sigqueueinfo 3 5141da177e4SLinus Torvalds sys sys_rt_sigsuspend 0 5151da177e4SLinus Torvalds sys sys_pread64 6 /* 4200 */ 5161da177e4SLinus Torvalds sys sys_pwrite64 6 5171da177e4SLinus Torvalds sys sys_chown 3 5181da177e4SLinus Torvalds sys sys_getcwd 2 5191da177e4SLinus Torvalds sys sys_capget 2 5201da177e4SLinus Torvalds sys sys_capset 2 /* 4205 */ 5211da177e4SLinus Torvalds sys sys_sigaltstack 0 5221da177e4SLinus Torvalds sys sys_sendfile 4 5231da177e4SLinus Torvalds sys sys_ni_syscall 0 5241da177e4SLinus Torvalds sys sys_ni_syscall 0 5251da177e4SLinus Torvalds sys sys_mmap2 6 /* 4210 */ 5261da177e4SLinus Torvalds sys sys_truncate64 4 5271da177e4SLinus Torvalds sys sys_ftruncate64 4 5281da177e4SLinus Torvalds sys sys_stat64 2 5291da177e4SLinus Torvalds sys sys_lstat64 2 5301da177e4SLinus Torvalds sys sys_fstat64 2 /* 4215 */ 5311da177e4SLinus Torvalds sys sys_pivot_root 2 5321da177e4SLinus Torvalds sys sys_mincore 3 5331da177e4SLinus Torvalds sys sys_madvise 3 5341da177e4SLinus Torvalds sys sys_getdents64 3 5351da177e4SLinus Torvalds sys sys_fcntl64 3 /* 4220 */ 5361da177e4SLinus Torvalds sys sys_ni_syscall 0 5371da177e4SLinus Torvalds sys sys_gettid 0 5381da177e4SLinus Torvalds sys sys_readahead 5 5391da177e4SLinus Torvalds sys sys_setxattr 5 5401da177e4SLinus Torvalds sys sys_lsetxattr 5 /* 4225 */ 5411da177e4SLinus Torvalds sys sys_fsetxattr 5 5421da177e4SLinus Torvalds sys sys_getxattr 4 5431da177e4SLinus Torvalds sys sys_lgetxattr 4 5441da177e4SLinus Torvalds sys sys_fgetxattr 4 5451da177e4SLinus Torvalds sys sys_listxattr 3 /* 4230 */ 5461da177e4SLinus Torvalds sys sys_llistxattr 3 5471da177e4SLinus Torvalds sys sys_flistxattr 3 5481da177e4SLinus Torvalds sys sys_removexattr 2 5491da177e4SLinus Torvalds sys sys_lremovexattr 2 5501da177e4SLinus Torvalds sys sys_fremovexattr 2 /* 4235 */ 5511da177e4SLinus Torvalds sys sys_tkill 2 5521da177e4SLinus Torvalds sys sys_sendfile64 5 55390a67b59SThiemo Seufer sys sys_futex 6 554f088fc84SRalf Baechle#ifdef CONFIG_MIPS_MT_FPAFF 555f088fc84SRalf Baechle /* 556f088fc84SRalf Baechle * For FPU affinity scheduling on MIPS MT processors, we need to 557f088fc84SRalf Baechle * intercept sys_sched_xxxaffinity() calls until we get a proper hook 558f088fc84SRalf Baechle * in kernel/sched.c. Considered only temporary we only support these 559f088fc84SRalf Baechle * hooks for the 32-bit kernel - there is no MIPS64 MT processor atm. 560f088fc84SRalf Baechle */ 561f088fc84SRalf Baechle sys mipsmt_sys_sched_setaffinity 3 562f088fc84SRalf Baechle sys mipsmt_sys_sched_getaffinity 3 563f088fc84SRalf Baechle#else 5641da177e4SLinus Torvalds sys sys_sched_setaffinity 3 5651da177e4SLinus Torvalds sys sys_sched_getaffinity 3 /* 4240 */ 566f088fc84SRalf Baechle#endif /* CONFIG_MIPS_MT_FPAFF */ 5671da177e4SLinus Torvalds sys sys_io_setup 2 5681da177e4SLinus Torvalds sys sys_io_destroy 1 5691da177e4SLinus Torvalds sys sys_io_getevents 5 5701da177e4SLinus Torvalds sys sys_io_submit 3 5711da177e4SLinus Torvalds sys sys_io_cancel 3 /* 4245 */ 5721da177e4SLinus Torvalds sys sys_exit_group 1 5730d507d61SRalf Baechle sys sys_lookup_dcookie 4 5741da177e4SLinus Torvalds sys sys_epoll_create 1 5751da177e4SLinus Torvalds sys sys_epoll_ctl 4 5761da177e4SLinus Torvalds sys sys_epoll_wait 3 /* 4250 */ 5771da177e4SLinus Torvalds sys sys_remap_file_pages 5 5781da177e4SLinus Torvalds sys sys_set_tid_address 1 5791da177e4SLinus Torvalds sys sys_restart_syscall 0 5801da177e4SLinus Torvalds sys sys_fadvise64_64 7 5811da177e4SLinus Torvalds sys sys_statfs64 3 /* 4255 */ 5821da177e4SLinus Torvalds sys sys_fstatfs64 2 5831da177e4SLinus Torvalds sys sys_timer_create 3 5841da177e4SLinus Torvalds sys sys_timer_settime 4 5851da177e4SLinus Torvalds sys sys_timer_gettime 2 5861da177e4SLinus Torvalds sys sys_timer_getoverrun 1 /* 4260 */ 5871da177e4SLinus Torvalds sys sys_timer_delete 1 5881da177e4SLinus Torvalds sys sys_clock_settime 2 5891da177e4SLinus Torvalds sys sys_clock_gettime 2 5901da177e4SLinus Torvalds sys sys_clock_getres 2 5911da177e4SLinus Torvalds sys sys_clock_nanosleep 4 /* 4265 */ 5921da177e4SLinus Torvalds sys sys_tgkill 3 5931da177e4SLinus Torvalds sys sys_utimes 2 5941da177e4SLinus Torvalds sys sys_mbind 4 5951da177e4SLinus Torvalds sys sys_ni_syscall 0 /* sys_get_mempolicy */ 5961da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4270 sys_set_mempolicy */ 5971da177e4SLinus Torvalds sys sys_mq_open 4 5981da177e4SLinus Torvalds sys sys_mq_unlink 1 5991da177e4SLinus Torvalds sys sys_mq_timedsend 5 6001da177e4SLinus Torvalds sys sys_mq_timedreceive 5 6011da177e4SLinus Torvalds sys sys_mq_notify 2 /* 4275 */ 6021da177e4SLinus Torvalds sys sys_mq_getsetattr 3 6031da177e4SLinus Torvalds sys sys_ni_syscall 0 /* sys_vserver */ 604a19050f3SRalf Baechle sys sys_waitid 5 6051da177e4SLinus Torvalds sys sys_ni_syscall 0 /* available, was setaltroot */ 606e50c0a8fSRalf Baechle sys sys_add_key 5 /* 4280 */ 6071da177e4SLinus Torvalds sys sys_request_key 4 6081da177e4SLinus Torvalds sys sys_keyctl 5 6093c37026dSRalf Baechle sys sys_set_thread_area 1 6107db36c85SRalf Baechle sys sys_inotify_init 0 6117db36c85SRalf Baechle sys sys_inotify_add_watch 3 /* 4285 */ 6127db36c85SRalf Baechle sys sys_inotify_rm_watch 2 61372bf8914SRalf Baechle sys sys_migrate_pages 4 61472bf8914SRalf Baechle sys sys_openat 4 61572bf8914SRalf Baechle sys sys_mkdirat 3 61672bf8914SRalf Baechle sys sys_mknodat 4 /* 4290 */ 61772bf8914SRalf Baechle sys sys_fchownat 5 61872bf8914SRalf Baechle sys sys_futimesat 3 619326a6257SYoichi Yuasa sys sys_fstatat64 4 62072bf8914SRalf Baechle sys sys_unlinkat 3 62172bf8914SRalf Baechle sys sys_renameat 4 /* 4295 */ 622c04030e1SUlrich Drepper sys sys_linkat 5 62372bf8914SRalf Baechle sys sys_symlinkat 3 62472bf8914SRalf Baechle sys sys_readlinkat 4 62572bf8914SRalf Baechle sys sys_fchmodat 3 62672bf8914SRalf Baechle sys sys_faccessat 3 /* 4300 */ 62772bf8914SRalf Baechle sys sys_pselect6 6 62872bf8914SRalf Baechle sys sys_ppoll 5 62972bf8914SRalf Baechle sys sys_unshare 1 630f115da9cSRalf Baechle sys sys_splice 4 631a8d587a7SRalf Baechle sys sys_sync_file_range 7 /* 4305 */ 632136d47d3SRalf Baechle sys sys_tee 4 633722cfd90SRalf Baechle sys sys_vmsplice 4 634722cfd90SRalf Baechle sys sys_move_pages 6 6357fdeb048SAtsushi Nemoto sys sys_set_robust_list 2 636d2bcf87dSRalf Baechle sys sys_get_robust_list 3 /* 4310 */ 637583bb86fSNicolas Schichan sys sys_kexec_load 4 638991ea26dSRalf Baechle sys sys_getcpu 3 639991ea26dSRalf Baechle sys sys_epoll_pwait 6 64008253b39SRalf Baechle sys sys_ioprio_set 3 6417a6d4f38SAtsushi Nemoto sys sys_ioprio_get 2 /* 4315 */ 6427a6d4f38SAtsushi Nemoto sys sys_utimensat 4 6437a6d4f38SAtsushi Nemoto sys sys_signalfd 3 6444d672e7aSDavide Libenzi sys sys_ni_syscall 0 6457a6d4f38SAtsushi Nemoto sys sys_eventfd 1 6464dc46775SRalf Baechle sys sys_fallocate 6 /* 4320 */ 6476783fe62SDmitri Vorobiev sys sys_timerfd_create 2 6486783fe62SDmitri Vorobiev sys sys_timerfd_gettime 2 6496783fe62SDmitri Vorobiev sys sys_timerfd_settime 4 6503885b71bSRalf Baechle sys sys_signalfd4 4 6513885b71bSRalf Baechle sys sys_eventfd2 2 /* 4325 */ 6523885b71bSRalf Baechle sys sys_epoll_create1 1 6533885b71bSRalf Baechle sys sys_dup3 3 6543885b71bSRalf Baechle sys sys_pipe2 2 6553885b71bSRalf Baechle sys sys_inotify_init1 1 6561da177e4SLinus Torvalds .endm 6571da177e4SLinus Torvalds 6581da177e4SLinus Torvalds /* We pre-compute the number of _instruction_ bytes needed to 6591da177e4SLinus Torvalds load or store the arguments 6-8. Negative values are ignored. */ 6601da177e4SLinus Torvalds 6611da177e4SLinus Torvalds .macro sys function, nargs 6621da177e4SLinus Torvalds PTR \function 6631da177e4SLinus Torvalds LONG (\nargs << 2) - (5 << 2) 6641da177e4SLinus Torvalds .endm 6651da177e4SLinus Torvalds 6661da177e4SLinus Torvalds .align 3 6671da177e4SLinus Torvalds .type sys_call_table,@object 6681da177e4SLinus TorvaldsEXPORT(sys_call_table) 6691da177e4SLinus Torvalds syscalltable 6701da177e4SLinus Torvalds .size sys_call_table, . - sys_call_table 671