1/*
2 *  linux/arch/cris/entry.S
3 *
4 *  Copyright (C) 2000, 2001, 2002 Axis Communications AB
5 *
6 *  Authors:	Bjorn Wesen (bjornw@axis.com)
7 */
8
9/*
10 * entry.S contains the system-call and fault low-level handling routines.
11 *
12 * NOTE: This code handles signal-recognition, which happens every time
13 * after a timer-interrupt and after each system call.
14 *
15 * Stack layout in 'ret_from_system_call':
16 *	ptrace needs to have all regs on the stack.
17 *	if the order here is changed, it needs to be
18 *	updated in fork.c:copy_process, signal.c:do_signal,
19 *	ptrace.c and ptrace.h
20 *
21 */
22
23#include <linux/linkage.h>
24#include <linux/sys.h>
25#include <asm/unistd.h>
26#include <arch/sv_addr_ag.h>
27#include <asm/errno.h>
28#include <asm/thread_info.h>
29#include <asm/asm-offsets.h>
30#include <asm/page.h>
31#include <asm/pgtable.h>
32
33	;; functions exported from this file
34
35	.globl system_call
36	.globl ret_from_intr
37	.globl ret_from_fork
38	.globl ret_from_kernel_thread
39	.globl resume
40	.globl multiple_interrupt
41	.globl hwbreakpoint
42	.globl IRQ1_interrupt
43	.globl spurious_interrupt
44	.globl hw_bp_trigs
45	.globl mmu_bus_fault
46	.globl do_sigtrap
47	.globl gdb_handle_breakpoint
48	.globl sys_call_table
49
50	;; below are various parts of system_call which are not in the fast-path
51
52#ifdef CONFIG_PREEMPT
53	; Check if preemptive kernel scheduling should be done
54_resume_kernel:
55	di
56	; Load current task struct
57	movs.w	-8192, $r0	;  THREAD_SIZE = 8192
58	and.d	$sp, $r0
59	move.d	[$r0+TI_preempt_count], $r10	;  Preemption disabled?
60	bne	_Rexit
61	nop
62_need_resched:
63	move.d	[$r0+TI_flags], $r10
64	btstq	TIF_NEED_RESCHED, $r10	; Check if need_resched is set
65	bpl	_Rexit
66	nop
67	; Ok, lets's do some preemptive kernel scheduling
68	jsr	preempt_schedule_irq
69	; Load new task struct
70	movs.w	-8192, $r0	;  THREAD_SIZE = 8192
71	and.d	$sp, $r0
72	; One more time (with new task)
73	ba	_need_resched
74	nop
75#else
76#define _resume_kernel _Rexit
77#endif
78
79	; Called at exit from fork. schedule_tail must be called to drop
80	; spinlock if CONFIG_PREEMPT
81ret_from_fork:
82	jsr schedule_tail
83	ba  ret_from_sys_call
84	nop
85
86ret_from_kernel_thread:
87	jsr schedule_tail
88	move.d	$r2, $r10	; argument is here
89	jsr	$r1		; call the payload
90	moveq	0, $r9		; no syscall restarts, TYVM...
91	ba  ret_from_sys_call
92
93ret_from_intr:
94	;; check for resched if preemptive kernel or if we're going back to user-mode
95	;; this test matches the user_regs(regs) macro
96	;; we cannot simply test $dccr, because that does not necessarily
97	;; reflect what mode we'll return into.
98
99	move.d	[$sp + PT_dccr], $r0; regs->dccr
100	btstq	8, $r0		; U-flag
101	bpl     _resume_kernel
102	; Note that di below is in delay slot
103
104_resume_userspace:
105	di			; so need_resched and sigpending don't change
106
107	movs.w	-8192, $r0	; THREAD_SIZE == 8192
108	and.d	$sp, $r0
109
110	move.d	[$r0+TI_flags], $r10	; current->work
111	and.d	_TIF_WORK_MASK, $r10	; is there any work to be done on return
112	bne	_work_pending
113	nop
114	ba	_Rexit
115	nop
116
117	;; The system_call is called by a BREAK instruction, which works like
118	;; an interrupt call but it stores the return PC in BRP instead of IRP.
119	;; Since we dont really want to have two epilogues (one for system calls
120	;; and one for interrupts) we push the contents of BRP instead of IRP in the
121	;; system call prologue, to make it look like an ordinary interrupt on the
122	;; stackframe.
123	;;
124	;; Since we can't have system calls inside interrupts, it should not matter
125	;; that we don't stack IRP.
126	;;
127	;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,r13,mof,srp
128	;;
129	;; This function looks on the _surface_ like spaghetti programming, but it's
130	;; really designed so that the fast-path does not force cache-loading of non-used
131	;; instructions. Only the non-common cases cause the outlined code to run..
132
133system_call:
134	;; stack-frame similar to the irq heads, which is reversed in ret_from_sys_call
135	move	$brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
136	push	$srp
137	push	$dccr
138	push	$mof
139	subq	14*4, $sp		; make room for r0-r13
140	movem	$r13, [$sp]	; push r0-r13
141	push	$r10		; push orig_r10
142	clear.d [$sp=$sp-4]	; frametype == 0, normal stackframe
143
144	movs.w	-ENOSYS, $r0
145	move.d	$r0, [$sp+PT_r10]	; put the default return value in r10 in the frame
146
147	;; check if this process is syscall-traced
148
149	movs.w	-8192, $r0	; THREAD_SIZE == 8192
150	and.d	$sp, $r0
151
152	move.d	[$r0+TI_flags], $r0
153	btstq   TIF_SYSCALL_TRACE, $r0
154	bmi	_syscall_trace_entry
155	nop
156
157_syscall_traced:
158
159	;; check for sanity in the requested syscall number
160
161	cmpu.w	NR_syscalls, $r9
162	bcc	ret_from_sys_call
163	lslq	2, $r9		;  multiply by 4, in the delay slot
164
165	;; as a bonus 7th parameter, we give the location on the stack
166	;; of the register structure itself. some syscalls need this.
167
168	push	$sp
169
170	;; the parameter carrying registers r10, r11, r12 and 13 are intact.
171	;; the fifth and sixth parameters (if any) was in mof and srp
172	;; respectively, and we need to put them on the stack.
173
174	push	$srp
175	push	$mof
176
177	jsr	[$r9+sys_call_table]	; actually do the system call
178	addq	3*4, $sp		; pop the mof, srp and regs parameters
179	move.d	$r10, [$sp+PT_r10]	; save the return value
180
181	moveq	1, $r9		; "parameter" to ret_from_sys_call to show it was a sys call
182
183	;; fall through into ret_from_sys_call to return
184
185ret_from_sys_call:
186	;; r9 is a parameter - if >=1 we came from a syscall, if 0, from an irq
187
188	;; get the current task-struct pointer (see top for defs)
189
190	movs.w	-8192, $r0	; THREAD_SIZE == 8192
191	and.d	$sp, $r0
192
193	di			; make sure need_resched and sigpending don't change
194	move.d	[$r0+TI_flags],$r1
195	and.d	_TIF_ALLWORK_MASK, $r1
196	bne	_syscall_exit_work
197	nop
198
199_Rexit:
200	;; this epilogue MUST match the prologues in multiple_interrupt, irq.h and ptregs.h
201	pop	$r10		; frametype
202	bne	_RBFexit	; was not CRIS_FRAME_NORMAL, handle otherwise
203	addq	4, $sp		; skip orig_r10, in delayslot
204	movem	[$sp+], $r13	; registers r0-r13
205	pop	$mof		; multiply overflow register
206	pop	$dccr		; condition codes
207	pop	$srp		; subroutine return pointer
208	;; now we have a 4-word SBFS frame which we do not want to restore
209	;; using RBF since it was not stacked with SBFS. instead we would like to
210	;; just get the PC value to restart it with, and skip the rest of
211	;; the frame.
212	;; Also notice that it's important to use instructions here that
213	;; keep the interrupts disabled (since we've already popped DCCR)
214	move	[$sp=$sp+16], $p8; pop the SBFS frame from the sp
215	jmpu	[$sp-16]	; return through the irp field in the sbfs frame
216
217_RBFexit:
218	movem	[$sp+], $r13	; registers r0-r13, in delay slot
219	pop	$mof		; multiply overflow register
220	pop	$dccr		; condition codes
221	pop	$srp		; subroutine return pointer
222	rbf	[$sp+]		; return by popping the CPU status
223
224	;; We get here after doing a syscall if extra work might need to be done
225	;; perform syscall exit tracing if needed
226
227_syscall_exit_work:
228	;; $r0 contains current at this point and irq's are disabled
229
230	move.d  [$r0+TI_flags], $r1
231	btstq	TIF_SYSCALL_TRACE, $r1
232	bpl	_work_pending
233	nop
234
235	ei
236
237	move.d	$r9, $r1	; preserve r9
238	jsr	do_syscall_trace
239	move.d	$r1, $r9
240
241	ba	_resume_userspace
242	nop
243
244_work_pending:
245	move.d  [$r0+TI_flags], $r1
246	btstq   TIF_NEED_RESCHED, $r1
247	bpl	_work_notifysig	; was neither trace nor sched, must be signal/notify
248	nop
249
250_work_resched:
251	move.d	$r9, $r1	; preserve r9
252	jsr	schedule
253	move.d	$r1, $r9
254	di
255
256	move.d	[$r0+TI_flags], $r1
257	and.d	_TIF_WORK_MASK, $r1; ignore the syscall trace counter
258	beq	_Rexit
259	nop
260	btstq	TIF_NEED_RESCHED, $r1
261	bmi	_work_resched	; current->work.need_resched
262	nop
263
264_work_notifysig:
265	;; deal with pending signals and notify-resume requests
266
267	move.d	$r9, $r10	; do_notify_resume syscall/irq param
268	move.d	$sp, $r11	; the regs param
269	move.d  $r1, $r12	; the thread_info_flags parameter
270	jsr	do_notify_resume
271
272	ba _Rexit
273	nop
274
275	;; We get here as a sidetrack when we've entered a syscall with the
276	;; trace-bit set. We need to call do_syscall_trace and then continue
277	;; with the call.
278
279_syscall_trace_entry:
280	;; PT_r10 in the frame contains -ENOSYS as required, at this point
281
282	jsr	do_syscall_trace
283
284	;; now re-enter the syscall code to do the syscall itself
285	;; we need to restore $r9 here to contain the wanted syscall, and
286	;; the other parameter-bearing registers
287
288	move.d	[$sp+PT_r9], $r9
289	move.d	[$sp+PT_orig_r10], $r10  ; PT_r10 is already filled with -ENOSYS.
290	move.d	[$sp+PT_r11],      $r11
291	move.d	[$sp+PT_r12],      $r12
292	move.d	[$sp+PT_r13],      $r13
293	move	[$sp+PT_mof],      $mof
294	move	[$sp+PT_srp],      $srp
295
296	ba	_syscall_traced
297	nop
298
299	;; resume performs the actual task-switching, by switching stack pointers
300	;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct
301	;; returns old current in r10
302	;;
303	;; TODO:  see the i386 version. The switch_to which calls resume in our version
304	;;        could really be an inline asm of this.
305
306resume:
307	push	$srp		         ; we keep the old/new PC on the stack
308	add.d	$r12, $r10		 ; r10 = current tasks tss
309	move	$dccr, [$r10+THREAD_dccr]; save irq enable state
310	di
311
312	move	$usp, [$r10+ THREAD_usp] ; save user-mode stackpointer
313
314	;; See copy_thread for the reason why register R9 is saved.
315	subq	10*4, $sp
316	movem	$r9, [$sp]		 ; save non-scratch registers and R9.
317
318	move.d	$sp, [$r10+THREAD_ksp]	 ; save the kernel stack pointer for the old task
319	move.d	$sp, $r10		 ; return last running task in r10
320	and.d   -8192, $r10	         ; get thread_info from stackpointer
321	move.d  [$r10+TI_task], $r10     ; get task
322	add.d	$r12, $r11		 ; find the new tasks tss
323	move.d	[$r11+THREAD_ksp], $sp	 ; switch into the new stackframe by restoring kernel sp
324
325	movem	[$sp+], $r9		 ; restore non-scratch registers and R9.
326
327	move	[$r11+THREAD_usp], $usp ; restore user-mode stackpointer
328
329	move	[$r11+THREAD_dccr], $dccr ; restore irq enable status
330	jump	[$sp+]		         ; restore PC
331
332	;; This is the MMU bus fault handler.
333	;; It needs to stack the CPU status and overall is different
334	;; from the other interrupt handlers.
335
336mmu_bus_fault:
337	;; For refills we try to do a quick page table lookup. If it is
338	;; a real fault we let the mm subsystem handle it.
339
340	;; the first longword in the sbfs frame was the interrupted PC
341	;; which fits nicely with the "IRP" slot in pt_regs normally used to
342	;; contain the return address. used by Oops to print kernel errors.
343	sbfs	[$sp=$sp-16]	; push the internal CPU status
344	push	$dccr
345	di
346	subq	2*4, $sp
347	movem	$r1, [$sp]
348	move.d  [R_MMU_CAUSE], $r1
349	;; ETRAX 100LX TR89 bugfix: if the second half of an unaligned
350	;; write causes a MMU-fault, it will not be restarted correctly.
351	;; This could happen if a write crosses a page-boundary and the
352	;; second page is not yet COW'ed or even loaded. The workaround
353	;; is to clear the unaligned bit in the CPU status record, so
354	;; that the CPU will rerun both the first and second halves of
355	;; the instruction. This will not have any sideeffects unless
356	;; the first half goes to any device or memory that can't be
357	;; written twice, and which is mapped through the MMU.
358	;;
359	;; We only need to do this for writes.
360	btstq	8, $r1		   ; Write access?
361	bpl	1f
362	nop
363	move.d	[$sp+16], $r0	   ; Clear unaligned bit in csrinstr
364	and.d	~(1<<5), $r0
365	move.d	$r0, [$sp+16]
3661:	btstq	12, $r1		   ; Refill?
367	bpl	2f
368	lsrq	24, $r1     ; Get PGD index (bit 24-31)
369	move.d  [current_pgd], $r0 ; PGD for the current process
370	move.d	[$r0+$r1.d], $r0   ; Get PMD
371	beq	2f
372	nop
373	and.w	PAGE_MASK, $r0	   ; Remove PMD flags
374	move.d  [R_MMU_CAUSE], $r1
375	lsrq	PAGE_SHIFT, $r1
376	and.d	0x7ff, $r1         ; Get PTE index into PGD (bit 13-23)
377	move.d	[$r0+$r1.d], $r1   ; Get PTE
378	beq	2f
379	nop
380	;; Store in TLB
381	move.d  $r1, [R_TLB_LO]
382	;; Return
383	movem	[$sp+], $r1
384	pop	$dccr
385	rbf	[$sp+]		; return by popping the CPU status
386
3872:	; PMD or PTE missing, let the mm subsystem fix it up.
388	movem	[$sp+], $r1
389	pop	$dccr
390
391	; Ok, not that easy, pass it on to the mm subsystem
392	; The MMU status record is now on the stack
393	push	$srp		; make a stackframe similar to pt_regs
394	push	$dccr
395	push	$mof
396	di
397	subq	14*4, $sp
398	movem	$r13, [$sp]
399	push	$r10		; dummy orig_r10
400	moveq	1, $r10
401	push	$r10		; frametype == 1, BUSFAULT frame type
402
403	move.d	$sp, $r10	; pt_regs argument to handle_mmu_bus_fault
404
405	jsr	handle_mmu_bus_fault  ; in arch/cris/arch-v10/mm/fault.c
406
407	;; now we need to return through the normal path, we cannot just
408	;; do the RBFexit since we might have killed off the running
409	;; process due to a SEGV, scheduled due to a page blocking or
410	;; whatever.
411
412	moveq	0, $r9		; busfault is equivalent to an irq
413
414	ba	ret_from_intr
415	nop
416
417	;; special handlers for breakpoint and NMI
418hwbreakpoint:
419	push	$dccr
420	di
421	push	$r10
422	push	$r11
423	move.d	[hw_bp_trig_ptr],$r10
424	move	$brp,$r11
425	move.d	$r11,[$r10+]
426	move.d	$r10,[hw_bp_trig_ptr]
4271:	pop	$r11
428	pop	$r10
429	pop	$dccr
430	retb
431	nop
432
433IRQ1_interrupt:
434	;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
435	move	$brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
436	push	$srp
437	push	$dccr
438	push	$mof
439	di
440	subq	14*4, $sp
441	movem	$r13, [$sp]
442	push	$r10		; push orig_r10
443	clear.d [$sp=$sp-4]	; frametype == 0, normal frame
444
445	;; If there is a glitch on the NMI pin shorter than ~100ns
446	;; (i.e. non-active by the time we get here) then the nmi_pin bit
447	;; in R_IRQ_MASK0_RD will already be cleared.  The watchdog_nmi bit
448	;; is cleared by us however (when feeding the watchdog), which is why
449	;; we use that bit to determine what brought us here.
450
451	move.d	[R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
452	and.d   (1<<30), $r1
453	bne	wdog
454	move.d  $sp, $r10
455	jsr	handle_nmi
456	setf m			; Enable NMI again
457	ba	_Rexit		; Return the standard way
458	nop
459wdog:
460#if defined(CONFIG_ETRAX_WATCHDOG)
461;; Check if we're waiting for reset to happen, as signalled by
462;; hard_reset_now setting cause_of_death to a magic value.  If so, just
463;; get stuck until reset happens.
464	.comm	cause_of_death, 4	;; Don't declare this anywhere.
465	move.d	[cause_of_death], $r10
466	cmp.d	0xbedead, $r10
467_killed_by_death:
468	beq	_killed_by_death
469	nop
470
471;; We'll see this in ksymoops dumps.
472Watchdog_bite:
473
474#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
475       ;; We just restart the watchdog here to be sure we dont get
476       ;; hit while printing the watchdogmsg below
477       ;; This restart is compatible with the rest of the C-code, so
478       ;; the C-code can keep restarting the watchdog after this point.
479       ;; The non-NICE_DOGGY code below though, disables the possibility
480       ;; to restart since it changes the watchdog key, to avoid any
481       ;; buggy loops etc. keeping the watchdog alive after this.
482       jsr     reset_watchdog
483#else
484
485;; We need to extend the 3.3ms after the NMI at watchdog bite, so we have
486;; time for an oops-dump over a 115k2 serial wire.  Another 100ms should do.
487
488;; Change the watchdog key to an arbitrary 3-bit value and restart the
489;; watchdog.
490#define WD_INIT 2
491	moveq	  IO_FIELD (R_WATCHDOG, key, WD_INIT), $r10
492	move.d	R_WATCHDOG, $r11
493
494	move.d	$r10, [$r11]
495	moveq	  IO_FIELD (R_WATCHDOG, key,				\
496			    IO_EXTRACT (R_WATCHDOG, key,		\
497					IO_MASK (R_WATCHDOG, key))	\
498			    ^ WD_INIT)					\
499		| IO_STATE (R_WATCHDOG, enable, start), $r10
500	move.d	$r10, [$r11]
501
502#endif
503
504;; Note that we don't do "setf m" here (or after two necessary NOPs),
505;; since *not* doing that saves us from re-entrancy checks.  We don't want
506;; to get here again due to possible subsequent NMIs; we want the watchdog
507;; to reset us.
508
509	move.d	_watchdogmsg,$r10
510	jsr	printk
511
512	move.d	$sp, $r10
513	jsr	watchdog_bite_hook
514
515;; This nop is here so we see the "Watchdog_bite" label in ksymoops dumps
516;; rather than "spurious_interrupt".
517	nop
518;; At this point we drop down into spurious_interrupt, which will do a
519;; hard reset.
520
521	.section .rodata,"a"
522_watchdogmsg:
523	.ascii	"Oops: bitten by watchdog\n\0"
524	.previous
525
526#endif /* CONFIG_ETRAX_WATCHDOG */
527
528spurious_interrupt:
529	di
530	jump hard_reset_now
531
532	;; this handles the case when multiple interrupts arrive at the same time
533	;; we jump to the first set interrupt bit in a priority fashion
534	;; the hardware will call the unserved interrupts after the handler finishes
535
536multiple_interrupt:
537	;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
538	move	$irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
539	push	$srp
540	push	$dccr
541	push	$mof
542	di
543	subq	14*4, $sp
544	movem	$r13, [$sp]
545	push	$r10		; push orig_r10
546	clear.d [$sp=$sp-4]	; frametype == 0, normal frame
547
548	move.d  $sp, $r10
549	jsr	do_multiple_IRQ
550
551	jump    ret_from_intr
552
553do_sigtrap:
554	;;
555	;; SIGTRAP the process that executed the break instruction.
556	;; Make a frame that Rexit in entry.S expects.
557	;;
558	move	$brp, [$sp=$sp-16]	; Push BRP while faking a cpu status record.
559	push	$srp			; Push subroutine return pointer.
560	push	$dccr			; Push condition codes.
561	push	$mof			; Push multiply overflow reg.
562	di				; Need to disable irq's at this point.
563	subq	14*4, $sp		; Make room for r0-r13.
564	movem	$r13, [$sp]		; Push the r0-r13 registers.
565	push	$r10			; Push orig_r10.
566	clear.d	[$sp=$sp-4]		; Frametype - this is a normal stackframe.
567
568	movs.w	-8192,$r9		; THREAD_SIZE == 8192
569	and.d	$sp, $r9
570	move.d  [$r9+TI_task], $r10
571	move.d  [$r10+TASK_pid], $r10	; current->pid as arg1.
572	moveq	5, $r11			; SIGTRAP as arg2.
573	jsr	sys_kill
574	jump	ret_from_intr		; Use the return routine for interrupts.
575
576gdb_handle_breakpoint:
577	push	$dccr
578	push	$r0
579#ifdef CONFIG_ETRAX_KGDB
580	move	$dccr, $r0		; U-flag not affected by previous insns.
581	btstq	8, $r0			; Test the U-flag.
582	bmi	_ugdb_handle_breakpoint	; Go to user mode debugging.
583	nop				; Empty delay slot (cannot pop r0 here).
584	pop	$r0			; Restore r0.
585	ba	kgdb_handle_breakpoint	; Go to kernel debugging.
586	pop	$dccr			; Restore dccr in delay slot.
587#endif
588
589_ugdb_handle_breakpoint:
590	move	$brp, $r0		; Use r0 temporarily for calculation.
591	subq	2, $r0			; Set to address of previous instruction.
592	move	$r0, $brp
593	pop	$r0			; Restore r0.
594	ba	do_sigtrap		; SIGTRAP the offending process.
595	pop	$dccr			; Restore dccr in delay slot.
596
597	.data
598
599hw_bp_trigs:
600	.space 64*4
601hw_bp_trig_ptr:
602	.dword hw_bp_trigs
603
604	.section .rodata,"a"
605sys_call_table:
606	.long sys_restart_syscall	/* 0 - old "setup()" system call, used for restarting */
607	.long sys_exit
608	.long sys_fork
609	.long sys_read
610	.long sys_write
611	.long sys_open		/* 5 */
612	.long sys_close
613	.long sys_waitpid
614	.long sys_creat
615	.long sys_link
616	.long sys_unlink	/* 10 */
617	.long sys_execve
618	.long sys_chdir
619	.long sys_time
620	.long sys_mknod
621	.long sys_chmod		/* 15 */
622	.long sys_lchown16
623	.long sys_ni_syscall	/* old break syscall holder */
624	.long sys_stat
625	.long sys_lseek
626	.long sys_getpid	/* 20 */
627	.long sys_mount
628	.long sys_oldumount
629	.long sys_setuid16
630	.long sys_getuid16
631	.long sys_stime		/* 25 */
632	.long sys_ptrace
633	.long sys_alarm
634	.long sys_fstat
635	.long sys_pause
636	.long sys_utime		/* 30 */
637	.long sys_ni_syscall	/* old stty syscall holder */
638	.long sys_ni_syscall	/* old gtty syscall holder */
639	.long sys_access
640	.long sys_nice
641	.long sys_ni_syscall	/* 35  old ftime syscall holder */
642	.long sys_sync
643	.long sys_kill
644	.long sys_rename
645	.long sys_mkdir
646	.long sys_rmdir		/* 40 */
647	.long sys_dup
648	.long sys_pipe
649	.long sys_times
650	.long sys_ni_syscall	/* old prof syscall holder */
651	.long sys_brk		/* 45 */
652	.long sys_setgid16
653	.long sys_getgid16
654	.long sys_signal
655	.long sys_geteuid16
656	.long sys_getegid16	/* 50 */
657	.long sys_acct
658	.long sys_umount	/* recycled never used phys( */
659	.long sys_ni_syscall	/* old lock syscall holder */
660	.long sys_ioctl
661	.long sys_fcntl		/* 55 */
662	.long sys_ni_syscall	/* old mpx syscall holder */
663	.long sys_setpgid
664	.long sys_ni_syscall	/* old ulimit syscall holder */
665	.long sys_ni_syscall	/* old sys_olduname holder */
666	.long sys_umask		/* 60 */
667	.long sys_chroot
668	.long sys_ustat
669	.long sys_dup2
670	.long sys_getppid
671	.long sys_getpgrp	/* 65 */
672	.long sys_setsid
673	.long sys_sigaction
674	.long sys_sgetmask
675	.long sys_ssetmask
676	.long sys_setreuid16	/* 70 */
677	.long sys_setregid16
678	.long sys_sigsuspend
679	.long sys_sigpending
680	.long sys_sethostname
681	.long sys_setrlimit	/* 75 */
682	.long sys_old_getrlimit
683	.long sys_getrusage
684	.long sys_gettimeofday
685	.long sys_settimeofday
686	.long sys_getgroups16	/* 80 */
687	.long sys_setgroups16
688	.long sys_select	/* was old_select in Linux/E100 */
689	.long sys_symlink
690	.long sys_lstat
691	.long sys_readlink	/* 85 */
692	.long sys_uselib
693	.long sys_swapon
694	.long sys_reboot
695	.long sys_old_readdir
696	.long sys_old_mmap	/* 90 */
697	.long sys_munmap
698	.long sys_truncate
699	.long sys_ftruncate
700	.long sys_fchmod
701	.long sys_fchown16	/* 95 */
702	.long sys_getpriority
703	.long sys_setpriority
704	.long sys_ni_syscall	/* old profil syscall holder */
705	.long sys_statfs
706	.long sys_fstatfs	/* 100 */
707	.long sys_ni_syscall	/* sys_ioperm in i386 */
708	.long sys_socketcall
709	.long sys_syslog
710	.long sys_setitimer
711	.long sys_getitimer	/* 105 */
712	.long sys_newstat
713	.long sys_newlstat
714	.long sys_newfstat
715	.long sys_ni_syscall	/* old sys_uname holder */
716	.long sys_ni_syscall	/* 110 */ /* sys_iopl in i386 */
717	.long sys_vhangup
718	.long sys_ni_syscall	/* old "idle" system call */
719	.long sys_ni_syscall	/* vm86old in i386 */
720	.long sys_wait4
721	.long sys_swapoff	/* 115 */
722	.long sys_sysinfo
723	.long sys_ipc
724	.long sys_fsync
725	.long sys_sigreturn
726	.long sys_clone		/* 120 */
727	.long sys_setdomainname
728	.long sys_newuname
729	.long sys_ni_syscall	/* sys_modify_ldt */
730	.long sys_adjtimex
731	.long sys_mprotect	/* 125 */
732	.long sys_sigprocmask
733	.long sys_ni_syscall	/* old "create_module" */
734	.long sys_init_module
735	.long sys_delete_module
736	.long sys_ni_syscall	/* 130:	old "get_kernel_syms" */
737	.long sys_quotactl
738	.long sys_getpgid
739	.long sys_fchdir
740	.long sys_bdflush
741	.long sys_sysfs		/* 135 */
742	.long sys_personality
743	.long sys_ni_syscall	/* for afs_syscall */
744	.long sys_setfsuid16
745	.long sys_setfsgid16
746	.long sys_llseek	/* 140 */
747	.long sys_getdents
748	.long sys_select
749	.long sys_flock
750	.long sys_msync
751	.long sys_readv		/* 145 */
752	.long sys_writev
753	.long sys_getsid
754	.long sys_fdatasync
755	.long sys_sysctl
756	.long sys_mlock		/* 150 */
757	.long sys_munlock
758	.long sys_mlockall
759	.long sys_munlockall
760	.long sys_sched_setparam
761	.long sys_sched_getparam	/* 155 */
762	.long sys_sched_setscheduler
763	.long sys_sched_getscheduler
764	.long sys_sched_yield
765	.long sys_sched_get_priority_max
766	.long sys_sched_get_priority_min	/* 160 */
767	.long sys_sched_rr_get_interval
768	.long sys_nanosleep
769	.long sys_mremap
770	.long sys_setresuid16
771	.long sys_getresuid16	/* 165 */
772	.long sys_ni_syscall	/* sys_vm86 */
773	.long sys_ni_syscall	/* Old sys_query_module */
774	.long sys_poll
775	.long sys_ni_syscall    /* old nfsservctl */
776	.long sys_setresgid16	/* 170 */
777	.long sys_getresgid16
778	.long sys_prctl
779	.long sys_rt_sigreturn
780	.long sys_rt_sigaction
781	.long sys_rt_sigprocmask	/* 175 */
782	.long sys_rt_sigpending
783	.long sys_rt_sigtimedwait
784	.long sys_rt_sigqueueinfo
785	.long sys_rt_sigsuspend
786	.long sys_pread64	/* 180 */
787	.long sys_pwrite64
788	.long sys_chown16
789	.long sys_getcwd
790	.long sys_capget
791	.long sys_capset	/* 185 */
792	.long sys_sigaltstack
793	.long sys_sendfile
794	.long sys_ni_syscall	/* streams1 */
795	.long sys_ni_syscall	/* streams2 */
796	.long sys_vfork		/* 190 */
797	.long sys_getrlimit
798	.long sys_mmap2		/* mmap_pgoff */
799	.long sys_truncate64
800	.long sys_ftruncate64
801	.long sys_stat64	/* 195 */
802	.long sys_lstat64
803	.long sys_fstat64
804	.long sys_lchown
805	.long sys_getuid
806	.long sys_getgid	/* 200 */
807	.long sys_geteuid
808	.long sys_getegid
809	.long sys_setreuid
810	.long sys_setregid
811	.long sys_getgroups	/* 205 */
812	.long sys_setgroups
813	.long sys_fchown
814	.long sys_setresuid
815	.long sys_getresuid
816	.long sys_setresgid	/* 210 */
817	.long sys_getresgid
818	.long sys_chown
819	.long sys_setuid
820	.long sys_setgid
821	.long sys_setfsuid	/* 215 */
822	.long sys_setfsgid
823	.long sys_pivot_root
824	.long sys_mincore
825	.long sys_madvise
826	.long sys_getdents64	/* 220 */
827	.long sys_fcntl64
828	.long sys_ni_syscall	/* reserved for TUX */
829	.long sys_ni_syscall
830	.long sys_gettid
831	.long sys_readahead	/* 225 */
832	.long sys_setxattr
833	.long sys_lsetxattr
834	.long sys_fsetxattr
835	.long sys_getxattr
836	.long sys_lgetxattr	/* 230 */
837	.long sys_fgetxattr
838	.long sys_listxattr
839	.long sys_llistxattr
840	.long sys_flistxattr
841	.long sys_removexattr	/* 235 */
842	.long sys_lremovexattr
843	.long sys_fremovexattr
844	.long sys_tkill
845	.long sys_sendfile64
846	.long sys_futex		/* 240 */
847	.long sys_sched_setaffinity
848	.long sys_sched_getaffinity
849	.long sys_ni_syscall	/* sys_set_thread_area */
850	.long sys_ni_syscall	/* sys_get_thread_area */
851	.long sys_io_setup	/* 245 */
852	.long sys_io_destroy
853	.long sys_io_getevents
854	.long sys_io_submit
855	.long sys_io_cancel
856	.long sys_fadvise64	/* 250 */
857	.long sys_ni_syscall
858	.long sys_exit_group
859	.long sys_lookup_dcookie
860	.long sys_epoll_create
861	.long sys_epoll_ctl	/* 255 */
862	.long sys_epoll_wait
863	.long sys_remap_file_pages
864	.long sys_set_tid_address
865	.long sys_timer_create
866	.long sys_timer_settime		/* 260 */
867	.long sys_timer_gettime
868	.long sys_timer_getoverrun
869	.long sys_timer_delete
870	.long sys_clock_settime
871	.long sys_clock_gettime		/* 265 */
872	.long sys_clock_getres
873	.long sys_clock_nanosleep
874	.long sys_statfs64
875	.long sys_fstatfs64
876	.long sys_tgkill		/* 270 */
877	.long sys_utimes
878	.long sys_fadvise64_64
879	.long sys_ni_syscall	/* sys_vserver */
880	.long sys_ni_syscall	/* sys_mbind */
881	.long sys_ni_syscall	/* 275 sys_get_mempolicy */
882	.long sys_ni_syscall	/* sys_set_mempolicy */
883	.long sys_mq_open
884	.long sys_mq_unlink
885	.long sys_mq_timedsend
886	.long sys_mq_timedreceive	/* 280 */
887	.long sys_mq_notify
888	.long sys_mq_getsetattr
889	.long sys_ni_syscall
890	.long sys_waitid
891	.long sys_ni_syscall		/* 285 */ /* available */
892	.long sys_add_key
893	.long sys_request_key
894	.long sys_keyctl
895	.long sys_ioprio_set
896	.long sys_ioprio_get		/* 290 */
897	.long sys_inotify_init
898	.long sys_inotify_add_watch
899	.long sys_inotify_rm_watch
900	.long sys_migrate_pages
901	.long sys_openat		/* 295 */
902	.long sys_mkdirat
903	.long sys_mknodat
904	.long sys_fchownat
905	.long sys_futimesat
906	.long sys_fstatat64		/* 300 */
907	.long sys_unlinkat
908	.long sys_renameat
909	.long sys_linkat
910	.long sys_symlinkat
911	.long sys_readlinkat		/* 305 */
912	.long sys_fchmodat
913	.long sys_faccessat
914	.long sys_pselect6
915	.long sys_ppoll
916	.long sys_unshare		/* 310 */
917	.long sys_set_robust_list
918	.long sys_get_robust_list
919	.long sys_splice
920	.long sys_sync_file_range
921	.long sys_tee			/* 315 */
922	.long sys_vmsplice
923	.long sys_move_pages
924	.long sys_getcpu
925	.long sys_epoll_pwait
926	.long sys_utimensat		/* 320 */
927	.long sys_signalfd
928	.long sys_timerfd_create
929	.long sys_eventfd
930	.long sys_fallocate
931	.long sys_timerfd_settime	/* 325 */
932	.long sys_timerfd_gettime
933	.long sys_signalfd4
934	.long sys_eventfd2
935	.long sys_epoll_create1
936	.long sys_dup3			/* 330 */
937	.long sys_pipe2
938	.long sys_inotify_init1
939	.long sys_preadv
940	.long sys_pwritev
941	.long sys_setns			/* 335 */
942	.long sys_name_to_handle_at
943	.long sys_open_by_handle_at
944	.long sys_rt_tgsigqueueinfo
945	.long sys_perf_event_open
946	.long sys_recvmmsg		/* 340 */
947	.long sys_accept4
948	.long sys_fanotify_init
949	.long sys_fanotify_mark
950	.long sys_prlimit64
951	.long sys_clock_adjtime		/* 345 */
952	.long sys_syncfs
953	.long sys_sendmmsg
954	.long sys_process_vm_readv
955	.long sys_process_vm_writev
956	.long sys_kcmp			/* 350 */
957	.long sys_finit_module
958	.long sys_sched_setattr
959	.long sys_sched_getattr
960	.long sys_renameat2
961	.long sys_seccomp		/* 355 */
962	.long sys_getrandom
963	.long sys_memfd_create
964	.long sys_bpf
965	.long sys_execveat
966
967        /*
968         * NOTE!! This doesn't have to be exact - we just have
969         * to make sure we have _enough_ of the "sys_ni_syscall"
970         * entries. Don't panic if you notice that this hasn't
971         * been shrunk every time we add a new system call.
972         */
973
974	.rept NR_syscalls-(.-sys_call_table)/4
975		.long sys_ni_syscall
976	.endr
977
978