GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / blackfin / mach-common / entry.S
blob35bfb94ef0dc225068517b8219a308af2734fdf4
1 /*
2  * Contains the system-call and fault low-level handling routines.
3  * This also contains the timer-interrupt handler, as well as all
4  * interrupts and faults that can result in a task-switch.
5  *
6  * Copyright 2005-2009 Analog Devices Inc.
7  *
8  * Licensed under the GPL-2 or later.
9  */
11 /* NOTE: This code handles signal-recognition, which happens every time
12  * after a timer-interrupt and after each system call.
13  */
15 #include <linux/init.h>
16 #include <linux/linkage.h>
17 #include <linux/unistd.h>
18 #include <asm/blackfin.h>
19 #include <asm/errno.h>
20 #include <asm/fixed_code.h>
21 #include <asm/thread_info.h>  /* TIF_NEED_RESCHED */
22 #include <asm/asm-offsets.h>
23 #include <asm/trace.h>
24 #include <asm/traps.h>
26 #include <asm/context.S>
28 #if defined(CONFIG_BFIN_SCRATCH_REG_RETN)
29 # define EX_SCRATCH_REG RETN
30 #elif defined(CONFIG_BFIN_SCRATCH_REG_RETE)
31 # define EX_SCRATCH_REG RETE
32 #else
33 # define EX_SCRATCH_REG CYCLES
34 #endif
36 #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
37 .section .l1.text
38 #else
39 .text
40 #endif
42 /* Slightly simplified and streamlined entry point for CPLB misses.
43  * This one does not lower the level to IRQ5, and thus can be used to
44  * patch up CPLB misses on the kernel stack.
45  */
46 #if ANOMALY_05000261
47 #define _ex_dviol _ex_workaround_261
48 #define _ex_dmiss _ex_workaround_261
49 #define _ex_dmult _ex_workaround_261
51 ENTRY(_ex_workaround_261)
52         P4 = R7;        /* Store EXCAUSE */
54         GET_PDA(p5, r7);
55         r7 = [p5 + PDA_LFRETX];
56         r6 = retx;
57         [p5 + PDA_LFRETX] = r6;
58         cc = r6 == r7;
59         if !cc jump _bfin_return_from_exception;
60         /* fall through */
61         R7 = P4;
62         R6 = VEC_CPLB_M;        /* Data CPLB Miss */
63         cc = R6 == R7;
64         if cc jump _ex_dcplb_miss (BP);
65 #ifdef CONFIG_MPU
66         R6 = VEC_CPLB_VL;       /* Data CPLB Violation */
67         cc = R6 == R7;
68         if cc jump _ex_dcplb_viol (BP);
69 #endif
70         /* Handle Data CPLB Protection Violation
71          * and Data CPLB Multiple Hits - Linux Trap Zero
72          */
73         jump _ex_trap_c;
74 ENDPROC(_ex_workaround_261)
76 #else
77 #ifdef CONFIG_MPU
78 #define _ex_dviol _ex_dcplb_viol
79 #else
80 #define _ex_dviol _ex_trap_c
81 #endif
82 #define _ex_dmiss _ex_dcplb_miss
83 #define _ex_dmult _ex_trap_c
84 #endif
87 ENTRY(_ex_dcplb_viol)
88 ENTRY(_ex_dcplb_miss)
89 ENTRY(_ex_icplb_miss)
90         (R7:6,P5:4) = [sp++];
91         /* We leave the previously pushed ASTAT on the stack.  */
92         SAVE_CONTEXT_CPLB
94         /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
95          * will change the stack pointer.  */
96         R0 = SEQSTAT;
97         R1 = SP;
99         DEBUG_HWTRACE_SAVE(p5, r7)
101         sp += -12;
102         call _cplb_hdr;
103         sp += 12;
104         CC = R0 == 0;
105         IF !CC JUMP _handle_bad_cplb;
107 #ifdef CONFIG_DEBUG_DOUBLEFAULT
108         /* While we were processing this, did we double fault? */
109         r7 = SEQSTAT;           /* reason code is in bit 5:0 */
110         r6.l = lo(SEQSTAT_EXCAUSE);
111         r6.h = hi(SEQSTAT_EXCAUSE);
112         r7 = r7 & r6;
113         r6 = 0x25;
114         CC = R7 == R6;
115         if CC JUMP _double_fault;
116 #endif
118         DEBUG_HWTRACE_RESTORE(p5, r7)
119         RESTORE_CONTEXT_CPLB
120         ASTAT = [SP++];
121         SP = EX_SCRATCH_REG;
122         rtx;
123 ENDPROC(_ex_icplb_miss)
125 ENTRY(_ex_syscall)
126         raise 15;               /* invoked by TRAP #0, for sys call */
127         jump.s _bfin_return_from_exception;
128 ENDPROC(_ex_syscall)
130 ENTRY(_ex_single_step)
131         /* If we just returned from an interrupt, the single step event is
132            for the RTI instruction.  */
133         r7 = retx;
134         r6 = reti;
135         cc = r7 == r6;
136         if cc jump _bfin_return_from_exception;
138 #ifdef CONFIG_KGDB
139         /* Don't do single step in hardware exception handler */
140         p5.l = lo(IPEND);
141         p5.h = hi(IPEND);
142         r6 = [p5];
143         cc = bittst(r6, 4);
144         if cc jump _bfin_return_from_exception;
145         cc = bittst(r6, 5);
146         if cc jump _bfin_return_from_exception;
148         /* skip single step if current interrupt priority is higher than
149          * that of the first instruction, from which gdb starts single step */
150         r6 >>= 6;
151         r7 = 10;
152 .Lfind_priority_start:
153         cc = bittst(r6, 0);
154         if cc jump .Lfind_priority_done;
155         r6 >>= 1;
156         r7 += -1;
157         cc = r7 == 0;
158         if cc jump .Lfind_priority_done;
159         jump.s .Lfind_priority_start;
160 .Lfind_priority_done:
161         p4.l = _kgdb_single_step;
162         p4.h = _kgdb_single_step;
163         r6 = [p4];
164         cc = r6 == 0;
165         if cc jump .Ldo_single_step;
166         r6 += -1;
167         cc = r6 < r7;
168         if cc jump 1f;
169 .Ldo_single_step:
170 #else
171         /* If we were in user mode, do the single step normally.  */
172         p5.l = lo(IPEND);
173         p5.h = hi(IPEND);
174         r6 = [p5];
175         r7 = 0xffe0 (z);
176         r7 = r7 & r6;
177         cc = r7 == 0;
178         if !cc jump 1f;
179 #endif
180 #ifdef CONFIG_EXACT_HWERR
181         /* Read the ILAT, and to check to see if the process we are
182          * single stepping caused a previous hardware error
183          * If so, do not single step, (which lowers to IRQ5, and makes
184          * us miss the error).
185          */
186         p5.l = lo(ILAT);
187         p5.h = hi(ILAT);
188         r7 = [p5];
189         cc = bittst(r7, EVT_IVHW_P);
190         if cc jump 1f;
191 #endif
192         /* Single stepping only a single instruction, so clear the trace
193          * bit here.  */
194         r7 = syscfg;
195         bitclr (r7, SYSCFG_SSSTEP_P);
196         syscfg = R7;
197         jump _ex_trap_c;
200         /*
201          * We were in an interrupt handler.  By convention, all of them save
202          * SYSCFG with their first instruction, so by checking whether our
203          * RETX points at the entry point, we can determine whether to allow
204          * a single step, or whether to clear SYSCFG.
205          *
206          * First, find out the interrupt level and the event vector for it.
207          */
208         p5.l = lo(EVT0);
209         p5.h = hi(EVT0);
210         p5 += -4;
212         r7 = rot r7 by -1;
213         p5 += 4;
214         if !cc jump 2b;
216         /* What we actually do is test for the _second_ instruction in the
217          * IRQ handler.  That way, if there are insns following the restore
218          * of SYSCFG after leaving the handler, we will not turn off SYSCFG
219          * for them.  */
221         r7 = [p5];
222         r7 += 2;
223         r6 = RETX;
224         cc = R7 == R6;
225         if !cc jump _bfin_return_from_exception;
227         r7 = syscfg;
228         bitclr (r7, SYSCFG_SSSTEP_P);   /* Turn off single step */
229         syscfg = R7;
231         /* Fall through to _bfin_return_from_exception.  */
232 ENDPROC(_ex_single_step)
234 ENTRY(_bfin_return_from_exception)
235 #if ANOMALY_05000257
236         R7=LC0;
237         LC0=R7;
238         R7=LC1;
239         LC1=R7;
240 #endif
242 #ifdef CONFIG_DEBUG_DOUBLEFAULT
243         /* While we were processing the current exception,
244          * did we cause another, and double fault?
245          */
246         r7 = SEQSTAT;           /* reason code is in bit 5:0 */
247         r6.l = lo(SEQSTAT_EXCAUSE);
248         r6.h = hi(SEQSTAT_EXCAUSE);
249         r7 = r7 & r6;
250         r6 = VEC_UNCOV;
251         CC = R7 == R6;
252         if CC JUMP _double_fault;
253 #endif
255         (R7:6,P5:4) = [sp++];
256         ASTAT = [sp++];
257         sp = EX_SCRATCH_REG;
258         rtx;
259 ENDPROC(_bfin_return_from_exception)
261 ENTRY(_handle_bad_cplb)
262         DEBUG_HWTRACE_RESTORE(p5, r7)
263         /* To get here, we just tried and failed to change a CPLB
264          * so, handle things in trap_c (C code), by lowering to
265          * IRQ5, just like we normally do. Since this is not a
266          * "normal" return path, we have a do alot of stuff to
267          * the stack to get ready so, we can fall through - we
268          * need to make a CPLB exception look like a normal exception
269          */
270         RESTORE_CONTEXT_CPLB
271         /* ASTAT is still on the stack, where it is needed.  */
272         [--sp] = (R7:6,P5:4);
274 ENTRY(_ex_replaceable)
275         nop;
277 ENTRY(_ex_trap_c)
278         /* The only thing that has been saved in this context is
279          * (R7:6,P5:4), ASTAT & SP - don't use anything else
280          */
282         GET_PDA(p5, r6);
284         /* Make sure we are not in a double fault */
285         p4.l = lo(IPEND);
286         p4.h = hi(IPEND);
287         r7 = [p4];
288         CC = BITTST (r7, 5);
289         if CC jump _double_fault;
290         [p5 + PDA_EXIPEND] = r7;
292         /* Call C code (trap_c) to handle the exception, which most
293          * likely involves sending a signal to the current process.
294          * To avoid double faults, lower our priority to IRQ5 first.
295          */
296         r7.h = _exception_to_level5;
297         r7.l = _exception_to_level5;
298         p4.l = lo(EVT5);
299         p4.h = hi(EVT5);
300         [p4] = r7;
301         csync;
303         /*
304          * Save these registers, as they are only valid in exception context
305          *  (where we are now - as soon as we defer to IRQ5, they can change)
306          * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
307          * but they are not very interesting, so don't save them
308          */
310         p4.l = lo(DCPLB_FAULT_ADDR);
311         p4.h = hi(DCPLB_FAULT_ADDR);
312         r7 = [p4];
313         [p5 + PDA_DCPLB] = r7;
315         p4.l = lo(ICPLB_FAULT_ADDR);
316         p4.h = hi(ICPLB_FAULT_ADDR);
317         r6 = [p4];
318         [p5 + PDA_ICPLB] = r6;
320         r6 = retx;
321         [p5 + PDA_RETX] = r6;
323         r6 = SEQSTAT;
324         [p5 + PDA_SEQSTAT] = r6;
326         /* Save the state of single stepping */
327         r6 = SYSCFG;
328         [p5 + PDA_SYSCFG] = r6;
329         /* Clear it while we handle the exception in IRQ5 mode */
330         BITCLR(r6, SYSCFG_SSSTEP_P);
331         SYSCFG = r6;
333         /* Save the current IMASK, since we change in order to jump to level 5 */
334         cli r6;
335         [p5 + PDA_EXIMASK] = r6;
337         p4.l = lo(SAFE_USER_INSTRUCTION);
338         p4.h = hi(SAFE_USER_INSTRUCTION);
339         retx = p4;
341         /* Disable all interrupts, but make sure level 5 is enabled so
342          * we can switch to that level.
343          */
344         r6 = 0x3f;
345         sti r6;
347         /* In case interrupts are disabled IPEND[4] (global interrupt disable bit)
348          * clear it (re-enabling interrupts again) by the special sequence of pushing
349          * RETI onto the stack.  This way we can lower ourselves to IVG5 even if the
350          * exception was taken after the interrupt handler was called but before it
351          * got a chance to enable global interrupts itself.
352          */
353         [--sp] = reti;
354         sp += 4;
356         raise 5;
357         jump.s _bfin_return_from_exception;
358 ENDPROC(_ex_trap_c)
360 /* We just realized we got an exception, while we were processing a different
361  * exception. This is a unrecoverable event, so crash.
362  * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
363  */
364 ENTRY(_double_fault)
365         /* Turn caches & protection off, to ensure we don't get any more
366          * double exceptions
367          */
369         P4.L = LO(IMEM_CONTROL);
370         P4.H = HI(IMEM_CONTROL);
372         R5 = [P4];              /* Control Register*/
373         BITCLR(R5,ENICPLB_P);
374         CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
375         [P4] = R5;
376         SSYNC;
378         P4.L = LO(DMEM_CONTROL);
379         P4.H = HI(DMEM_CONTROL);
380         R5 = [P4];
381         BITCLR(R5,ENDCPLB_P);
382         CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
383         [P4] = R5;
384         SSYNC;
386         /* Fix up the stack */
387         (R7:6,P5:4) = [sp++];
388         ASTAT = [sp++];
389         SP = EX_SCRATCH_REG;
391         /* We should be out of the exception stack, and back down into
392          * kernel or user space stack
393          */
394         SAVE_ALL_SYS
396         /* The dumping functions expect the return address in the RETI
397          * slot.  */
398         r6 = retx;
399         [sp + PT_PC] = r6;
401         r0 = sp;        /* stack frame pt_regs pointer argument ==> r0 */
402         SP += -12;
403         pseudo_long_call _double_fault_c, p5;
404         SP += 12;
405 .L_double_fault_panic:
406         JUMP .L_double_fault_panic
408 ENDPROC(_double_fault)
410 ENTRY(_exception_to_level5)
411         SAVE_ALL_SYS
413         GET_PDA(p5, r7);        /* Fetch current PDA */
414         r6 = [p5 + PDA_RETX];
415         [sp + PT_PC] = r6;
417         r6 = [p5 + PDA_SYSCFG];
418         [sp + PT_SYSCFG] = r6;
420         r6 = [p5 + PDA_SEQSTAT]; /* Read back seqstat */
421         [sp + PT_SEQSTAT] = r6;
423         /* Restore the hardware error vector.  */
424         r7.h = _evt_ivhw;
425         r7.l = _evt_ivhw;
426         p4.l = lo(EVT5);
427         p4.h = hi(EVT5);
428         [p4] = r7;
429         csync;
431 #ifdef CONFIG_DEBUG_DOUBLEFAULT
432         /* Now that we have the hardware error vector programmed properly
433          * we can re-enable interrupts (IPEND[4]), so if the _trap_c causes
434          * another hardware error, we can catch it (self-nesting).
435          */
436         [--sp] = reti;
437         sp += 4;
438 #endif
440         r7 = [p5 + PDA_EXIPEND] /* Read the IPEND from the Exception state */
441         [sp + PT_IPEND] = r7;   /* Store IPEND onto the stack */
443         r0 = sp;        /* stack frame pt_regs pointer argument ==> r0 */
444         SP += -12;
445         pseudo_long_call _trap_c, p4;
446         SP += 12;
448         /* If interrupts were off during the exception (IPEND[4] = 1), turn them off
449          * before we return.
450          */
451         CC = BITTST(r7, EVT_IRPTEN_P)
452         if !CC jump 1f;
453         /* this will load a random value into the reti register - but that is OK,
454          * since we do restore it to the correct value in the 'RESTORE_ALL_SYS' macro
455          */
456         sp += -4;
457         reti = [sp++];
459         /* restore the interrupt mask (IMASK) */
460         r6 = [p5 + PDA_EXIMASK];
461         sti r6;
463         call _ret_from_exception;
464         RESTORE_ALL_SYS
465         rti;
466 ENDPROC(_exception_to_level5)
468 ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
469         /* Since the kernel stack can be anywhere, it's not guaranteed to be
470          * covered by a CPLB.  Switch to an exception stack; use RETN as a
471          * scratch register (for want of a better option).
472          */
473         EX_SCRATCH_REG = sp;
474         GET_PDA_SAFE(sp);
475         sp = [sp + PDA_EXSTACK];
476         /* Try to deal with syscalls quickly.  */
477         [--sp] = ASTAT;
478         [--sp] = (R7:6,P5:4);
480         ANOMALY_283_315_WORKAROUND(p5, r7)
482 #ifdef CONFIG_EXACT_HWERR
483         ssync;
484 #endif
486 #ifdef CONFIG_DEBUG_DOUBLEFAULT
487         /*
488          * Save these registers, as they are only valid in exception context
489          * (where we are now - as soon as we defer to IRQ5, they can change)
490          * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
491          * but they are not very interesting, so don't save them
492          */
494         GET_PDA(p5, r7);
495         p4.l = lo(DCPLB_FAULT_ADDR);
496         p4.h = hi(DCPLB_FAULT_ADDR);
497         r7 = [p4];
498         [p5 + PDA_DF_DCPLB] = r7;
500         p4.l = lo(ICPLB_FAULT_ADDR);
501         p4.h = hi(ICPLB_FAULT_ADDR);
502         r7 = [p4];
503         [p5 + PDA_DF_ICPLB] = r7;
505         r7 = retx;
506         [p5 + PDA_DF_RETX] = r7;
508         r7 = SEQSTAT;           /* reason code is in bit 5:0 */
509         [p5 + PDA_DF_SEQSTAT] = r7;
510 #else
511         r7 = SEQSTAT;           /* reason code is in bit 5:0 */
512 #endif
513         r6.l = lo(SEQSTAT_EXCAUSE);
514         r6.h = hi(SEQSTAT_EXCAUSE);
515         r7 = r7 & r6;
516         p5.h = _ex_table;
517         p5.l = _ex_table;
518         p4 = r7;
519         p5 = p5 + (p4 << 2);
520         p4 = [p5];
521         jump (p4);
523 .Lbadsys:
524         r7 = -ENOSYS;           /* signextending enough */
525         [sp + PT_R0] = r7;      /* return value from system call */
526         jump .Lsyscall_really_exit;
527 ENDPROC(_trap)
529 ENTRY(_kernel_execve)
530         link SIZEOF_PTREGS;
531         p0 = sp;
532         r3 = SIZEOF_PTREGS / 4;
533         r4 = 0(x);
534 .Lclear_regs:
535         [p0++] = r4;
536         r3 += -1;
537         cc = r3 == 0;
538         if !cc jump .Lclear_regs (bp);
540         p0 = sp;
541         sp += -16;
542         [sp + 12] = p0;
543         pseudo_long_call _do_execve, p5;
544         SP += 16;
545         cc = r0 == 0;
546         if ! cc jump .Lexecve_failed;
547         /* Success.  Copy our temporary pt_regs to the top of the kernel
548          * stack and do a normal exception return.
549          */
550         r1 = sp;
551         r0 = (-KERNEL_STACK_SIZE) (x);
552         r1 = r1 & r0;
553         p2 = r1;
554         p3 = [p2];
555         r0 = KERNEL_STACK_SIZE - 4 (z);
556         p1 = r0;
557         p1 = p1 + p2;
559         p0 = fp;
560         r4 = [p0--];
561         r3 = SIZEOF_PTREGS / 4;
562 .Lcopy_regs:
563         r4 = [p0--];
564         [p1--] = r4;
565         r3 += -1;
566         cc = r3 == 0;
567         if ! cc jump .Lcopy_regs (bp);
569         r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
570         p1 = r0;
571         p1 = p1 + p2;
572         sp = p1;
573         r0 = syscfg;
574         [SP + PT_SYSCFG] = r0;
575         [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
577         RESTORE_CONTEXT;
578         rti;
579 .Lexecve_failed:
580         unlink;
581         rts;
582 ENDPROC(_kernel_execve)
584 ENTRY(_system_call)
585         /* Store IPEND */
586         p2.l = lo(IPEND);
587         p2.h = hi(IPEND);
588         csync;
589         r0 = [p2];
590         [sp + PT_IPEND] = r0;
592         /* Store RETS for now */
593         r0 = rets;
594         [sp + PT_RESERVED] = r0;
595         /* Set the stack for the current process */
596         r7 = sp;
597         r6.l = lo(ALIGN_PAGE_MASK);
598         r6.h = hi(ALIGN_PAGE_MASK);
599         r7 = r7 & r6;           /* thread_info */
600         p2 = r7;
601         p2 = [p2];
603         [p2+(TASK_THREAD+THREAD_KSP)] = sp;
604 #ifdef CONFIG_IPIPE
605         r0 = sp;
606         SP += -12;
607         call ___ipipe_syscall_root;
608         SP += 12;
609         cc = r0 == 1;
610         if cc jump .Lsyscall_really_exit;
611         cc = r0 == -1;
612         if cc jump .Lresume_userspace;
613         r3 = [sp + PT_R3];
614         r4 = [sp + PT_R4];
615         p0 = [sp + PT_ORIG_P0];
616 #endif /* CONFIG_IPIPE */
618         /* are we tracing syscalls?*/
619         r7 = sp;
620         r6.l = lo(ALIGN_PAGE_MASK);
621         r6.h = hi(ALIGN_PAGE_MASK);
622         r7 = r7 & r6;
623         p2 = r7;
624         r7 = [p2+TI_FLAGS];
625         CC = BITTST(r7,TIF_SYSCALL_TRACE);
626         if CC JUMP _sys_trace;
627         CC = BITTST(r7,TIF_SINGLESTEP);
628         if CC JUMP _sys_trace;
630         /* Make sure the system call # is valid */
631         p4 = __NR_syscall;
632         /* System call number is passed in P0 */
633         cc = p4 <= p0;
634         if cc jump .Lbadsys;
636         /* Execute the appropriate system call */
638         p4 = p0;
639         p5.l = _sys_call_table;
640         p5.h = _sys_call_table;
641         p5 = p5 + (p4 << 2);
642         r0 = [sp + PT_R0];
643         r1 = [sp + PT_R1];
644         r2 = [sp + PT_R2];
645         p5 = [p5];
647         [--sp] = r5;
648         [--sp] = r4;
649         [--sp] = r3;
650         SP += -12;
651         call (p5);
652         SP += 24;
653         [sp + PT_R0] = r0;
655 .Lresume_userspace:
656         r7 = sp;
657         r4.l = lo(ALIGN_PAGE_MASK);
658         r4.h = hi(ALIGN_PAGE_MASK);
659         r7 = r7 & r4;           /* thread_info->flags */
660         p5 = r7;
661 .Lresume_userspace_1:
662         /* Disable interrupts.  */
663         [--sp] = reti;
664         reti = [sp++];
666         r7 = [p5 + TI_FLAGS];
667         r4.l = lo(_TIF_WORK_MASK);
668         r4.h = hi(_TIF_WORK_MASK);
669         r7 =  r7 & r4;
671 .Lsyscall_resched:
672 #ifdef CONFIG_IPIPE
673         cc = BITTST(r7, TIF_IRQ_SYNC);
674         if !cc jump .Lsyscall_no_irqsync;
675         /*
676          * Clear IPEND[4] manually to undo what resume_userspace_1 just did;
677          * we need this so that high priority domain interrupts may still
678          * preempt the current domain while the pipeline log is being played
679          * back.
680          */
681         [--sp] = reti;
682         SP += 4; /* don't merge with next insn to keep the pattern obvious */
683         SP += -12;
684         call ___ipipe_sync_root;
685         SP += 12;
686         jump .Lresume_userspace_1;
687 .Lsyscall_no_irqsync:
688 #endif
689         cc = BITTST(r7, TIF_NEED_RESCHED);
690         if !cc jump .Lsyscall_sigpending;
692         /* Reenable interrupts.  */
693         [--sp] = reti;
694         sp += 4;
696         SP += -12;
697         pseudo_long_call _schedule, p4;
698         SP += 12;
700         jump .Lresume_userspace_1;
702 .Lsyscall_sigpending:
703         cc = BITTST(r7, TIF_RESTORE_SIGMASK);
704         if cc jump .Lsyscall_do_signals;
705         cc = BITTST(r7, TIF_SIGPENDING);
706         if cc jump .Lsyscall_do_signals;
707         cc = BITTST(r7, TIF_NOTIFY_RESUME);
708         if !cc jump .Lsyscall_really_exit;
709 .Lsyscall_do_signals:
710         /* Reenable interrupts.  */
711         [--sp] = reti;
712         sp += 4;
714         r0 = sp;
715         SP += -12;
716         pseudo_long_call _do_notify_resume, p5;
717         SP += 12;
719 .Lsyscall_really_exit:
720         r5 = [sp + PT_RESERVED];
721         rets = r5;
722         rts;
723 ENDPROC(_system_call)
725 /* Do not mark as ENTRY() to avoid error in assembler ...
726  * this symbol need not be global anyways, so ...
727  */
728 _sys_trace:
729         r0 = sp;
730         pseudo_long_call _syscall_trace_enter, p5;
732         /* Make sure the system call # is valid */
733         p4 = [SP + PT_P0];
734         p3 = __NR_syscall;
735         cc = p3 <= p4;
736         r0 = -ENOSYS;
737         if cc jump .Lsys_trace_badsys;
739         /* Execute the appropriate system call */
740         p5.l = _sys_call_table;
741         p5.h = _sys_call_table;
742         p5 = p5 + (p4 << 2);
743         r0 = [sp + PT_R0];
744         r1 = [sp + PT_R1];
745         r2 = [sp + PT_R2];
746         r3 = [sp + PT_R3];
747         r4 = [sp + PT_R4];
748         r5 = [sp + PT_R5];
749         p5 = [p5];
751         [--sp] = r5;
752         [--sp] = r4;
753         [--sp] = r3;
754         SP += -12;
755         call (p5);
756         SP += 24;
757 .Lsys_trace_badsys:
758         [sp + PT_R0] = r0;
760         r0 = sp;
761         pseudo_long_call _syscall_trace_leave, p5;
762         jump .Lresume_userspace;
763 ENDPROC(_sys_trace)
765 ENTRY(_resume)
766         /*
767          * Beware - when entering resume, prev (the current task) is
768          * in r0, next (the new task) is in r1.
769          */
770         p0 = r0;
771         p1 = r1;
772         [--sp] = rets;
773         [--sp] = fp;
774         [--sp] = (r7:4, p5:3);
776         /* save usp */
777         p2 = usp;
778         [p0+(TASK_THREAD+THREAD_USP)] = p2;
780         /* save current kernel stack pointer */
781         [p0+(TASK_THREAD+THREAD_KSP)] = sp;
783         /* save program counter */
784         r1.l = _new_old_task;
785         r1.h = _new_old_task;
786         [p0+(TASK_THREAD+THREAD_PC)] = r1;
788         /* restore the kernel stack pointer */
789         sp = [p1+(TASK_THREAD+THREAD_KSP)];
791         /* restore user stack pointer */
792         p0 = [p1+(TASK_THREAD+THREAD_USP)];
793         usp = p0;
795         /* restore pc */
796         p0 = [p1+(TASK_THREAD+THREAD_PC)];
797         jump (p0);
799         /*
800          * Following code actually lands up in a new (old) task.
801          */
803 _new_old_task:
804         (r7:4, p5:3) = [sp++];
805         fp = [sp++];
806         rets = [sp++];
808         /*
809          * When we come out of resume, r0 carries "old" task, becuase we are
810          * in "new" task.
811          */
812         rts;
813 ENDPROC(_resume)
815 ENTRY(_ret_from_exception)
816 #ifdef CONFIG_IPIPE
817         p2.l = _ipipe_percpu_domain;
818         p2.h = _ipipe_percpu_domain;
819         r0.l = _ipipe_root;
820         r0.h = _ipipe_root;
821         r2 = [p2];
822         cc = r0 == r2;
823         if !cc jump 4f;  /* not on behalf of the root domain, get out */
824 #endif /* CONFIG_IPIPE */
825         p2.l = lo(IPEND);
826         p2.h = hi(IPEND);
828         csync;
829         r0 = [p2];
830         [sp + PT_IPEND] = r0;
833         r2 = LO(~0x37) (Z);
834         r0 = r2 & r0;
835         cc = r0 == 0;
836         if !cc jump 4f; /* if not return to user mode, get out */
838         /* Make sure any pending system call or deferred exception
839          * return in ILAT for this process to get executed, otherwise
840          * in case context switch happens, system call of
841          * first process (i.e in ILAT) will be carried
842          * forward to the switched process
843          */
845         p2.l = lo(ILAT);
846         p2.h = hi(ILAT);
847         r0 = [p2];
848         r1 = (EVT_IVG14 | EVT_IVG15) (z);
849         r0 = r0 & r1;
850         cc = r0 == 0;
851         if !cc jump 5f;
853         /* Set the stack for the current process */
854         r7 = sp;
855         r4.l = lo(ALIGN_PAGE_MASK);
856         r4.h = hi(ALIGN_PAGE_MASK);
857         r7 = r7 & r4;           /* thread_info->flags */
858         p5 = r7;
859         r7 = [p5 + TI_FLAGS];
860         r4.l = lo(_TIF_WORK_MASK);
861         r4.h = hi(_TIF_WORK_MASK);
862         r7 =  r7 & r4;
863         cc = r7 == 0;
864         if cc jump 4f;
866         p0.l = lo(EVT15);
867         p0.h = hi(EVT15);
868         p1.l = _schedule_and_signal;
869         p1.h = _schedule_and_signal;
870         [p0] = p1;
871         csync;
872         raise 15;               /* raise evt15 to do signal or reschedule */
874         r0 = syscfg;
875         bitclr(r0, SYSCFG_SSSTEP_P);            /* Turn off single step */
876         syscfg = r0;
878         rts;
879 ENDPROC(_ret_from_exception)
881 #ifdef CONFIG_IPIPE
883 _resume_kernel_from_int:
884         r0.l = ___ipipe_sync_root;
885         r0.h = ___ipipe_sync_root;
886         [--sp] = rets;
887         [--sp] = ( r7:4, p5:3 );
888         SP += -12;
889         call ___ipipe_call_irqtail
890         SP += 12;
891         ( r7:4, p5:3 ) = [sp++];
892         rets = [sp++];
893         rts
894 #else
895 #define _resume_kernel_from_int  2f
896 #endif
898 ENTRY(_return_from_int)
899         /* If someone else already raised IRQ 15, do nothing.  */
900         csync;
901         p2.l = lo(ILAT);
902         p2.h = hi(ILAT);
903         r0 = [p2];
904         cc = bittst (r0, EVT_IVG15_P);
905         if cc jump 2f;
907         /* if not return to user mode, get out */
908         p2.l = lo(IPEND);
909         p2.h = hi(IPEND);
910         r0 = [p2];
911         r1 = 0x17(Z);
912         r2 = ~r1;
913         r2.h = 0;
914         r0 = r2 & r0;
915         r1 = 1;
916         r1 = r0 - r1;
917         r2 = r0 & r1;
918         cc = r2 == 0;
919         if !cc jump _resume_kernel_from_int;
921         /* Lower the interrupt level to 15.  */
922         p0.l = lo(EVT15);
923         p0.h = hi(EVT15);
924         p1.l = _schedule_and_signal_from_int;
925         p1.h = _schedule_and_signal_from_int;
926         [p0] = p1;
927         csync;
928 #if ANOMALY_05000281 || ANOMALY_05000461
929         r0.l = lo(SAFE_USER_INSTRUCTION);
930         r0.h = hi(SAFE_USER_INSTRUCTION);
931         reti = r0;
932 #endif
933         r0 = 0x801f (z);
934         STI r0;
935         raise 15;       /* raise evt15 to do signal or reschedule */
936         rti;
938         rts;
939 ENDPROC(_return_from_int)
941 ENTRY(_lower_to_irq14)
942 #if ANOMALY_05000281 || ANOMALY_05000461
943         r0.l = lo(SAFE_USER_INSTRUCTION);
944         r0.h = hi(SAFE_USER_INSTRUCTION);
945         reti = r0;
946 #endif
948 #ifdef CONFIG_DEBUG_HWERR
949         /* enable irq14 & hwerr interrupt, until we transition to _evt_evt14 */
950         r0 = (EVT_IVG14 | EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
951 #else
952         /* Only enable irq14 interrupt, until we transition to _evt_evt14 */
953         r0 = (EVT_IVG14 | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
954 #endif
955         sti r0;
956         raise 14;
957         rti;
958 ENDPROC(_lower_to_irq14)
960 ENTRY(_evt_evt14)
961 #ifdef CONFIG_DEBUG_HWERR
962         r0 = (EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
963         sti r0;
964 #else
965         cli r0;
966 #endif
967 #ifdef CONFIG_TRACE_IRQFLAGS
968         [--sp] = rets;
969         sp += -12;
970         call _trace_hardirqs_off;
971         sp += 12;
972         rets = [sp++];
973 #endif
974         [--sp] = RETI;
975         SP += 4;
976         rts;
977 ENDPROC(_evt_evt14)
979 ENTRY(_schedule_and_signal_from_int)
980         /* To end up here, vector 15 was changed - so we have to change it
981          * back.
982          */
983         p0.l = lo(EVT15);
984         p0.h = hi(EVT15);
985         p1.l = _evt_system_call;
986         p1.h = _evt_system_call;
987         [p0] = p1;
988         csync;
990         /* Set orig_p0 to -1 to indicate this isn't the end of a syscall.  */
991         r0 = -1 (x);
992         [sp + PT_ORIG_P0] = r0;
994         p1 = rets;
995         [sp + PT_RESERVED] = p1;
997 #ifdef CONFIG_TRACE_IRQFLAGS
998         /* trace_hardirqs_on() checks if all irqs are disabled. But here IRQ 15
999          * is turned on, so disable all irqs. */
1000         cli r0;
1001         sp += -12;
1002         call _trace_hardirqs_on;
1003         sp += 12;
1004 #endif
1005 #ifdef CONFIG_SMP
1006         GET_PDA(p0, r0);        /* Fetch current PDA (can't migrate to other CPU here) */
1007         r0 = [p0 + PDA_IRQFLAGS];
1008 #else
1009         p0.l = _bfin_irq_flags;
1010         p0.h = _bfin_irq_flags;
1011         r0 = [p0];
1012 #endif
1013         sti r0;
1015         /* finish the userspace "atomic" functions for it */
1016         r1 = FIXED_CODE_END;
1017         r2 = [sp + PT_PC];
1018         cc = r1 <= r2;
1019         if cc jump .Lresume_userspace (bp);
1021         r0 = sp;
1022         sp += -12;
1024         pseudo_long_call _finish_atomic_sections, p5;
1025         sp += 12;
1026         jump.s .Lresume_userspace;
1027 ENDPROC(_schedule_and_signal_from_int)
1029 ENTRY(_schedule_and_signal)
1030         SAVE_CONTEXT_SYSCALL
1031         /* To end up here, vector 15 was changed - so we have to change it
1032          * back.
1033          */
1034         p0.l = lo(EVT15);
1035         p0.h = hi(EVT15);
1036         p1.l = _evt_system_call;
1037         p1.h = _evt_system_call;
1038         [p0] = p1;
1039         csync;
1040         p0.l = 1f;
1041         p0.h = 1f;
1042         [sp + PT_RESERVED] = P0;
1043         call .Lresume_userspace;
1045         RESTORE_CONTEXT
1046         rti;
1047 ENDPROC(_schedule_and_signal)
1049 /* We handle this 100% in exception space - to reduce overhead
1050  * Only potiential problem is if the software buffer gets swapped out of the
1051  * CPLB table - then double fault. - so we don't let this happen in other places
1052  */
1053 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1054 ENTRY(_ex_trace_buff_full)
1055         [--sp] = P3;
1056         [--sp] = P2;
1057         [--sp] = LC0;
1058         [--sp] = LT0;
1059         [--sp] = LB0;
1060         P5.L = _trace_buff_offset;
1061         P5.H = _trace_buff_offset;
1062         P3 = [P5];              /* trace_buff_offset */
1063         P5.L = lo(TBUFSTAT);
1064         P5.H = hi(TBUFSTAT);
1065         R7 = [P5];
1066         R7 <<= 1;               /* double, since we need to read twice */
1067         LC0 = R7;
1068         R7 <<= 2;               /* need to shift over again,
1069                                  * to get the number of bytes */
1070         P5.L = lo(TBUF);
1071         P5.H = hi(TBUF);
1072         R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;
1074         P2 = R7;
1075         P3 = P3 + P2;
1076         R7 = P3;
1077         R7 = R7 & R6;
1078         P3 = R7;
1079         P2.L = _trace_buff_offset;
1080         P2.H = _trace_buff_offset;
1081         [P2] = P3;
1083         P2.L = _software_trace_buff;
1084         P2.H = _software_trace_buff;
1086         LSETUP (.Lstart, .Lend) LC0;
1087 .Lstart:
1088         R7 = [P5];      /* read TBUF */
1089         P4 = P3 + P2;
1090         [P4] = R7;
1091         P3 += -4;
1092         R7 = P3;
1093         R7 = R7 & R6;
1094 .Lend:
1095         P3 = R7;
1097         LB0 = [sp++];
1098         LT0 = [sp++];
1099         LC0 = [sp++];
1100         P2 = [sp++];
1101         P3 = [sp++];
1102         jump _bfin_return_from_exception;
1103 ENDPROC(_ex_trace_buff_full)
1105 #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
1106 .data
1107 #else
1108 .section .l1.data.B
1109 #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
1110 ENTRY(_trace_buff_offset)
1111         .long 0;
1112 ALIGN
1113 ENTRY(_software_trace_buff)
1114         .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
1115         .long 0
1116         .endr
1117 #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
1119 #if CONFIG_EARLY_PRINTK
1120 __INIT
1121 ENTRY(_early_trap)
1122         SAVE_ALL_SYS
1123         trace_buffer_stop(p0,r0);
1125         ANOMALY_283_315_WORKAROUND(p4, r5)
1127         /* Turn caches off, to ensure we don't get double exceptions */
1129         P4.L = LO(IMEM_CONTROL);
1130         P4.H = HI(IMEM_CONTROL);
1132         R5 = [P4];              /* Control Register*/
1133         BITCLR(R5,ENICPLB_P);
1134         CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
1135         [P4] = R5;
1136         SSYNC;
1138         P4.L = LO(DMEM_CONTROL);
1139         P4.H = HI(DMEM_CONTROL);
1140         R5 = [P4];
1141         BITCLR(R5,ENDCPLB_P);
1142         CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
1143         [P4] = R5;
1144         SSYNC;
1146         r0 = sp;        /* stack frame pt_regs pointer argument ==> r0 */
1147         r1 = RETX;
1149         SP += -12;
1150         call _early_trap_c;
1151         SP += 12;
1152 ENDPROC(_early_trap)
1153 __FINIT
1154 #endif /* CONFIG_EARLY_PRINTK */
1157  * Put these in the kernel data section - that should always be covered by
1158  * a CPLB. This is needed to ensure we don't get double fault conditions
1159  */
1161 #ifdef CONFIG_SYSCALL_TAB_L1
1162 .section .l1.data
1163 #else
1164 .data
1165 #endif
1167 ENTRY(_ex_table)
1168         /* entry for each EXCAUSE[5:0]
1169          * This table must be in sync with the table in ./kernel/traps.c
1170          * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
1171          */
1172         .long _ex_syscall       /* 0x00 - User Defined - Linux Syscall */
1173         .long _ex_trap_c        /* 0x01 - User Defined - Software breakpoint */
1174 #ifdef  CONFIG_KGDB
1175         .long _ex_trap_c        /* 0x02 - User Defined - KGDB initial connection
1176                                                          and break signal trap */
1177 #else
1178         .long _ex_replaceable   /* 0x02 - User Defined */
1179 #endif
1180         .long _ex_trap_c        /* 0x03 - User Defined - userspace stack overflow */
1181         .long _ex_trap_c        /* 0x04 - User Defined - dump trace buffer */
1182         .long _ex_replaceable   /* 0x05 - User Defined */
1183         .long _ex_replaceable   /* 0x06 - User Defined */
1184         .long _ex_replaceable   /* 0x07 - User Defined */
1185         .long _ex_replaceable   /* 0x08 - User Defined */
1186         .long _ex_replaceable   /* 0x09 - User Defined */
1187         .long _ex_replaceable   /* 0x0A - User Defined */
1188         .long _ex_replaceable   /* 0x0B - User Defined */
1189         .long _ex_replaceable   /* 0x0C - User Defined */
1190         .long _ex_replaceable   /* 0x0D - User Defined */
1191         .long _ex_replaceable   /* 0x0E - User Defined */
1192         .long _ex_replaceable   /* 0x0F - User Defined */
1193         .long _ex_single_step   /* 0x10 - HW Single step */
1194 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1195         .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
1196 #else
1197         .long _ex_trap_c        /* 0x11 - Trace Buffer Full */
1198 #endif
1199         .long _ex_trap_c        /* 0x12 - Reserved */
1200         .long _ex_trap_c        /* 0x13 - Reserved */
1201         .long _ex_trap_c        /* 0x14 - Reserved */
1202         .long _ex_trap_c        /* 0x15 - Reserved */
1203         .long _ex_trap_c        /* 0x16 - Reserved */
1204         .long _ex_trap_c        /* 0x17 - Reserved */
1205         .long _ex_trap_c        /* 0x18 - Reserved */
1206         .long _ex_trap_c        /* 0x19 - Reserved */
1207         .long _ex_trap_c        /* 0x1A - Reserved */
1208         .long _ex_trap_c        /* 0x1B - Reserved */
1209         .long _ex_trap_c        /* 0x1C - Reserved */
1210         .long _ex_trap_c        /* 0x1D - Reserved */
1211         .long _ex_trap_c        /* 0x1E - Reserved */
1212         .long _ex_trap_c        /* 0x1F - Reserved */
1213         .long _ex_trap_c        /* 0x20 - Reserved */
1214         .long _ex_trap_c        /* 0x21 - Undefined Instruction */
1215         .long _ex_trap_c        /* 0x22 - Illegal Instruction Combination */
1216         .long _ex_dviol         /* 0x23 - Data CPLB Protection Violation */
1217         .long _ex_trap_c        /* 0x24 - Data access misaligned */
1218         .long _ex_trap_c        /* 0x25 - Unrecoverable Event */
1219         .long _ex_dmiss         /* 0x26 - Data CPLB Miss */
1220         .long _ex_dmult         /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
1221         .long _ex_trap_c        /* 0x28 - Emulation Watchpoint */
1222         .long _ex_trap_c        /* 0x29 - Instruction fetch access error (535 only) */
1223         .long _ex_trap_c        /* 0x2A - Instruction fetch misaligned */
1224         .long _ex_trap_c        /* 0x2B - Instruction CPLB protection Violation */
1225         .long _ex_icplb_miss    /* 0x2C - Instruction CPLB miss */
1226         .long _ex_trap_c        /* 0x2D - Instruction CPLB Multiple Hits */
1227         .long _ex_trap_c        /* 0x2E - Illegal use of Supervisor Resource */
1228         .long _ex_trap_c        /* 0x2E - Illegal use of Supervisor Resource */
1229         .long _ex_trap_c        /* 0x2F - Reserved */
1230         .long _ex_trap_c        /* 0x30 - Reserved */
1231         .long _ex_trap_c        /* 0x31 - Reserved */
1232         .long _ex_trap_c        /* 0x32 - Reserved */
1233         .long _ex_trap_c        /* 0x33 - Reserved */
1234         .long _ex_trap_c        /* 0x34 - Reserved */
1235         .long _ex_trap_c        /* 0x35 - Reserved */
1236         .long _ex_trap_c        /* 0x36 - Reserved */
1237         .long _ex_trap_c        /* 0x37 - Reserved */
1238         .long _ex_trap_c        /* 0x38 - Reserved */
1239         .long _ex_trap_c        /* 0x39 - Reserved */
1240         .long _ex_trap_c        /* 0x3A - Reserved */
1241         .long _ex_trap_c        /* 0x3B - Reserved */
1242         .long _ex_trap_c        /* 0x3C - Reserved */
1243         .long _ex_trap_c        /* 0x3D - Reserved */
1244         .long _ex_trap_c        /* 0x3E - Reserved */
1245         .long _ex_trap_c        /* 0x3F - Reserved */
1246 END(_ex_table)
1248 ENTRY(_sys_call_table)
1249         .long _sys_restart_syscall      /* 0 */
1250         .long _sys_exit
1251         .long _sys_fork
1252         .long _sys_read
1253         .long _sys_write
1254         .long _sys_open         /* 5 */
1255         .long _sys_close
1256         .long _sys_ni_syscall   /* old waitpid */
1257         .long _sys_creat
1258         .long _sys_link
1259         .long _sys_unlink       /* 10 */
1260         .long _sys_execve
1261         .long _sys_chdir
1262         .long _sys_time
1263         .long _sys_mknod
1264         .long _sys_chmod                /* 15 */
1265         .long _sys_chown        /* chown16 */
1266         .long _sys_ni_syscall   /* old break syscall holder */
1267         .long _sys_ni_syscall   /* old stat */
1268         .long _sys_lseek
1269         .long _sys_getpid       /* 20 */
1270         .long _sys_mount
1271         .long _sys_ni_syscall   /* old umount */
1272         .long _sys_setuid
1273         .long _sys_getuid
1274         .long _sys_stime                /* 25 */
1275         .long _sys_ptrace
1276         .long _sys_alarm
1277         .long _sys_ni_syscall   /* old fstat */
1278         .long _sys_pause
1279         .long _sys_ni_syscall   /* old utime */ /* 30 */
1280         .long _sys_ni_syscall   /* old stty syscall holder */
1281         .long _sys_ni_syscall   /* old gtty syscall holder */
1282         .long _sys_access
1283         .long _sys_nice
1284         .long _sys_ni_syscall   /* 35 */ /* old ftime syscall holder */
1285         .long _sys_sync
1286         .long _sys_kill
1287         .long _sys_rename
1288         .long _sys_mkdir
1289         .long _sys_rmdir                /* 40 */
1290         .long _sys_dup
1291         .long _sys_pipe
1292         .long _sys_times
1293         .long _sys_ni_syscall   /* old prof syscall holder */
1294         .long _sys_brk          /* 45 */
1295         .long _sys_setgid
1296         .long _sys_getgid
1297         .long _sys_ni_syscall   /* old sys_signal */
1298         .long _sys_geteuid      /* geteuid16 */
1299         .long _sys_getegid      /* getegid16 */ /* 50 */
1300         .long _sys_acct
1301         .long _sys_umount       /* recycled never used phys() */
1302         .long _sys_ni_syscall   /* old lock syscall holder */
1303         .long _sys_ioctl
1304         .long _sys_fcntl                /* 55 */
1305         .long _sys_ni_syscall   /* old mpx syscall holder */
1306         .long _sys_setpgid
1307         .long _sys_ni_syscall   /* old ulimit syscall holder */
1308         .long _sys_ni_syscall   /* old old uname */
1309         .long _sys_umask                /* 60 */
1310         .long _sys_chroot
1311         .long _sys_ustat
1312         .long _sys_dup2
1313         .long _sys_getppid
1314         .long _sys_getpgrp      /* 65 */
1315         .long _sys_setsid
1316         .long _sys_ni_syscall   /* old sys_sigaction */
1317         .long _sys_sgetmask
1318         .long _sys_ssetmask
1319         .long _sys_setreuid     /* setreuid16 */        /* 70 */
1320         .long _sys_setregid     /* setregid16 */
1321         .long _sys_ni_syscall   /* old sys_sigsuspend */
1322         .long _sys_ni_syscall   /* old sys_sigpending */
1323         .long _sys_sethostname
1324         .long _sys_setrlimit    /* 75 */
1325         .long _sys_ni_syscall   /* old getrlimit */
1326         .long _sys_getrusage
1327         .long _sys_gettimeofday
1328         .long _sys_settimeofday
1329         .long _sys_getgroups    /* getgroups16 */       /* 80 */
1330         .long _sys_setgroups    /* setgroups16 */
1331         .long _sys_ni_syscall   /* old_select */
1332         .long _sys_symlink
1333         .long _sys_ni_syscall   /* old lstat */
1334         .long _sys_readlink     /* 85 */
1335         .long _sys_uselib
1336         .long _sys_ni_syscall   /* sys_swapon */
1337         .long _sys_reboot
1338         .long _sys_ni_syscall   /* old_readdir */
1339         .long _sys_ni_syscall   /* sys_mmap */  /* 90 */
1340         .long _sys_munmap
1341         .long _sys_truncate
1342         .long _sys_ftruncate
1343         .long _sys_fchmod
1344         .long _sys_fchown       /* fchown16 */  /* 95 */
1345         .long _sys_getpriority
1346         .long _sys_setpriority
1347         .long _sys_ni_syscall   /* old profil syscall holder */
1348         .long _sys_statfs
1349         .long _sys_fstatfs      /* 100 */
1350         .long _sys_ni_syscall
1351         .long _sys_ni_syscall   /* old sys_socketcall */
1352         .long _sys_syslog
1353         .long _sys_setitimer
1354         .long _sys_getitimer    /* 105 */
1355         .long _sys_newstat
1356         .long _sys_newlstat
1357         .long _sys_newfstat
1358         .long _sys_ni_syscall   /* old uname */
1359         .long _sys_ni_syscall   /* iopl for i386 */ /* 110 */
1360         .long _sys_vhangup
1361         .long _sys_ni_syscall   /* obsolete idle() syscall */
1362         .long _sys_ni_syscall   /* vm86old for i386 */
1363         .long _sys_wait4
1364         .long _sys_ni_syscall   /* 115 */ /* sys_swapoff */
1365         .long _sys_sysinfo
1366         .long _sys_ni_syscall   /* old sys_ipc */
1367         .long _sys_fsync
1368         .long _sys_ni_syscall   /* old sys_sigreturn */
1369         .long _sys_clone                /* 120 */
1370         .long _sys_setdomainname
1371         .long _sys_newuname
1372         .long _sys_ni_syscall   /* old sys_modify_ldt */
1373         .long _sys_adjtimex
1374         .long _sys_mprotect     /* 125 */
1375         .long _sys_ni_syscall   /* old sys_sigprocmask */
1376         .long _sys_ni_syscall   /* old "creat_module" */
1377         .long _sys_init_module
1378         .long _sys_delete_module
1379         .long _sys_ni_syscall   /* 130: old "get_kernel_syms" */
1380         .long _sys_quotactl
1381         .long _sys_getpgid
1382         .long _sys_fchdir
1383         .long _sys_bdflush
1384         .long _sys_ni_syscall   /* 135 */ /* sys_sysfs */
1385         .long _sys_personality
1386         .long _sys_ni_syscall   /* for afs_syscall */
1387         .long _sys_setfsuid     /* setfsuid16 */
1388         .long _sys_setfsgid     /* setfsgid16 */
1389         .long _sys_llseek       /* 140 */
1390         .long _sys_getdents
1391         .long _sys_ni_syscall   /* sys_select */
1392         .long _sys_flock
1393         .long _sys_msync
1394         .long _sys_readv                /* 145 */
1395         .long _sys_writev
1396         .long _sys_getsid
1397         .long _sys_fdatasync
1398         .long _sys_sysctl
1399         .long _sys_mlock        /* 150 */
1400         .long _sys_munlock
1401         .long _sys_mlockall
1402         .long _sys_munlockall
1403         .long _sys_sched_setparam
1404         .long _sys_sched_getparam /* 155 */
1405         .long _sys_sched_setscheduler
1406         .long _sys_sched_getscheduler
1407         .long _sys_sched_yield
1408         .long _sys_sched_get_priority_max
1409         .long _sys_sched_get_priority_min  /* 160 */
1410         .long _sys_sched_rr_get_interval
1411         .long _sys_nanosleep
1412         .long _sys_mremap
1413         .long _sys_setresuid    /* setresuid16 */
1414         .long _sys_getresuid    /* getresuid16 */       /* 165 */
1415         .long _sys_ni_syscall   /* for vm86 */
1416         .long _sys_ni_syscall   /* old "query_module" */
1417         .long _sys_ni_syscall   /* sys_poll */
1418         .long _sys_nfsservctl
1419         .long _sys_setresgid    /* setresgid16 */       /* 170 */
1420         .long _sys_getresgid    /* getresgid16 */
1421         .long _sys_prctl
1422         .long _sys_rt_sigreturn
1423         .long _sys_rt_sigaction
1424         .long _sys_rt_sigprocmask /* 175 */
1425         .long _sys_rt_sigpending
1426         .long _sys_rt_sigtimedwait
1427         .long _sys_rt_sigqueueinfo
1428         .long _sys_rt_sigsuspend
1429         .long _sys_pread64      /* 180 */
1430         .long _sys_pwrite64
1431         .long _sys_lchown       /* lchown16 */
1432         .long _sys_getcwd
1433         .long _sys_capget
1434         .long _sys_capset       /* 185 */
1435         .long _sys_sigaltstack
1436         .long _sys_sendfile
1437         .long _sys_ni_syscall   /* streams1 */
1438         .long _sys_ni_syscall   /* streams2 */
1439         .long _sys_vfork                /* 190 */
1440         .long _sys_getrlimit
1441         .long _sys_mmap_pgoff
1442         .long _sys_truncate64
1443         .long _sys_ftruncate64
1444         .long _sys_stat64       /* 195 */
1445         .long _sys_lstat64
1446         .long _sys_fstat64
1447         .long _sys_chown
1448         .long _sys_getuid
1449         .long _sys_getgid       /* 200 */
1450         .long _sys_geteuid
1451         .long _sys_getegid
1452         .long _sys_setreuid
1453         .long _sys_setregid
1454         .long _sys_getgroups    /* 205 */
1455         .long _sys_setgroups
1456         .long _sys_fchown
1457         .long _sys_setresuid
1458         .long _sys_getresuid
1459         .long _sys_setresgid    /* 210 */
1460         .long _sys_getresgid
1461         .long _sys_lchown
1462         .long _sys_setuid
1463         .long _sys_setgid
1464         .long _sys_setfsuid     /* 215 */
1465         .long _sys_setfsgid
1466         .long _sys_pivot_root
1467         .long _sys_mincore
1468         .long _sys_madvise
1469         .long _sys_getdents64   /* 220 */
1470         .long _sys_fcntl64
1471         .long _sys_ni_syscall   /* reserved for TUX */
1472         .long _sys_ni_syscall
1473         .long _sys_gettid
1474         .long _sys_readahead    /* 225 */
1475         .long _sys_setxattr
1476         .long _sys_lsetxattr
1477         .long _sys_fsetxattr
1478         .long _sys_getxattr
1479         .long _sys_lgetxattr    /* 230 */
1480         .long _sys_fgetxattr
1481         .long _sys_listxattr
1482         .long _sys_llistxattr
1483         .long _sys_flistxattr
1484         .long _sys_removexattr  /* 235 */
1485         .long _sys_lremovexattr
1486         .long _sys_fremovexattr
1487         .long _sys_tkill
1488         .long _sys_sendfile64
1489         .long _sys_futex                /* 240 */
1490         .long _sys_sched_setaffinity
1491         .long _sys_sched_getaffinity
1492         .long _sys_ni_syscall   /* sys_set_thread_area */
1493         .long _sys_ni_syscall   /* sys_get_thread_area */
1494         .long _sys_io_setup     /* 245 */
1495         .long _sys_io_destroy
1496         .long _sys_io_getevents
1497         .long _sys_io_submit
1498         .long _sys_io_cancel
1499         .long _sys_ni_syscall   /* 250 */ /* sys_alloc_hugepages */
1500         .long _sys_ni_syscall   /* sys_freec_hugepages */
1501         .long _sys_exit_group
1502         .long _sys_lookup_dcookie
1503         .long _sys_bfin_spinlock
1504         .long _sys_epoll_create /* 255 */
1505         .long _sys_epoll_ctl
1506         .long _sys_epoll_wait
1507         .long _sys_ni_syscall /* remap_file_pages */
1508         .long _sys_set_tid_address
1509         .long _sys_timer_create /* 260 */
1510         .long _sys_timer_settime
1511         .long _sys_timer_gettime
1512         .long _sys_timer_getoverrun
1513         .long _sys_timer_delete
1514         .long _sys_clock_settime /* 265 */
1515         .long _sys_clock_gettime
1516         .long _sys_clock_getres
1517         .long _sys_clock_nanosleep
1518         .long _sys_statfs64
1519         .long _sys_fstatfs64    /* 270 */
1520         .long _sys_tgkill
1521         .long _sys_utimes
1522         .long _sys_fadvise64_64
1523         .long _sys_ni_syscall /* vserver */
1524         .long _sys_mbind        /* 275 */
1525         .long _sys_ni_syscall /* get_mempolicy */
1526         .long _sys_ni_syscall /* set_mempolicy */
1527         .long _sys_mq_open
1528         .long _sys_mq_unlink
1529         .long _sys_mq_timedsend /* 280 */
1530         .long _sys_mq_timedreceive
1531         .long _sys_mq_notify
1532         .long _sys_mq_getsetattr
1533         .long _sys_ni_syscall /* kexec_load */
1534         .long _sys_waitid       /* 285 */
1535         .long _sys_add_key
1536         .long _sys_request_key
1537         .long _sys_keyctl
1538         .long _sys_ioprio_set
1539         .long _sys_ioprio_get   /* 290 */
1540         .long _sys_inotify_init
1541         .long _sys_inotify_add_watch
1542         .long _sys_inotify_rm_watch
1543         .long _sys_ni_syscall /* migrate_pages */
1544         .long _sys_openat       /* 295 */
1545         .long _sys_mkdirat
1546         .long _sys_mknodat
1547         .long _sys_fchownat
1548         .long _sys_futimesat
1549         .long _sys_fstatat64    /* 300 */
1550         .long _sys_unlinkat
1551         .long _sys_renameat
1552         .long _sys_linkat
1553         .long _sys_symlinkat
1554         .long _sys_readlinkat   /* 305 */
1555         .long _sys_fchmodat
1556         .long _sys_faccessat
1557         .long _sys_pselect6
1558         .long _sys_ppoll
1559         .long _sys_unshare      /* 310 */
1560         .long _sys_sram_alloc
1561         .long _sys_sram_free
1562         .long _sys_dma_memcpy
1563         .long _sys_accept
1564         .long _sys_bind         /* 315 */
1565         .long _sys_connect
1566         .long _sys_getpeername
1567         .long _sys_getsockname
1568         .long _sys_getsockopt
1569         .long _sys_listen       /* 320 */
1570         .long _sys_recv
1571         .long _sys_recvfrom
1572         .long _sys_recvmsg
1573         .long _sys_send
1574         .long _sys_sendmsg      /* 325 */
1575         .long _sys_sendto
1576         .long _sys_setsockopt
1577         .long _sys_shutdown
1578         .long _sys_socket
1579         .long _sys_socketpair   /* 330 */
1580         .long _sys_semctl
1581         .long _sys_semget
1582         .long _sys_semop
1583         .long _sys_msgctl
1584         .long _sys_msgget       /* 335 */
1585         .long _sys_msgrcv
1586         .long _sys_msgsnd
1587         .long _sys_shmat
1588         .long _sys_shmctl
1589         .long _sys_shmdt        /* 340 */
1590         .long _sys_shmget
1591         .long _sys_splice
1592         .long _sys_sync_file_range
1593         .long _sys_tee
1594         .long _sys_vmsplice     /* 345 */
1595         .long _sys_epoll_pwait
1596         .long _sys_utimensat
1597         .long _sys_signalfd
1598         .long _sys_timerfd_create
1599         .long _sys_eventfd      /* 350 */
1600         .long _sys_pread64
1601         .long _sys_pwrite64
1602         .long _sys_fadvise64
1603         .long _sys_set_robust_list
1604         .long _sys_get_robust_list      /* 355 */
1605         .long _sys_fallocate
1606         .long _sys_semtimedop
1607         .long _sys_timerfd_settime
1608         .long _sys_timerfd_gettime
1609         .long _sys_signalfd4            /* 360 */
1610         .long _sys_eventfd2
1611         .long _sys_epoll_create1
1612         .long _sys_dup3
1613         .long _sys_pipe2
1614         .long _sys_inotify_init1        /* 365 */
1615         .long _sys_preadv
1616         .long _sys_pwritev
1617         .long _sys_rt_tgsigqueueinfo
1618         .long _sys_perf_event_open
1619         .long _sys_recvmmsg             /* 370 */
1620         .long _sys_fanotify_init
1621         .long _sys_fanotify_mark
1622         .long _sys_prlimit64
1624         .rept NR_syscalls-(.-_sys_call_table)/4
1625         .long _sys_ni_syscall
1626         .endr
1627 END(_sys_call_table)