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