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 31192ef366SRalf Baechle#ifdef CONFIG_TRACE_IRQFLAGS 32192ef366SRalf Baechle TRACE_IRQS_ON 33192ef366SRalf Baechle#ifdef CONFIG_64BIT 34192ef366SRalf Baechle LONG_L $8, PT_R8(sp) 35192ef366SRalf Baechle LONG_L $9, PT_R9(sp) 36192ef366SRalf Baechle#endif 37192ef366SRalf Baechle LONG_L $7, PT_R7(sp) 38192ef366SRalf Baechle LONG_L $6, PT_R6(sp) 39192ef366SRalf Baechle LONG_L $5, PT_R5(sp) 40192ef366SRalf Baechle LONG_L $4, PT_R4(sp) 41192ef366SRalf Baechle LONG_L $2, PT_R2(sp) 42192ef366SRalf Baechle#endif 431da177e4SLinus Torvalds STI 441da177e4SLinus Torvalds .set at 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds lw t1, PT_EPC(sp) # skip syscall on return 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds#if defined(CONFIG_BINFMT_IRIX) 491da177e4SLinus Torvalds sltiu t0, v0, MAX_SYSCALL_NO + 1 # check syscall number 501da177e4SLinus Torvalds#else 511da177e4SLinus Torvalds subu v0, v0, __NR_O32_Linux # check syscall number 521da177e4SLinus Torvalds sltiu t0, v0, __NR_O32_Linux_syscalls + 1 531da177e4SLinus Torvalds#endif 541da177e4SLinus Torvalds addiu t1, 4 # skip to next instruction 551da177e4SLinus Torvalds sw t1, PT_EPC(sp) 561da177e4SLinus Torvalds beqz t0, illegal_syscall 571da177e4SLinus Torvalds 581da177e4SLinus Torvalds sll t0, v0, 3 591da177e4SLinus Torvalds la t1, sys_call_table 601da177e4SLinus Torvalds addu t1, t0 611da177e4SLinus Torvalds lw t2, (t1) # syscall routine 621da177e4SLinus Torvalds lw t3, 4(t1) # >= 0 if we need stack arguments 631da177e4SLinus Torvalds beqz t2, illegal_syscall 641da177e4SLinus Torvalds 651da177e4SLinus Torvalds sw a3, PT_R26(sp) # save a3 for syscall restarting 661da177e4SLinus Torvalds bgez t3, stackargs 671da177e4SLinus Torvalds 681da177e4SLinus Torvaldsstack_done: 691da177e4SLinus Torvalds lw t0, TI_FLAGS($28) # syscall tracing enabled? 701da177e4SLinus Torvalds li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT 711da177e4SLinus Torvalds and t0, t1 721da177e4SLinus Torvalds bnez t0, syscall_trace_entry # -> yes 731da177e4SLinus Torvalds 741da177e4SLinus Torvalds jalr t2 # Do The Real Thing (TM) 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds li t0, -EMAXERRNO - 1 # error? 771da177e4SLinus Torvalds sltu t0, t0, v0 781da177e4SLinus Torvalds sw t0, PT_R7(sp) # set error flag 791da177e4SLinus Torvalds beqz t0, 1f 801da177e4SLinus Torvalds 811da177e4SLinus Torvalds negu v0 # error 821da177e4SLinus Torvalds sw v0, PT_R0(sp) # set flag for syscall 831da177e4SLinus Torvalds # restarting 841da177e4SLinus Torvalds1: sw v0, PT_R2(sp) # result 851da177e4SLinus Torvalds 861da177e4SLinus Torvaldso32_syscall_exit: 871da177e4SLinus Torvalds local_irq_disable # make sure need_resched and 881da177e4SLinus Torvalds # signals dont change between 891da177e4SLinus Torvalds # sampling and return 901da177e4SLinus Torvalds lw a2, TI_FLAGS($28) # current->work 911da177e4SLinus Torvalds li t0, _TIF_ALLWORK_MASK 921da177e4SLinus Torvalds and t0, a2 931da177e4SLinus Torvalds bnez t0, o32_syscall_exit_work 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds j restore_partial 961da177e4SLinus Torvalds 971da177e4SLinus Torvaldso32_syscall_exit_work: 981da177e4SLinus Torvalds j syscall_exit_work_partial 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds/* ------------------------------------------------------------------------ */ 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvaldssyscall_trace_entry: 1031da177e4SLinus Torvalds SAVE_STATIC 1041da177e4SLinus Torvalds move s0, t2 1051da177e4SLinus Torvalds move a0, sp 1061da177e4SLinus Torvalds li a1, 0 1071da177e4SLinus Torvalds jal do_syscall_trace 1081da177e4SLinus Torvalds 10904a7052cSRalf Baechle move t0, s0 11004a7052cSRalf Baechle RESTORE_STATIC 1111da177e4SLinus Torvalds lw a0, PT_R4(sp) # Restore argument registers 1121da177e4SLinus Torvalds lw a1, PT_R5(sp) 1131da177e4SLinus Torvalds lw a2, PT_R6(sp) 1141da177e4SLinus Torvalds lw a3, PT_R7(sp) 11504a7052cSRalf Baechle jalr t0 1161da177e4SLinus Torvalds 1171da177e4SLinus Torvalds li t0, -EMAXERRNO - 1 # error? 1181da177e4SLinus Torvalds sltu t0, t0, v0 1191da177e4SLinus Torvalds sw t0, PT_R7(sp) # set error flag 1201da177e4SLinus Torvalds beqz t0, 1f 1211da177e4SLinus Torvalds 1221da177e4SLinus Torvalds negu v0 # error 1231da177e4SLinus Torvalds sw v0, PT_R0(sp) # set flag for syscall 1241da177e4SLinus Torvalds # restarting 1251da177e4SLinus Torvalds1: sw v0, PT_R2(sp) # result 1261da177e4SLinus Torvalds 1271da177e4SLinus Torvalds j syscall_exit 1281da177e4SLinus Torvalds 1291da177e4SLinus Torvalds/* ------------------------------------------------------------------------ */ 1301da177e4SLinus Torvalds 1311da177e4SLinus Torvalds /* 1321da177e4SLinus Torvalds * More than four arguments. Try to deal with it by copying the 1331da177e4SLinus Torvalds * stack arguments from the user stack to the kernel stack. 1341da177e4SLinus Torvalds * This Sucks (TM). 1351da177e4SLinus Torvalds */ 1361da177e4SLinus Torvaldsstackargs: 1371da177e4SLinus Torvalds lw t0, PT_R29(sp) # get old user stack pointer 1381da177e4SLinus Torvalds 1391da177e4SLinus Torvalds /* 1401da177e4SLinus Torvalds * We intentionally keep the kernel stack a little below the top of 1411da177e4SLinus Torvalds * userspace so we don't have to do a slower byte accurate check here. 1421da177e4SLinus Torvalds */ 1431da177e4SLinus Torvalds lw t5, TI_ADDR_LIMIT($28) 1441da177e4SLinus Torvalds addu t4, t0, 32 1451da177e4SLinus Torvalds and t5, t4 1461da177e4SLinus Torvalds bltz t5, bad_stack # -> sp is bad 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvalds /* Ok, copy the args from the luser stack to the kernel stack. 1491da177e4SLinus Torvalds * t3 is the precomputed number of instruction bytes needed to 1501da177e4SLinus Torvalds * load or store arguments 6-8. 1511da177e4SLinus Torvalds */ 1521da177e4SLinus Torvalds 1531da177e4SLinus Torvalds la t1, 5f # load up to 3 arguments 1541da177e4SLinus Torvalds subu t1, t3 1551da177e4SLinus Torvalds1: lw t5, 16(t0) # argument #5 from usp 1561da177e4SLinus Torvalds .set push 1571da177e4SLinus Torvalds .set noreorder 1581da177e4SLinus Torvalds .set nomacro 1591da177e4SLinus Torvalds jr t1 1601da177e4SLinus Torvalds addiu t1, 6f - 5f 1611da177e4SLinus Torvalds 1621da177e4SLinus Torvalds2: lw t8, 28(t0) # argument #8 from usp 1631da177e4SLinus Torvalds3: lw t7, 24(t0) # argument #7 from usp 1641da177e4SLinus Torvalds4: lw t6, 20(t0) # argument #6 from usp 1651da177e4SLinus Torvalds5: jr t1 1661da177e4SLinus Torvalds sw t5, 16(sp) # argument #5 to ksp 1671da177e4SLinus Torvalds 1681da177e4SLinus Torvalds sw t8, 28(sp) # argument #8 to ksp 1691da177e4SLinus Torvalds sw t7, 24(sp) # argument #7 to ksp 1701da177e4SLinus Torvalds sw t6, 20(sp) # argument #6 to ksp 1711da177e4SLinus Torvalds6: j stack_done # go back 1721da177e4SLinus Torvalds nop 1731da177e4SLinus Torvalds .set pop 1741da177e4SLinus Torvalds 1751da177e4SLinus Torvalds .section __ex_table,"a" 1761da177e4SLinus Torvalds PTR 1b,bad_stack 1771da177e4SLinus Torvalds PTR 2b,bad_stack 1781da177e4SLinus Torvalds PTR 3b,bad_stack 1791da177e4SLinus Torvalds PTR 4b,bad_stack 1801da177e4SLinus Torvalds .previous 1811da177e4SLinus Torvalds 1821da177e4SLinus Torvalds /* 1831da177e4SLinus Torvalds * The stackpointer for a call with more than 4 arguments is bad. 1841da177e4SLinus Torvalds * We probably should handle this case a bit more drastic. 1851da177e4SLinus Torvalds */ 1861da177e4SLinus Torvaldsbad_stack: 1871da177e4SLinus Torvalds negu v0 # error 1881da177e4SLinus Torvalds sw v0, PT_R0(sp) 1891da177e4SLinus Torvalds sw v0, PT_R2(sp) 1901da177e4SLinus Torvalds li t0, 1 # set error flag 1911da177e4SLinus Torvalds sw t0, PT_R7(sp) 1921da177e4SLinus Torvalds j o32_syscall_exit 1931da177e4SLinus Torvalds 1941da177e4SLinus Torvalds /* 1951da177e4SLinus Torvalds * The system call does not exist in this kernel 1961da177e4SLinus Torvalds */ 1971da177e4SLinus Torvaldsillegal_syscall: 1981da177e4SLinus Torvalds li v0, -ENOSYS # error 1991da177e4SLinus Torvalds sw v0, PT_R2(sp) 2001da177e4SLinus Torvalds li t0, 1 # set error flag 2011da177e4SLinus Torvalds sw t0, PT_R7(sp) 2021da177e4SLinus Torvalds j o32_syscall_exit 2031da177e4SLinus Torvalds END(handle_sys) 2041da177e4SLinus Torvalds 2051da177e4SLinus Torvalds LEAF(mips_atomic_set) 2061da177e4SLinus Torvalds andi v0, a1, 3 # must be word aligned 2071da177e4SLinus Torvalds bnez v0, bad_alignment 2081da177e4SLinus Torvalds 2091da177e4SLinus Torvalds lw v1, TI_ADDR_LIMIT($28) # in legal address range? 2101da177e4SLinus Torvalds addiu a0, a1, 4 2111da177e4SLinus Torvalds or a0, a0, a1 2121da177e4SLinus Torvalds and a0, a0, v1 2131da177e4SLinus Torvalds bltz a0, bad_address 2141da177e4SLinus Torvalds 2151da177e4SLinus Torvalds#ifdef CONFIG_CPU_HAS_LLSC 2161da177e4SLinus Torvalds /* Ok, this is the ll/sc case. World is sane :-) */ 2171da177e4SLinus Torvalds1: ll v0, (a1) 2181da177e4SLinus Torvalds move a0, a2 2191da177e4SLinus Torvalds2: sc a0, (a1) 2201da177e4SLinus Torvalds#if R10000_LLSC_WAR 2211da177e4SLinus Torvalds beqzl a0, 1b 2221da177e4SLinus Torvalds#else 2231da177e4SLinus Torvalds beqz a0, 1b 2241da177e4SLinus Torvalds#endif 2251da177e4SLinus Torvalds 2261da177e4SLinus Torvalds .section __ex_table,"a" 2271da177e4SLinus Torvalds PTR 1b, bad_stack 2281da177e4SLinus Torvalds PTR 2b, bad_stack 2291da177e4SLinus Torvalds .previous 2301da177e4SLinus Torvalds#else 2311da177e4SLinus Torvalds sw a1, 16(sp) 2321da177e4SLinus Torvalds sw a2, 20(sp) 2331da177e4SLinus Torvalds 2341da177e4SLinus Torvalds move a0, sp 2351da177e4SLinus Torvalds move a2, a1 2361da177e4SLinus Torvalds li a1, 1 2371da177e4SLinus Torvalds jal do_page_fault 2381da177e4SLinus Torvalds 2391da177e4SLinus Torvalds lw a1, 16(sp) 2401da177e4SLinus Torvalds lw a2, 20(sp) 2411da177e4SLinus Torvalds 2421da177e4SLinus Torvalds /* 2431da177e4SLinus Torvalds * At this point the page should be readable and writable unless 2441da177e4SLinus Torvalds * there was no more memory available. 2451da177e4SLinus Torvalds */ 2461da177e4SLinus Torvalds1: lw v0, (a1) 2471da177e4SLinus Torvalds2: sw a2, (a1) 2481da177e4SLinus Torvalds 2491da177e4SLinus Torvalds .section __ex_table,"a" 2501da177e4SLinus Torvalds PTR 1b, no_mem 2511da177e4SLinus Torvalds PTR 2b, no_mem 2521da177e4SLinus Torvalds .previous 2531da177e4SLinus Torvalds#endif 2541da177e4SLinus Torvalds 2551da177e4SLinus Torvalds sw zero, PT_R7(sp) # success 2561da177e4SLinus Torvalds sw v0, PT_R2(sp) # result 2571da177e4SLinus Torvalds 258edcb98d1SRalf Baechle j o32_syscall_exit # continue like a normal syscall 2591da177e4SLinus Torvalds 2601da177e4SLinus Torvaldsno_mem: li v0, -ENOMEM 2611da177e4SLinus Torvalds jr ra 2621da177e4SLinus Torvalds 2631da177e4SLinus Torvaldsbad_address: 2641da177e4SLinus Torvalds li v0, -EFAULT 2651da177e4SLinus Torvalds jr ra 2661da177e4SLinus Torvalds 2671da177e4SLinus Torvaldsbad_alignment: 2681da177e4SLinus Torvalds li v0, -EINVAL 2691da177e4SLinus Torvalds jr ra 2701da177e4SLinus Torvalds END(mips_atomic_set) 2711da177e4SLinus Torvalds 2721da177e4SLinus Torvalds LEAF(sys_sysmips) 2731da177e4SLinus Torvalds beq a0, MIPS_ATOMIC_SET, mips_atomic_set 2741da177e4SLinus Torvalds j _sys_sysmips 2751da177e4SLinus Torvalds END(sys_sysmips) 2761da177e4SLinus Torvalds 2771da177e4SLinus Torvalds LEAF(sys_syscall) 2781da177e4SLinus Torvalds#if defined(CONFIG_BINFMT_IRIX) 2791da177e4SLinus Torvalds sltiu v0, a0, MAX_SYSCALL_NO + 1 # check syscall number 2801da177e4SLinus Torvalds#else 2811da177e4SLinus Torvalds subu t0, a0, __NR_O32_Linux # check syscall number 2821da177e4SLinus Torvalds sltiu v0, t0, __NR_O32_Linux_syscalls + 1 2831da177e4SLinus Torvalds#endif 2841da177e4SLinus Torvalds sll t1, t0, 3 2851da177e4SLinus Torvalds beqz v0, einval 2861da177e4SLinus Torvalds 2871da177e4SLinus Torvalds lw t2, sys_call_table(t1) # syscall routine 2881da177e4SLinus Torvalds 2891da177e4SLinus Torvalds#if defined(CONFIG_BINFMT_IRIX) 2901da177e4SLinus Torvalds li v1, 4000 # nr of sys_syscall 2911da177e4SLinus Torvalds#else 2921da177e4SLinus Torvalds li v1, 4000 - __NR_O32_Linux # index of sys_syscall 2931da177e4SLinus Torvalds#endif 2941da177e4SLinus Torvalds beq t0, v1, einval # do not recurse 2951da177e4SLinus Torvalds 2961da177e4SLinus Torvalds /* Some syscalls like execve get their arguments from struct pt_regs 2971da177e4SLinus Torvalds and claim zero arguments in the syscall table. Thus we have to 2981da177e4SLinus Torvalds assume the worst case and shuffle around all potential arguments. 2991da177e4SLinus Torvalds If you want performance, don't use indirect syscalls. */ 3001da177e4SLinus Torvalds 3011da177e4SLinus Torvalds move a0, a1 # shift argument registers 3021da177e4SLinus Torvalds move a1, a2 3031da177e4SLinus Torvalds move a2, a3 3041da177e4SLinus Torvalds lw a3, 16(sp) 3051da177e4SLinus Torvalds lw t4, 20(sp) 3061da177e4SLinus Torvalds lw t5, 24(sp) 3071da177e4SLinus Torvalds lw t6, 28(sp) 3081da177e4SLinus Torvalds sw t4, 16(sp) 3091da177e4SLinus Torvalds sw t5, 20(sp) 3101da177e4SLinus Torvalds sw t6, 24(sp) 3111da177e4SLinus Torvalds sw a0, PT_R4(sp) # .. and push back a0 - a3, some 3121da177e4SLinus Torvalds sw a1, PT_R5(sp) # syscalls expect them there 3131da177e4SLinus Torvalds sw a2, PT_R6(sp) 3141da177e4SLinus Torvalds sw a3, PT_R7(sp) 3151da177e4SLinus Torvalds sw a3, PT_R26(sp) # update a3 for syscall restarting 3161da177e4SLinus Torvalds jr t2 3171da177e4SLinus Torvalds /* Unreached */ 3181da177e4SLinus Torvalds 3191da177e4SLinus Torvaldseinval: li v0, -EINVAL 3201da177e4SLinus Torvalds jr ra 3211da177e4SLinus Torvalds END(sys_syscall) 3221da177e4SLinus Torvalds 3231da177e4SLinus Torvalds .macro fifty ptr, nargs, from=1, to=50 3241da177e4SLinus Torvalds sys \ptr \nargs 3251da177e4SLinus Torvalds .if \to-\from 3261da177e4SLinus Torvalds fifty \ptr,\nargs,"(\from+1)",\to 3271da177e4SLinus Torvalds .endif 3281da177e4SLinus Torvalds .endm 3291da177e4SLinus Torvalds 3301da177e4SLinus Torvalds .macro mille ptr, nargs, from=1, to=20 3311da177e4SLinus Torvalds fifty \ptr,\nargs 3321da177e4SLinus Torvalds .if \to-\from 3331da177e4SLinus Torvalds mille \ptr,\nargs,"(\from+1)",\to 3341da177e4SLinus Torvalds .endif 3351da177e4SLinus Torvalds .endm 3361da177e4SLinus Torvalds 3371da177e4SLinus Torvalds .macro syscalltable 3381da177e4SLinus Torvalds#if defined(CONFIG_BINFMT_IRIX) 3391da177e4SLinus Torvalds mille sys_ni_syscall 0 /* 0 - 999 SVR4 flavour */ 3401da177e4SLinus Torvalds mille sys_ni_syscall 0 /* 1000 - 1999 32-bit IRIX */ 3411da177e4SLinus Torvalds mille sys_ni_syscall 0 /* 2000 - 2999 BSD43 flavour */ 3421da177e4SLinus Torvalds mille sys_ni_syscall 0 /* 3000 - 3999 POSIX flavour */ 3431da177e4SLinus Torvalds#endif 3441da177e4SLinus Torvalds 3451da177e4SLinus Torvalds sys sys_syscall 8 /* 4000 */ 3461da177e4SLinus Torvalds sys sys_exit 1 3471da177e4SLinus Torvalds sys sys_fork 0 3481da177e4SLinus Torvalds sys sys_read 3 3491da177e4SLinus Torvalds sys sys_write 3 3501da177e4SLinus Torvalds sys sys_open 3 /* 4005 */ 3511da177e4SLinus Torvalds sys sys_close 1 3521da177e4SLinus Torvalds sys sys_waitpid 3 3531da177e4SLinus Torvalds sys sys_creat 2 3541da177e4SLinus Torvalds sys sys_link 2 3551da177e4SLinus Torvalds sys sys_unlink 1 /* 4010 */ 3561da177e4SLinus Torvalds sys sys_execve 0 3571da177e4SLinus Torvalds sys sys_chdir 1 3581da177e4SLinus Torvalds sys sys_time 1 3591da177e4SLinus Torvalds sys sys_mknod 3 3601da177e4SLinus Torvalds sys sys_chmod 2 /* 4015 */ 3611da177e4SLinus Torvalds sys sys_lchown 3 3621da177e4SLinus Torvalds sys sys_ni_syscall 0 3631da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_stat */ 3641da177e4SLinus Torvalds sys sys_lseek 3 3651da177e4SLinus Torvalds sys sys_getpid 0 /* 4020 */ 3661da177e4SLinus Torvalds sys sys_mount 5 3671da177e4SLinus Torvalds sys sys_oldumount 1 3681da177e4SLinus Torvalds sys sys_setuid 1 3691da177e4SLinus Torvalds sys sys_getuid 0 3701da177e4SLinus Torvalds sys sys_stime 1 /* 4025 */ 3711da177e4SLinus Torvalds sys sys_ptrace 4 3721da177e4SLinus Torvalds sys sys_alarm 1 3731da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_fstat */ 3741da177e4SLinus Torvalds sys sys_pause 0 3751da177e4SLinus Torvalds sys sys_utime 2 /* 4030 */ 3761da177e4SLinus Torvalds sys sys_ni_syscall 0 3771da177e4SLinus Torvalds sys sys_ni_syscall 0 3781da177e4SLinus Torvalds sys sys_access 2 3791da177e4SLinus Torvalds sys sys_nice 1 3801da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4035 */ 3811da177e4SLinus Torvalds sys sys_sync 0 3821da177e4SLinus Torvalds sys sys_kill 2 3831da177e4SLinus Torvalds sys sys_rename 2 3841da177e4SLinus Torvalds sys sys_mkdir 2 3851da177e4SLinus Torvalds sys sys_rmdir 1 /* 4040 */ 3861da177e4SLinus Torvalds sys sys_dup 1 3871da177e4SLinus Torvalds sys sys_pipe 0 3881da177e4SLinus Torvalds sys sys_times 1 3891da177e4SLinus Torvalds sys sys_ni_syscall 0 3901da177e4SLinus Torvalds sys sys_brk 1 /* 4045 */ 3911da177e4SLinus Torvalds sys sys_setgid 1 3921da177e4SLinus Torvalds sys sys_getgid 0 3931da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was signal(2) */ 3941da177e4SLinus Torvalds sys sys_geteuid 0 3951da177e4SLinus Torvalds sys sys_getegid 0 /* 4050 */ 3961da177e4SLinus Torvalds sys sys_acct 1 3971da177e4SLinus Torvalds sys sys_umount 2 3981da177e4SLinus Torvalds sys sys_ni_syscall 0 3991da177e4SLinus Torvalds sys sys_ioctl 3 4001da177e4SLinus Torvalds sys sys_fcntl 3 /* 4055 */ 4011da177e4SLinus Torvalds sys sys_ni_syscall 2 4021da177e4SLinus Torvalds sys sys_setpgid 2 4031da177e4SLinus Torvalds sys sys_ni_syscall 0 4041da177e4SLinus Torvalds sys sys_olduname 1 4051da177e4SLinus Torvalds sys sys_umask 1 /* 4060 */ 4061da177e4SLinus Torvalds sys sys_chroot 1 4071da177e4SLinus Torvalds sys sys_ustat 2 4081da177e4SLinus Torvalds sys sys_dup2 2 4091da177e4SLinus Torvalds sys sys_getppid 0 4101da177e4SLinus Torvalds sys sys_getpgrp 0 /* 4065 */ 4111da177e4SLinus Torvalds sys sys_setsid 0 4121da177e4SLinus Torvalds sys sys_sigaction 3 4131da177e4SLinus Torvalds sys sys_sgetmask 0 4141da177e4SLinus Torvalds sys sys_ssetmask 1 4151da177e4SLinus Torvalds sys sys_setreuid 2 /* 4070 */ 4161da177e4SLinus Torvalds sys sys_setregid 2 4171da177e4SLinus Torvalds sys sys_sigsuspend 0 4181da177e4SLinus Torvalds sys sys_sigpending 1 4191da177e4SLinus Torvalds sys sys_sethostname 2 4201da177e4SLinus Torvalds sys sys_setrlimit 2 /* 4075 */ 4211da177e4SLinus Torvalds sys sys_getrlimit 2 4221da177e4SLinus Torvalds sys sys_getrusage 2 4231da177e4SLinus Torvalds sys sys_gettimeofday 2 4241da177e4SLinus Torvalds sys sys_settimeofday 2 4251da177e4SLinus Torvalds sys sys_getgroups 2 /* 4080 */ 4261da177e4SLinus Torvalds sys sys_setgroups 2 4271da177e4SLinus Torvalds sys sys_ni_syscall 0 /* old_select */ 4281da177e4SLinus Torvalds sys sys_symlink 2 4291da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_lstat */ 4301da177e4SLinus Torvalds sys sys_readlink 3 /* 4085 */ 4311da177e4SLinus Torvalds sys sys_uselib 1 4321da177e4SLinus Torvalds sys sys_swapon 2 4331da177e4SLinus Torvalds sys sys_reboot 3 4341da177e4SLinus Torvalds sys old_readdir 3 4351da177e4SLinus Torvalds sys old_mmap 6 /* 4090 */ 4361da177e4SLinus Torvalds sys sys_munmap 2 4371da177e4SLinus Torvalds sys sys_truncate 2 4381da177e4SLinus Torvalds sys sys_ftruncate 2 4391da177e4SLinus Torvalds sys sys_fchmod 2 4401da177e4SLinus Torvalds sys sys_fchown 3 /* 4095 */ 4411da177e4SLinus Torvalds sys sys_getpriority 2 4421da177e4SLinus Torvalds sys sys_setpriority 3 4431da177e4SLinus Torvalds sys sys_ni_syscall 0 4441da177e4SLinus Torvalds sys sys_statfs 2 4451da177e4SLinus Torvalds sys sys_fstatfs 2 /* 4100 */ 4461da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was ioperm(2) */ 4471da177e4SLinus Torvalds sys sys_socketcall 2 4481da177e4SLinus Torvalds sys sys_syslog 3 4491da177e4SLinus Torvalds sys sys_setitimer 3 4501da177e4SLinus Torvalds sys sys_getitimer 2 /* 4105 */ 4511da177e4SLinus Torvalds sys sys_newstat 2 4521da177e4SLinus Torvalds sys sys_newlstat 2 4531da177e4SLinus Torvalds sys sys_newfstat 2 4541da177e4SLinus Torvalds sys sys_uname 1 4551da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4110 was iopl(2) */ 4561da177e4SLinus Torvalds sys sys_vhangup 0 4571da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_idle() */ 4581da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_vm86 */ 4591da177e4SLinus Torvalds sys sys_wait4 4 4601da177e4SLinus Torvalds sys sys_swapoff 1 /* 4115 */ 4611da177e4SLinus Torvalds sys sys_sysinfo 1 4621da177e4SLinus Torvalds sys sys_ipc 6 4631da177e4SLinus Torvalds sys sys_fsync 1 4641da177e4SLinus Torvalds sys sys_sigreturn 0 4651da177e4SLinus Torvalds sys sys_clone 0 /* 4120 */ 4661da177e4SLinus Torvalds sys sys_setdomainname 2 4671da177e4SLinus Torvalds sys sys_newuname 1 4681da177e4SLinus Torvalds sys sys_ni_syscall 0 /* sys_modify_ldt */ 4691da177e4SLinus Torvalds sys sys_adjtimex 1 4701da177e4SLinus Torvalds sys sys_mprotect 3 /* 4125 */ 4711da177e4SLinus Torvalds sys sys_sigprocmask 3 4721da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was create_module */ 4731da177e4SLinus Torvalds sys sys_init_module 5 4741da177e4SLinus Torvalds sys sys_delete_module 1 4751da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4130 was get_kernel_syms */ 4761da177e4SLinus Torvalds sys sys_quotactl 4 4771da177e4SLinus Torvalds sys sys_getpgid 1 4781da177e4SLinus Torvalds sys sys_fchdir 1 4791da177e4SLinus Torvalds sys sys_bdflush 2 4801da177e4SLinus Torvalds sys sys_sysfs 3 /* 4135 */ 4811da177e4SLinus Torvalds sys sys_personality 1 4821da177e4SLinus Torvalds sys sys_ni_syscall 0 /* for afs_syscall */ 4831da177e4SLinus Torvalds sys sys_setfsuid 1 4841da177e4SLinus Torvalds sys sys_setfsgid 1 4851da177e4SLinus Torvalds sys sys_llseek 5 /* 4140 */ 4861da177e4SLinus Torvalds sys sys_getdents 3 4871da177e4SLinus Torvalds sys sys_select 5 4881da177e4SLinus Torvalds sys sys_flock 2 4891da177e4SLinus Torvalds sys sys_msync 3 4901da177e4SLinus Torvalds sys sys_readv 3 /* 4145 */ 4911da177e4SLinus Torvalds sys sys_writev 3 4921da177e4SLinus Torvalds sys sys_cacheflush 3 4931da177e4SLinus Torvalds sys sys_cachectl 3 4941da177e4SLinus Torvalds sys sys_sysmips 4 4951da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4150 */ 4961da177e4SLinus Torvalds sys sys_getsid 1 4971da177e4SLinus Torvalds sys sys_fdatasync 1 4981da177e4SLinus Torvalds sys sys_sysctl 1 4991da177e4SLinus Torvalds sys sys_mlock 2 5001da177e4SLinus Torvalds sys sys_munlock 2 /* 4155 */ 5011da177e4SLinus Torvalds sys sys_mlockall 1 5021da177e4SLinus Torvalds sys sys_munlockall 0 5031da177e4SLinus Torvalds sys sys_sched_setparam 2 5041da177e4SLinus Torvalds sys sys_sched_getparam 2 5051da177e4SLinus Torvalds sys sys_sched_setscheduler 3 /* 4160 */ 5061da177e4SLinus Torvalds sys sys_sched_getscheduler 1 5071da177e4SLinus Torvalds sys sys_sched_yield 0 5081da177e4SLinus Torvalds sys sys_sched_get_priority_max 1 5091da177e4SLinus Torvalds sys sys_sched_get_priority_min 1 5101da177e4SLinus Torvalds sys sys_sched_rr_get_interval 2 /* 4165 */ 5111da177e4SLinus Torvalds sys sys_nanosleep, 2 5127dbdf43cSYoichi Yuasa sys sys_mremap, 5 5131da177e4SLinus Torvalds sys sys_accept 3 5141da177e4SLinus Torvalds sys sys_bind 3 5151da177e4SLinus Torvalds sys sys_connect 3 /* 4170 */ 5161da177e4SLinus Torvalds sys sys_getpeername 3 5171da177e4SLinus Torvalds sys sys_getsockname 3 5181da177e4SLinus Torvalds sys sys_getsockopt 5 5191da177e4SLinus Torvalds sys sys_listen 2 5201da177e4SLinus Torvalds sys sys_recv 4 /* 4175 */ 5211da177e4SLinus Torvalds sys sys_recvfrom 6 5221da177e4SLinus Torvalds sys sys_recvmsg 3 5231da177e4SLinus Torvalds sys sys_send 4 5241da177e4SLinus Torvalds sys sys_sendmsg 3 5251da177e4SLinus Torvalds sys sys_sendto 6 /* 4180 */ 5261da177e4SLinus Torvalds sys sys_setsockopt 5 5271da177e4SLinus Torvalds sys sys_shutdown 2 5281da177e4SLinus Torvalds sys sys_socket 3 5291da177e4SLinus Torvalds sys sys_socketpair 4 5301da177e4SLinus Torvalds sys sys_setresuid 3 /* 4185 */ 5311da177e4SLinus Torvalds sys sys_getresuid 3 5321da177e4SLinus Torvalds sys sys_ni_syscall 0 /* was sys_query_module */ 5331da177e4SLinus Torvalds sys sys_poll 3 5341da177e4SLinus Torvalds sys sys_nfsservctl 3 5351da177e4SLinus Torvalds sys sys_setresgid 3 /* 4190 */ 5361da177e4SLinus Torvalds sys sys_getresgid 3 5371da177e4SLinus Torvalds sys sys_prctl 5 5381da177e4SLinus Torvalds sys sys_rt_sigreturn 0 5391da177e4SLinus Torvalds sys sys_rt_sigaction 4 5401da177e4SLinus Torvalds sys sys_rt_sigprocmask 4 /* 4195 */ 5411da177e4SLinus Torvalds sys sys_rt_sigpending 2 5421da177e4SLinus Torvalds sys sys_rt_sigtimedwait 4 5431da177e4SLinus Torvalds sys sys_rt_sigqueueinfo 3 5441da177e4SLinus Torvalds sys sys_rt_sigsuspend 0 5451da177e4SLinus Torvalds sys sys_pread64 6 /* 4200 */ 5461da177e4SLinus Torvalds sys sys_pwrite64 6 5471da177e4SLinus Torvalds sys sys_chown 3 5481da177e4SLinus Torvalds sys sys_getcwd 2 5491da177e4SLinus Torvalds sys sys_capget 2 5501da177e4SLinus Torvalds sys sys_capset 2 /* 4205 */ 5511da177e4SLinus Torvalds sys sys_sigaltstack 0 5521da177e4SLinus Torvalds sys sys_sendfile 4 5531da177e4SLinus Torvalds sys sys_ni_syscall 0 5541da177e4SLinus Torvalds sys sys_ni_syscall 0 5551da177e4SLinus Torvalds sys sys_mmap2 6 /* 4210 */ 5561da177e4SLinus Torvalds sys sys_truncate64 4 5571da177e4SLinus Torvalds sys sys_ftruncate64 4 5581da177e4SLinus Torvalds sys sys_stat64 2 5591da177e4SLinus Torvalds sys sys_lstat64 2 5601da177e4SLinus Torvalds sys sys_fstat64 2 /* 4215 */ 5611da177e4SLinus Torvalds sys sys_pivot_root 2 5621da177e4SLinus Torvalds sys sys_mincore 3 5631da177e4SLinus Torvalds sys sys_madvise 3 5641da177e4SLinus Torvalds sys sys_getdents64 3 5651da177e4SLinus Torvalds sys sys_fcntl64 3 /* 4220 */ 5661da177e4SLinus Torvalds sys sys_ni_syscall 0 5671da177e4SLinus Torvalds sys sys_gettid 0 5681da177e4SLinus Torvalds sys sys_readahead 5 5691da177e4SLinus Torvalds sys sys_setxattr 5 5701da177e4SLinus Torvalds sys sys_lsetxattr 5 /* 4225 */ 5711da177e4SLinus Torvalds sys sys_fsetxattr 5 5721da177e4SLinus Torvalds sys sys_getxattr 4 5731da177e4SLinus Torvalds sys sys_lgetxattr 4 5741da177e4SLinus Torvalds sys sys_fgetxattr 4 5751da177e4SLinus Torvalds sys sys_listxattr 3 /* 4230 */ 5761da177e4SLinus Torvalds sys sys_llistxattr 3 5771da177e4SLinus Torvalds sys sys_flistxattr 3 5781da177e4SLinus Torvalds sys sys_removexattr 2 5791da177e4SLinus Torvalds sys sys_lremovexattr 2 5801da177e4SLinus Torvalds sys sys_fremovexattr 2 /* 4235 */ 5811da177e4SLinus Torvalds sys sys_tkill 2 5821da177e4SLinus Torvalds sys sys_sendfile64 5 58390a67b59SThiemo Seufer sys sys_futex 6 584f088fc84SRalf Baechle#ifdef CONFIG_MIPS_MT_FPAFF 585f088fc84SRalf Baechle /* 586f088fc84SRalf Baechle * For FPU affinity scheduling on MIPS MT processors, we need to 587f088fc84SRalf Baechle * intercept sys_sched_xxxaffinity() calls until we get a proper hook 588f088fc84SRalf Baechle * in kernel/sched.c. Considered only temporary we only support these 589f088fc84SRalf Baechle * hooks for the 32-bit kernel - there is no MIPS64 MT processor atm. 590f088fc84SRalf Baechle */ 591f088fc84SRalf Baechle sys mipsmt_sys_sched_setaffinity 3 592f088fc84SRalf Baechle sys mipsmt_sys_sched_getaffinity 3 593f088fc84SRalf Baechle#else 5941da177e4SLinus Torvalds sys sys_sched_setaffinity 3 5951da177e4SLinus Torvalds sys sys_sched_getaffinity 3 /* 4240 */ 596f088fc84SRalf Baechle#endif /* CONFIG_MIPS_MT_FPAFF */ 5971da177e4SLinus Torvalds sys sys_io_setup 2 5981da177e4SLinus Torvalds sys sys_io_destroy 1 5991da177e4SLinus Torvalds sys sys_io_getevents 5 6001da177e4SLinus Torvalds sys sys_io_submit 3 6011da177e4SLinus Torvalds sys sys_io_cancel 3 /* 4245 */ 6021da177e4SLinus Torvalds sys sys_exit_group 1 6030d507d61SRalf Baechle sys sys_lookup_dcookie 4 6041da177e4SLinus Torvalds sys sys_epoll_create 1 6051da177e4SLinus Torvalds sys sys_epoll_ctl 4 6061da177e4SLinus Torvalds sys sys_epoll_wait 3 /* 4250 */ 6071da177e4SLinus Torvalds sys sys_remap_file_pages 5 6081da177e4SLinus Torvalds sys sys_set_tid_address 1 6091da177e4SLinus Torvalds sys sys_restart_syscall 0 6101da177e4SLinus Torvalds sys sys_fadvise64_64 7 6111da177e4SLinus Torvalds sys sys_statfs64 3 /* 4255 */ 6121da177e4SLinus Torvalds sys sys_fstatfs64 2 6131da177e4SLinus Torvalds sys sys_timer_create 3 6141da177e4SLinus Torvalds sys sys_timer_settime 4 6151da177e4SLinus Torvalds sys sys_timer_gettime 2 6161da177e4SLinus Torvalds sys sys_timer_getoverrun 1 /* 4260 */ 6171da177e4SLinus Torvalds sys sys_timer_delete 1 6181da177e4SLinus Torvalds sys sys_clock_settime 2 6191da177e4SLinus Torvalds sys sys_clock_gettime 2 6201da177e4SLinus Torvalds sys sys_clock_getres 2 6211da177e4SLinus Torvalds sys sys_clock_nanosleep 4 /* 4265 */ 6221da177e4SLinus Torvalds sys sys_tgkill 3 6231da177e4SLinus Torvalds sys sys_utimes 2 6241da177e4SLinus Torvalds sys sys_mbind 4 6251da177e4SLinus Torvalds sys sys_ni_syscall 0 /* sys_get_mempolicy */ 6261da177e4SLinus Torvalds sys sys_ni_syscall 0 /* 4270 sys_set_mempolicy */ 6271da177e4SLinus Torvalds sys sys_mq_open 4 6281da177e4SLinus Torvalds sys sys_mq_unlink 1 6291da177e4SLinus Torvalds sys sys_mq_timedsend 5 6301da177e4SLinus Torvalds sys sys_mq_timedreceive 5 6311da177e4SLinus Torvalds sys sys_mq_notify 2 /* 4275 */ 6321da177e4SLinus Torvalds sys sys_mq_getsetattr 3 6331da177e4SLinus Torvalds sys sys_ni_syscall 0 /* sys_vserver */ 634a19050f3SRalf Baechle sys sys_waitid 5 6351da177e4SLinus Torvalds sys sys_ni_syscall 0 /* available, was setaltroot */ 636e50c0a8fSRalf Baechle sys sys_add_key 5 /* 4280 */ 6371da177e4SLinus Torvalds sys sys_request_key 4 6381da177e4SLinus Torvalds sys sys_keyctl 5 6393c37026dSRalf Baechle sys sys_set_thread_area 1 6407db36c85SRalf Baechle sys sys_inotify_init 0 6417db36c85SRalf Baechle sys sys_inotify_add_watch 3 /* 4285 */ 6427db36c85SRalf Baechle sys sys_inotify_rm_watch 2 64372bf8914SRalf Baechle sys sys_migrate_pages 4 64472bf8914SRalf Baechle sys sys_openat 4 64572bf8914SRalf Baechle sys sys_mkdirat 3 64672bf8914SRalf Baechle sys sys_mknodat 4 /* 4290 */ 64772bf8914SRalf Baechle sys sys_fchownat 5 64872bf8914SRalf Baechle sys sys_futimesat 3 649326a6257SYoichi Yuasa sys sys_fstatat64 4 65072bf8914SRalf Baechle sys sys_unlinkat 3 65172bf8914SRalf Baechle sys sys_renameat 4 /* 4295 */ 652c04030e1SUlrich Drepper sys sys_linkat 5 65372bf8914SRalf Baechle sys sys_symlinkat 3 65472bf8914SRalf Baechle sys sys_readlinkat 4 65572bf8914SRalf Baechle sys sys_fchmodat 3 65672bf8914SRalf Baechle sys sys_faccessat 3 /* 4300 */ 65772bf8914SRalf Baechle sys sys_pselect6 6 65872bf8914SRalf Baechle sys sys_ppoll 5 65972bf8914SRalf Baechle sys sys_unshare 1 660f115da9cSRalf Baechle sys sys_splice 4 661a8d587a7SRalf Baechle sys sys_sync_file_range 7 /* 4305 */ 662136d47d3SRalf Baechle sys sys_tee 4 663722cfd90SRalf Baechle sys sys_vmsplice 4 664722cfd90SRalf Baechle sys sys_move_pages 6 665*7fdeb048SAtsushi Nemoto sys sys_set_robust_list 2 666*7fdeb048SAtsushi Nemoto sys sys_get_robust_list 3 6671da177e4SLinus Torvalds .endm 6681da177e4SLinus Torvalds 6691da177e4SLinus Torvalds /* We pre-compute the number of _instruction_ bytes needed to 6701da177e4SLinus Torvalds load or store the arguments 6-8. Negative values are ignored. */ 6711da177e4SLinus Torvalds 6721da177e4SLinus Torvalds .macro sys function, nargs 6731da177e4SLinus Torvalds PTR \function 6741da177e4SLinus Torvalds LONG (\nargs << 2) - (5 << 2) 6751da177e4SLinus Torvalds .endm 6761da177e4SLinus Torvalds 6771da177e4SLinus Torvalds .align 3 6781da177e4SLinus Torvalds .type sys_call_table,@object 6791da177e4SLinus TorvaldsEXPORT(sys_call_table) 6801da177e4SLinus Torvalds syscalltable 6811da177e4SLinus Torvalds .size sys_call_table, . - sys_call_table 682