1/*
2 *  Copyright (C) 2000-2003 Axis Communications AB
3 *
4 *  Authors:	Bjorn Wesen (bjornw@axis.com)
5 *              Tobias Anderberg (tobiasa@axis.com), CRISv32 port.
6 *
7 * Code for the system-call and fault low-level handling routines.
8 *
9 * NOTE: This code handles signal-recognition, which happens every time
10 * after a timer-interrupt and after each system call.
11 *
12 * Stack layout in 'ret_from_system_call':
13 *	ptrace needs to have all regs on the stack.
14 *	if the order here is changed, it needs to be
15 *	updated in fork.c:copy_process, signal.c:do_signal,
16 *	ptrace.c and ptrace.h
17 *
18 */
19
20#include <linux/linkage.h>
21#include <linux/sys.h>
22#include <asm/unistd.h>
23#include <asm/errno.h>
24#include <asm/thread_info.h>
25#include <asm/asm-offsets.h>
26
27#include <hwregs/asm/reg_map_asm.h>
28#include <hwregs/asm/intr_vect_defs_asm.h>
29
30	;; Exported functions.
31	.globl system_call
32	.globl ret_from_intr
33	.globl ret_from_fork
34	.globl resume
35	.globl multiple_interrupt
36	.globl nmi_interrupt
37	.globl spurious_interrupt
38	.globl do_sigtrap
39	.globl gdb_handle_exception
40	.globl sys_call_table
41
42	; Check if preemptive kernel scheduling should be done.
43#ifdef CONFIG_PREEMPT
44_resume_kernel:
45	di
46	; Load current task struct.
47	movs.w	-8192, $r0		; THREAD_SIZE = 8192
48	and.d	$sp, $r0
49
50	addoq	+TI_preempt_count, $r0, $acr
51	move.d	[$acr], $r10		; Preemption disabled?
52	bne	_Rexit
53	nop
54
55_need_resched:
56	addoq	+TI_flags, $r0, $acr
57	move.d	[$acr], $r10
58	btstq	TIF_NEED_RESCHED, $r10	; Check if need_resched is set.
59	bpl	_Rexit
60	nop
61
62	; Do preemptive kernel scheduling.
63	jsr	preempt_schedule_irq
64	nop
65
66	; Load new task struct.
67	movs.w	-8192, $r0		; THREAD_SIZE = 8192.
68	and.d	$sp, $r0
69
70	; One more time with new task.
71	ba	_need_resched
72	nop
73#else
74#define _resume_kernel _Rexit
75#endif
76
77	; Called at exit from fork. schedule_tail must be called to drop
78	; spinlock if CONFIG_PREEMPT.
79	.type	ret_from_fork,@function
80ret_from_fork:
81	jsr schedule_tail
82	nop
83	ba  ret_from_sys_call
84	nop
85	.size	ret_from_fork, . - ret_from_fork
86
87	.type	ret_from_intr,@function
88ret_from_intr:
89	;; Check for resched if preemptive kernel, or if we're going back to
90	;; user-mode. This test matches the user_regs(regs) macro. Don't simply
91	;; test CCS since that doesn't necessarily reflect what mode we'll
92	;; return into.
93	addoq	+PT_ccs, $sp, $acr
94	move.d	[$acr], $r0
95	btstq	16, $r0			; User-mode flag.
96	bpl	_resume_kernel
97	.size	ret_from_intr, . - ret_from_intr + 2	; +2 includes the dslot.
98
99	; Note that di below is in delay slot.
100	.type	_resume_userspace,@function
101_resume_userspace:
102	di			; So need_resched and sigpending don't change.
103
104	movs.w	-8192, $r0		; THREAD_SIZE == 8192
105	and.d	$sp, $r0
106
107	addoq	+TI_flags, $r0, $acr	; current->work
108	move.d	[$acr], $r10
109	and.d	_TIF_WORK_MASK, $r10	; Work to be done on return?
110	bne	_work_pending
111	nop
112	ba	_Rexit
113	nop
114	.size	_resume_userspace, . - _resume_userspace
115
116	;; The system_call is called by a BREAK instruction, which looks pretty
117	;; much like any other exception.
118	;;
119	;; System calls can't be made from interrupts but we still stack ERP
120	;; to have a complete stack frame.
121	;;
122	;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,
123	;; r13,mof,srp
124	;;
125	;; This function looks on the _surface_ like spaghetti programming, but it's
126	;; really designed so that the fast-path does not force cache-loading of
127	;; non-used instructions. Only the non-common cases cause the outlined code
128	;; to run..
129
130	.type	system_call,@function
131system_call:
132	;; Stack-frame similar to the irq heads, which is reversed in
133	;; ret_from_sys_call.
134
135	sub.d	92, $sp		; Skip EXS and EDA.
136	movem	$r13, [$sp]
137	move.d	$sp, $r8
138	addq	14*4, $r8
139	move.d	$acr, $r0
140	move	$srs, $r1
141	move	$mof, $r2
142	move	$spc, $r3
143	move	$ccs, $r4
144	move	$srp, $r5
145	move	$erp, $r6
146	subq	4, $sp
147	movem	$r6, [$r8]
148	ei			; Enable interrupts while processing syscalls.
149	move.d	$r10, [$sp]
150
151	; Set S-bit when kernel debugging to keep hardware breakpoints active.
152#ifdef CONFIG_ETRAX_KGDB
153	move $ccs, $r0
154	or.d (1<<9), $r0
155	move $r0, $ccs
156#endif
157
158	movs.w	-ENOSYS, $r0
159	addoq	+PT_r10, $sp, $acr
160	move.d	$r0, [$acr]
161
162	;; Check if this process is syscall-traced.
163	movs.w	-8192, $r0	; THREAD_SIZE == 8192
164	and.d	$sp, $r0
165
166	addoq	+TI_flags, $r0, $acr
167	move.d	[$acr], $r0
168	btstq	TIF_SYSCALL_TRACE, $r0
169	bmi	_syscall_trace_entry
170	nop
171
172_syscall_traced:
173	;; Check for sanity in the requested syscall number.
174	cmpu.w	NR_syscalls, $r9
175	bhs	ret_from_sys_call
176	lslq	2, $r9		;  Multiply by 4, in the delay slot.
177
178	;; The location on the stack for the register structure is passed as a
179	;; seventh argument. Some system calls need this.
180	move.d  $sp, $r0
181	subq	4, $sp
182	move.d	$r0, [$sp]
183
184	;; The registers carrying parameters (R10-R13) are intact. The optional
185	;; fifth and sixth parameters is in MOF and SRP respectively. Put them
186	;; back on the stack.
187	subq	4, $sp
188	move	$srp, [$sp]
189	subq	4, $sp
190	move	$mof, [$sp]
191
192	;; Actually to the system call.
193	addo.d	+sys_call_table, $r9, $acr
194	move.d	[$acr], $acr
195	jsr	$acr
196	nop
197
198	addq	3*4, $sp		; Pop the mof, srp and regs parameters.
199	addoq	+PT_r10, $sp, $acr
200	move.d	$r10, [$acr]		; Save the return value.
201
202	moveq	1, $r9			; "Parameter" to ret_from_sys_call to
203					; show it was a sys call.
204
205	;; Fall through into ret_from_sys_call to return.
206
207ret_from_sys_call:
208	;; R9 is a parameter:
209	;;  >= 1 from syscall
210	;;     0 from irq
211
212	;; Get the current task-struct pointer.
213	movs.w	-8192, $r0	; THREAD_SIZE == 8192
214	and.d	$sp, $r0
215
216	di		; Make sure need_resched and sigpending don't change.
217
218	addoq	+TI_flags, $r0, $acr
219	move.d	[$acr], $r1
220	and.d	_TIF_ALLWORK_MASK, $r1
221	bne	_syscall_exit_work
222	nop
223	.size	system_call, . - system_call
224
225	.type	_Rexit,@function
226_Rexit:
227	;; This epilogue MUST match the prologues in multiple_interrupt, irq.h
228	;; and ptregs.h.
229	addq	4, $sp		; Skip orig_r10.
230	movem	[$sp+], $r13	; Registers R0-R13.
231	move.d	[$sp+], $acr
232	move	[$sp], $srs
233	addq	4, $sp
234	move	[$sp+], $mof
235	move	[$sp+], $spc
236	move	[$sp+], $ccs
237	move	[$sp+], $srp
238	move	[$sp+], $erp
239	addq    8, $sp		; Skip EXS, EDA.
240	jump	$erp
241	rfe			; Restore condition code stack in delay-slot.
242	.size	_Rexit, . - _Rexit
243
244	;; We get here after doing a syscall if extra work might need to be done
245	;; perform syscall exit tracing if needed.
246
247	.type	_syscall_exit_work,@function
248_syscall_exit_work:
249	;; R0 contains current at this point and irq's are disabled.
250
251	addoq	+TI_flags, $r0, $acr
252	move.d	[$acr], $r1
253	btstq	TIF_SYSCALL_TRACE, $r1
254	bpl	_work_pending
255	nop
256	ei
257	move.d	$r9, $r1		; Preserve R9.
258	jsr	do_syscall_trace
259	nop
260	move.d	$r1, $r9
261	ba	_resume_userspace
262	nop
263	.size	_syscall_exit_work, . - _syscall_exit_work
264
265	.type	_work_pending,@function
266_work_pending:
267	addoq	+TI_flags, $r0, $acr
268	move.d	[$acr], $r10
269	btstq	TIF_NEED_RESCHED, $r10	; Need resched?
270	bpl	_work_notifysig		; No, must be signal/notify.
271	nop
272	.size	_work_pending, . - _work_pending
273
274	.type	_work_resched,@function
275_work_resched:
276	move.d	$r9, $r1		; Preserve R9.
277	jsr	schedule
278	nop
279	move.d	$r1, $r9
280	di
281
282	addoq	+TI_flags, $r0, $acr
283	move.d	[$acr], $r1
284	and.d	_TIF_WORK_MASK, $r1	; Ignore sycall trace counter.
285	beq	_Rexit
286	nop
287	btstq	TIF_NEED_RESCHED, $r1
288	bmi	_work_resched		; current->work.need_resched.
289	nop
290	.size	_work_resched, . - _work_resched
291
292	.type	_work_notifysig,@function
293_work_notifysig:
294	;; Deal with pending signals and notify-resume requests.
295
296	addoq	+TI_flags, $r0, $acr
297	move.d	[$acr], $r12		; The thread_info_flags parameter.
298	move.d	$sp, $r11		; The regs param.
299	jsr	do_notify_resume
300	move.d	$r9, $r10		; do_notify_resume syscall/irq param.
301
302	ba _Rexit
303	nop
304	.size	_work_notifysig, . - _work_notifysig
305
306	;; We get here as a sidetrack when we've entered a syscall with the
307	;; trace-bit set. We need to call do_syscall_trace and then continue
308	;; with the call.
309
310_syscall_trace_entry:
311	;; PT_r10 in the frame contains -ENOSYS as required, at this point.
312
313	jsr	do_syscall_trace
314	nop
315
316	;; Now re-enter the syscall code to do the syscall itself. We need to
317	;; restore R9 here to contain the wanted syscall, and the other
318	;; parameter-bearing registers.
319	addoq	+PT_r9, $sp, $acr
320	move.d	[$acr], $r9
321	addoq	+PT_orig_r10, $sp, $acr
322	move.d	[$acr], $r10		; PT_r10 is already -ENOSYS.
323	addoq	+PT_r11, $sp, $acr
324	move.d	[$acr], $r11
325	addoq	+PT_r12, $sp, $acr
326	move.d	[$acr], $r12
327	addoq	+PT_r13, $sp, $acr
328	move.d	[$acr], $r13
329	addoq	+PT_mof, $sp, $acr
330	move	[$acr], $mof
331	addoq	+PT_srp, $sp, $acr
332	move	[$acr], $srp
333
334	ba	_syscall_traced
335	nop
336
337	;; Resume performs the actual task-switching, by switching stack
338	;; pointers. Input arguments are:
339	;;
340	;; R10 = prev
341	;; R11 = next
342	;; R12 = thread offset in task struct.
343	;;
344	;; Returns old current in R10.
345
346	.type	resume,@function
347resume:
348	subq	4, $sp			; Make space for srp.
349
350	add.d	$r12, $r10		; R10 = current tasks tss.
351	addoq	+THREAD_ccs, $r10, $acr
352	move	$srp, [$sp]		; Keep old/new PC on the stack.
353	move	$ccs, [$acr]		; Save IRQ enable state.
354	di
355
356	addoq	+THREAD_usp, $r10, $acr
357	subq	10*4, $sp		; Make room for R9.
358	move	$usp, [$acr]		; Save user-mode stackpointer.
359
360	;; See copy_thread for the reason why register R9 is saved.
361	movem	$r9, [$sp]		; Save non-scratch registers and R9.
362
363	addoq	+THREAD_ksp, $r10, $acr
364	move.d	$sp, $r10		; Return last running task in R10.
365	move.d	$sp, [$acr]		; Save kernel SP for old task.
366
367	and.d   -8192, $r10		; Get thread_info from stackpointer.
368	addoq	+TI_task, $r10, $acr
369	add.d	$r12, $r11		; Find the new tasks tss.
370	move.d	[$acr], $r10		; Get task.
371	addoq	+THREAD_ksp, $r11, $acr
372	move.d	[$acr], $sp		; Switch to new stackframe.
373	addoq	+THREAD_usp, $r11, $acr
374	movem	[$sp+], $r9		; Restore non-scratch registers and R9.
375
376	move	[$acr], $usp		; Restore user-mode stackpointer.
377
378	addoq	+THREAD_ccs, $r11, $acr
379	move.d	[$sp+], $r11
380	jump	$r11			; Restore PC.
381	move	[$acr], $ccs		; Restore IRQ enable status.
382	.size	resume, . - resume
383
384nmi_interrupt:
385
386;; If we receive a watchdog interrupt while it is not expected, then set
387;; up a canonical frame and dump register contents before dying.
388
389	;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
390	subq	12, $sp		;  Skip EXS, EDA.
391	move	$nrp, [$sp]
392	subq	4, $sp
393	move	$srp, [$sp]
394	subq	4, $sp
395	move	$ccs, [$sp]
396	subq	4, $sp
397	move	$spc, [$sp]
398	subq	4, $sp
399	move	$mof, [$sp]
400	subq	4, $sp
401	move	$srs, [$sp]
402	subq	4, $sp
403	move.d	$acr, [$sp]
404	subq	14*4, $sp		; Make room for R0-R13.
405	movem	$r13, [$sp]		; Push R0-R13.
406	subq	4, $sp
407	move.d	$r10, [$sp]		; Push orig_r10.
408	move.d  REG_ADDR(intr_vect, regi_irq, r_nmi), $r0
409	move.d  [$r0], $r0
410	btstq	REG_BIT(intr_vect, r_nmi, watchdog), $r0
411	bpl     1f
412	nop
413	jsr	handle_watchdog_bite	; In time.c.
414        move.d	$sp, $r10		; Pointer to registers
4151:	btstq	REG_BIT(intr_vect, r_nmi, ext), $r0
416	bpl     1f
417	nop
418	jsr	handle_nmi
419	move.d	$sp, $r10		; Pointer to registers
4201:	addq    4, $sp			; Skip orig_r10
421	movem   [$sp+], $r13
422	move.d  [$sp+], $acr
423	move    [$sp], $srs
424	addq    4, $sp
425	move    [$sp+], $mof
426	move    [$sp+], $spc
427	move    [$sp+], $ccs
428	move	[$sp+], $srp
429	move	[$sp+], $nrp
430	addq    8, $sp			; Skip EXS, EDA.
431	jump    $nrp
432	rfn
433
434	.comm	cause_of_death, 4	;; Don't declare this anywhere.
435
436spurious_interrupt:
437	di
438	jump hard_reset_now
439	nop
440
441	;; This handles the case when multiple interrupts arrive at the same
442	;; time. Jump to the first set interrupt bit in a priotiry fashion. The
443	;; hardware will call the unserved interrupts after the handler
444	;; finishes.
445	.type	multiple_interrupt, @function
446multiple_interrupt:
447	;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
448	subq	12, $sp		; Skip EXS, EDA.
449	move	$erp, [$sp]
450	subq	4, $sp
451	move	$srp, [$sp]
452	subq	4, $sp
453	move	$ccs, [$sp]
454	subq	4, $sp
455	move	$spc, [$sp]
456	subq	4, $sp
457	move	$mof, [$sp]
458	subq	4, $sp
459	move	$srs, [$sp]
460	subq	4, $sp
461	move.d	$acr, [$sp]
462	subq	14*4, $sp	; Make room for R0-R13.
463	movem	$r13, [$sp]	; Push R0-R13.
464	subq	4, $sp
465	move.d	$r10, [$sp]	; Push orig_r10.
466
467; Set S-bit when kernel debugging to keep hardware breakpoints active.
468#ifdef CONFIG_ETRAX_KGDB
469	move $ccs, $r0
470	or.d (1<<9), $r0
471	move $r0, $ccs
472#endif
473
474	jsr	crisv32_do_multiple
475	move.d	$sp, $r10
476	jump    ret_from_intr
477	nop
478	.size	multiple_interrupt, . - multiple_interrupt
479
480do_sigtrap:
481	;; Sigtraps the process that executed the BREAK instruction. Creates a
482	;; frame that Rexit expects.
483	subq	4, $sp
484	move    $eda, [$sp]
485	subq    4, $sp
486	move    $exs, [$sp]
487	subq    4, $sp
488	move	$erp, [$sp]
489	subq	4, $sp
490	move	$srp, [$sp]
491	subq	4, $sp
492	move	$ccs, [$sp]
493	subq	4, $sp
494	move	$spc, [$sp]
495	subq	4, $sp
496	move	$mof, [$sp]
497	subq	4, $sp
498	move	$srs, [$sp]
499	subq	4, $sp
500	move.d	$acr, [$sp]
501	di				; Need to disable irq's at this point.
502	subq	14*4, $sp		; Make room for r0-r13.
503	movem	$r13, [$sp]		; Push the r0-r13 registers.
504	subq	4, $sp
505	move.d	$r10, [$sp]		; Push orig_r10.
506
507	movs.w	-8192, $r9		; THREAD_SIZE == 8192
508	and.d	$sp, $r9
509
510	;; thread_info as first parameter
511	move.d  $r9, $r10
512	moveq	5, $r11			; SIGTRAP as second argument.
513	jsr	ugdb_trap_user
514	nop
515	jump	ret_from_intr		; Use the return routine for interrupts.
516	nop
517
518gdb_handle_exception:
519	subq	4, $sp
520	move.d	$r0, [$sp]
521#ifdef CONFIG_ETRAX_KGDB
522	move	$ccs, $r0		; U-flag not affected by previous insns.
523	btstq	16, $r0			; Test the U-flag.
524	bmi	_ugdb_handle_exception	; Go to user mode debugging.
525	nop				; Empty delay-slot (cannot pop R0 here).
526	ba	kgdb_handle_exception	; Go to kernel debugging.
527	move.d	[$sp+], $r0		; Restore R0 in delay slot.
528#endif
529
530_ugdb_handle_exception:
531	ba	do_sigtrap		; SIGTRAP the offending process.
532	move.d	[$sp+], $r0		; Restore R0 in delay slot.
533
534	.global kernel_execve
535	.type	kernel_execve,@function
536kernel_execve:
537	move.d __NR_execve, $r9
538	break 13
539	ret
540	nop
541	.size	kernel_execve, . - kernel_execve
542
543	.data
544
545	.section .rodata,"a"
546sys_call_table:
547	.long sys_restart_syscall	; 0 - old "setup()" system call, used
548					; for restarting.
549	.long sys_exit
550	.long sys_fork
551	.long sys_read
552	.long sys_write
553	.long sys_open		/* 5 */
554	.long sys_close
555	.long sys_waitpid
556	.long sys_creat
557	.long sys_link
558	.long sys_unlink	/* 10 */
559	.long sys_execve
560	.long sys_chdir
561	.long sys_time
562	.long sys_mknod
563	.long sys_chmod		/* 15 */
564	.long sys_lchown16
565	.long sys_ni_syscall	/* old break syscall holder */
566	.long sys_stat
567	.long sys_lseek
568	.long sys_getpid	/* 20 */
569	.long sys_mount
570	.long sys_oldumount
571	.long sys_setuid16
572	.long sys_getuid16
573	.long sys_stime		/* 25 */
574	.long sys_ptrace
575	.long sys_alarm
576	.long sys_fstat
577	.long sys_pause
578	.long sys_utime		/* 30 */
579	.long sys_ni_syscall	/* old stty syscall holder */
580	.long sys_ni_syscall	/* old gtty syscall holder */
581	.long sys_access
582	.long sys_nice
583	.long sys_ni_syscall	/* 35  old ftime syscall holder */
584	.long sys_sync
585	.long sys_kill
586	.long sys_rename
587	.long sys_mkdir
588	.long sys_rmdir		/* 40 */
589	.long sys_dup
590	.long sys_pipe
591	.long sys_times
592	.long sys_ni_syscall	/* old prof syscall holder */
593	.long sys_brk		/* 45 */
594	.long sys_setgid16
595	.long sys_getgid16
596	.long sys_signal
597	.long sys_geteuid16
598	.long sys_getegid16	/* 50 */
599	.long sys_acct
600	.long sys_umount	/* recycled never used phys( */
601	.long sys_ni_syscall	/* old lock syscall holder */
602	.long sys_ioctl
603	.long sys_fcntl		/* 55 */
604	.long sys_ni_syscall	/* old mpx syscall holder */
605	.long sys_setpgid
606	.long sys_ni_syscall	/* old ulimit syscall holder */
607	.long sys_ni_syscall	/* old sys_olduname holder */
608	.long sys_umask		/* 60 */
609	.long sys_chroot
610	.long sys_ustat
611	.long sys_dup2
612	.long sys_getppid
613	.long sys_getpgrp	/* 65 */
614	.long sys_setsid
615	.long sys_sigaction
616	.long sys_sgetmask
617	.long sys_ssetmask
618	.long sys_setreuid16	/* 70 */
619	.long sys_setregid16
620	.long sys_sigsuspend
621	.long sys_sigpending
622	.long sys_sethostname
623	.long sys_setrlimit	/* 75 */
624	.long sys_old_getrlimit
625	.long sys_getrusage
626	.long sys_gettimeofday
627	.long sys_settimeofday
628	.long sys_getgroups16	/* 80 */
629	.long sys_setgroups16
630	.long sys_select	/* was old_select in Linux/E100 */
631	.long sys_symlink
632	.long sys_lstat
633	.long sys_readlink	/* 85 */
634	.long sys_uselib
635	.long sys_swapon
636	.long sys_reboot
637	.long sys_old_readdir
638	.long sys_old_mmap	/* 90 */
639	.long sys_munmap
640	.long sys_truncate
641	.long sys_ftruncate
642	.long sys_fchmod
643	.long sys_fchown16	/* 95 */
644	.long sys_getpriority
645	.long sys_setpriority
646	.long sys_ni_syscall	/* old profil syscall holder */
647	.long sys_statfs
648	.long sys_fstatfs	/* 100 */
649	.long sys_ni_syscall	/* sys_ioperm in i386 */
650	.long sys_socketcall
651	.long sys_syslog
652	.long sys_setitimer
653	.long sys_getitimer	/* 105 */
654	.long sys_newstat
655	.long sys_newlstat
656	.long sys_newfstat
657	.long sys_ni_syscall	/* old sys_uname holder */
658	.long sys_ni_syscall	/* sys_iopl in i386 */
659	.long sys_vhangup
660	.long sys_ni_syscall	/* old "idle" system call */
661	.long sys_ni_syscall	/* vm86old in i386 */
662	.long sys_wait4
663	.long sys_swapoff	/* 115 */
664	.long sys_sysinfo
665	.long sys_ipc
666	.long sys_fsync
667	.long sys_sigreturn
668	.long sys_clone		/* 120 */
669	.long sys_setdomainname
670	.long sys_newuname
671	.long sys_ni_syscall	/* sys_modify_ldt */
672	.long sys_adjtimex
673	.long sys_mprotect	/* 125 */
674	.long sys_sigprocmask
675	.long sys_ni_syscall	/* old "create_module" */
676	.long sys_init_module
677	.long sys_delete_module
678	.long sys_ni_syscall	/* 130:	old "get_kernel_syms" */
679	.long sys_quotactl
680	.long sys_getpgid
681	.long sys_fchdir
682	.long sys_bdflush
683	.long sys_sysfs		/* 135 */
684	.long sys_personality
685	.long sys_ni_syscall	/* for afs_syscall */
686	.long sys_setfsuid16
687	.long sys_setfsgid16
688	.long sys_llseek	/* 140 */
689	.long sys_getdents
690	.long sys_select
691	.long sys_flock
692	.long sys_msync
693	.long sys_readv		/* 145 */
694	.long sys_writev
695	.long sys_getsid
696	.long sys_fdatasync
697	.long sys_sysctl
698	.long sys_mlock		/* 150 */
699	.long sys_munlock
700	.long sys_mlockall
701	.long sys_munlockall
702	.long sys_sched_setparam
703	.long sys_sched_getparam	/* 155 */
704	.long sys_sched_setscheduler
705	.long sys_sched_getscheduler
706	.long sys_sched_yield
707	.long sys_sched_get_priority_max
708	.long sys_sched_get_priority_min	/* 160 */
709	.long sys_sched_rr_get_interval
710	.long sys_nanosleep
711	.long sys_mremap
712	.long sys_setresuid16
713	.long sys_getresuid16	/* 165 */
714	.long sys_ni_syscall	/* sys_vm86 */
715	.long sys_ni_syscall	/* Old sys_query_module */
716	.long sys_poll
717	.long sys_ni_syscall	/* Old nfsservctl */
718	.long sys_setresgid16	/* 170 */
719	.long sys_getresgid16
720	.long sys_prctl
721	.long sys_rt_sigreturn
722	.long sys_rt_sigaction
723	.long sys_rt_sigprocmask	/* 175 */
724	.long sys_rt_sigpending
725	.long sys_rt_sigtimedwait
726	.long sys_rt_sigqueueinfo
727	.long sys_rt_sigsuspend
728	.long sys_pread64	/* 180 */
729	.long sys_pwrite64
730	.long sys_chown16
731	.long sys_getcwd
732	.long sys_capget
733	.long sys_capset	/* 185 */
734	.long sys_sigaltstack
735	.long sys_sendfile
736	.long sys_ni_syscall	/* streams1 */
737	.long sys_ni_syscall	/* streams2 */
738	.long sys_vfork		/* 190 */
739	.long sys_getrlimit
740	.long sys_mmap2
741	.long sys_truncate64
742	.long sys_ftruncate64
743	.long sys_stat64	/* 195 */
744	.long sys_lstat64
745	.long sys_fstat64
746	.long sys_lchown
747	.long sys_getuid
748	.long sys_getgid	/* 200 */
749	.long sys_geteuid
750	.long sys_getegid
751	.long sys_setreuid
752	.long sys_setregid
753	.long sys_getgroups	/* 205 */
754	.long sys_setgroups
755	.long sys_fchown
756	.long sys_setresuid
757	.long sys_getresuid
758	.long sys_setresgid	/* 210 */
759	.long sys_getresgid
760	.long sys_chown
761	.long sys_setuid
762	.long sys_setgid
763	.long sys_setfsuid	/* 215 */
764	.long sys_setfsgid
765	.long sys_pivot_root
766	.long sys_mincore
767	.long sys_madvise
768	.long sys_getdents64	/* 220 */
769	.long sys_fcntl64
770	.long sys_ni_syscall	/* reserved for TUX */
771	.long sys_ni_syscall
772	.long sys_gettid
773	.long sys_readahead	/* 225 */
774	.long sys_setxattr
775	.long sys_lsetxattr
776	.long sys_fsetxattr
777	.long sys_getxattr
778	.long sys_lgetxattr	/* 230 */
779	.long sys_fgetxattr
780	.long sys_listxattr
781	.long sys_llistxattr
782	.long sys_flistxattr
783	.long sys_removexattr	/* 235 */
784	.long sys_lremovexattr
785	.long sys_fremovexattr
786	.long sys_tkill
787	.long sys_sendfile64
788	.long sys_futex		/* 240 */
789	.long sys_sched_setaffinity
790	.long sys_sched_getaffinity
791	.long sys_ni_syscall	/* sys_set_thread_area */
792	.long sys_ni_syscall	/* sys_get_thread_area */
793	.long sys_io_setup	/* 245 */
794	.long sys_io_destroy
795	.long sys_io_getevents
796	.long sys_io_submit
797	.long sys_io_cancel
798	.long sys_fadvise64	/* 250 */
799	.long sys_ni_syscall
800	.long sys_exit_group
801	.long sys_lookup_dcookie
802	.long sys_epoll_create
803	.long sys_epoll_ctl	/* 255 */
804	.long sys_epoll_wait
805	.long sys_remap_file_pages
806	.long sys_set_tid_address
807	.long sys_timer_create
808	.long sys_timer_settime		/* 260 */
809	.long sys_timer_gettime
810	.long sys_timer_getoverrun
811	.long sys_timer_delete
812	.long sys_clock_settime
813	.long sys_clock_gettime		/* 265 */
814	.long sys_clock_getres
815	.long sys_clock_nanosleep
816	.long sys_statfs64
817	.long sys_fstatfs64
818	.long sys_tgkill	/* 270 */
819	.long sys_utimes
820	.long sys_fadvise64_64
821	.long sys_ni_syscall	/* sys_vserver */
822	.long sys_ni_syscall	/* sys_mbind */
823	.long sys_ni_syscall	/* 275 sys_get_mempolicy */
824	.long sys_ni_syscall	/* sys_set_mempolicy */
825	.long sys_mq_open
826	.long sys_mq_unlink
827	.long sys_mq_timedsend
828	.long sys_mq_timedreceive	/* 280 */
829	.long sys_mq_notify
830	.long sys_mq_getsetattr
831	.long sys_ni_syscall		/* reserved for kexec */
832	.long sys_waitid
833	.long sys_ni_syscall		/* 285 */ /* available */
834	.long sys_add_key
835	.long sys_request_key
836	.long sys_keyctl
837	.long sys_ioprio_set
838	.long sys_ioprio_get		/* 290 */
839	.long sys_inotify_init
840	.long sys_inotify_add_watch
841	.long sys_inotify_rm_watch
842	.long sys_migrate_pages
843	.long sys_openat		/* 295 */
844	.long sys_mkdirat
845	.long sys_mknodat
846	.long sys_fchownat
847	.long sys_futimesat
848	.long sys_fstatat64		/* 300 */
849	.long sys_unlinkat
850	.long sys_renameat
851	.long sys_linkat
852	.long sys_symlinkat
853	.long sys_readlinkat		/* 305 */
854	.long sys_fchmodat
855	.long sys_faccessat
856	.long sys_pselect6
857	.long sys_ppoll
858	.long sys_unshare		/* 310 */
859	.long sys_set_robust_list
860	.long sys_get_robust_list
861	.long sys_splice
862	.long sys_sync_file_range
863	.long sys_tee			/* 315 */
864	.long sys_vmsplice
865	.long sys_move_pages
866	.long sys_getcpu
867	.long sys_epoll_pwait
868	.long sys_utimensat		/* 320 */
869	.long sys_signalfd
870	.long sys_timerfd_create
871	.long sys_eventfd
872	.long sys_fallocate
873	.long sys_timerfd_settime       /* 325 */
874	.long sys_timerfd_gettime
875	.long sys_signalfd4
876	.long sys_eventfd2
877	.long sys_epoll_create1
878	.long sys_dup3			/* 330 */
879	.long sys_pipe2
880	.long sys_inotify_init1
881	.long sys_preadv
882	.long sys_pwritev
883	.long sys_setns			/* 335 */
884
885        /*
886         * NOTE!! This doesn't have to be exact - we just have
887         * to make sure we have _enough_ of the "sys_ni_syscall"
888         * entries. Don't panic if you notice that this hasn't
889         * been shrunk every time we add a new system call.
890         */
891
892	.rept NR_syscalls - (.-sys_call_table) / 4
893		.long sys_ni_syscall
894	.endr
895
896