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