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