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.
6 * Copyright 2005-2009 Analog Devices Inc.
8 * Licensed under the GPL-2 or later.
11 /* NOTE: This code handles signal-recognition, which happens every time
12 * after a timer-interrupt and after each system call.
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
33 # define EX_SCRATCH_REG CYCLES
36 #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
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.
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)
53 * Work around an anomaly: if we see a new DCPLB fault, return
54 * without doing anything. Then, if we get the same fault again,
57 P4 = R7; /* Store EXCAUSE */
60 r7 = [p5 + PDA_LFRETX];
62 [p5 + PDA_LFRETX] = r6;
64 if !cc jump _bfin_return_from_exception;
67 R6 = VEC_CPLB_M; /* Data CPLB Miss */
69 if cc jump _ex_dcplb_miss (BP);
71 R6 = VEC_CPLB_VL; /* Data CPLB Violation */
73 if cc jump _ex_dcplb_viol (BP);
75 /* Handle Data CPLB Protection Violation
76 * and Data CPLB Multiple Hits - Linux Trap Zero
79 ENDPROC(_ex_workaround_261)
83 #define _ex_dviol _ex_dcplb_viol
85 #define _ex_dviol _ex_trap_c
87 #define _ex_dmiss _ex_dcplb_miss
88 #define _ex_dmult _ex_trap_c
96 /* We leave the previously pushed ASTAT on the stack. */
99 /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
100 * will change the stack pointer. */
104 DEBUG_HWTRACE_SAVE(p5, r7)
110 IF !CC JUMP _handle_bad_cplb;
112 #ifdef CONFIG_DEBUG_DOUBLEFAULT
113 /* While we were processing this, did we double fault? */
114 r7 = SEQSTAT; /* reason code is in bit 5:0 */
115 r6.l = lo(SEQSTAT_EXCAUSE);
116 r6.h = hi(SEQSTAT_EXCAUSE);
120 if CC JUMP _double_fault;
123 DEBUG_HWTRACE_RESTORE(p5, r7)
128 ENDPROC(_ex_icplb_miss)
131 raise 15; /* invoked by TRAP #0, for sys call */
132 jump.s _bfin_return_from_exception;
135 ENTRY(_ex_single_step)
136 /* If we just returned from an interrupt, the single step event is
137 for the RTI instruction. */
141 if cc jump _bfin_return_from_exception;
144 /* Don't do single step in hardware exception handler */
149 if cc jump _bfin_return_from_exception;
151 if cc jump _bfin_return_from_exception;
153 /* skip single step if current interrupt priority is higher than
154 * that of the first instruction, from which gdb starts single step */
157 .Lfind_priority_start:
159 if cc jump .Lfind_priority_done;
163 if cc jump .Lfind_priority_done;
164 jump.s .Lfind_priority_start;
165 .Lfind_priority_done:
166 p4.l = _kgdb_single_step;
167 p4.h = _kgdb_single_step;
170 if cc jump .Ldo_single_step;
176 /* If we were in user mode, do the single step normally. */
185 #ifdef CONFIG_EXACT_HWERR
186 /* Read the ILAT, and to check to see if the process we are
187 * single stepping caused a previous hardware error
188 * If so, do not single step, (which lowers to IRQ5, and makes
189 * us miss the error).
194 cc = bittst(r7, EVT_IVHW_P);
197 /* Single stepping only a single instruction, so clear the trace
200 bitclr (r7, SYSCFG_SSSTEP_P);
206 * We were in an interrupt handler. By convention, all of them save
207 * SYSCFG with their first instruction, so by checking whether our
208 * RETX points at the entry point, we can determine whether to allow
209 * a single step, or whether to clear SYSCFG.
211 * First, find out the interrupt level and the event vector for it.
221 /* What we actually do is test for the _second_ instruction in the
222 * IRQ handler. That way, if there are insns following the restore
223 * of SYSCFG after leaving the handler, we will not turn off SYSCFG
230 if !cc jump _bfin_return_from_exception;
233 bitclr (r7, SYSCFG_SSSTEP_P); /* Turn off single step */
236 /* Fall through to _bfin_return_from_exception. */
237 ENDPROC(_ex_single_step)
239 ENTRY(_bfin_return_from_exception)
247 #ifdef CONFIG_DEBUG_DOUBLEFAULT
248 /* While we were processing the current exception,
249 * did we cause another, and double fault?
251 r7 = SEQSTAT; /* reason code is in bit 5:0 */
252 r6.l = lo(SEQSTAT_EXCAUSE);
253 r6.h = hi(SEQSTAT_EXCAUSE);
257 if CC JUMP _double_fault;
260 (R7:6,P5:4) = [sp++];
264 ENDPROC(_bfin_return_from_exception)
266 ENTRY(_handle_bad_cplb)
267 DEBUG_HWTRACE_RESTORE(p5, r7)
268 /* To get here, we just tried and failed to change a CPLB
269 * so, handle things in trap_c (C code), by lowering to
270 * IRQ5, just like we normally do. Since this is not a
271 * "normal" return path, we have a do alot of stuff to
272 * the stack to get ready so, we can fall through - we
273 * need to make a CPLB exception look like a normal exception
276 /* ASTAT is still on the stack, where it is needed. */
277 [--sp] = (R7:6,P5:4);
279 ENTRY(_ex_replaceable)
283 /* The only thing that has been saved in this context is
284 * (R7:6,P5:4), ASTAT & SP - don't use anything else
289 /* Make sure we are not in a double fault */
294 if CC jump _double_fault;
295 [p5 + PDA_EXIPEND] = r7;
297 /* Call C code (trap_c) to handle the exception, which most
298 * likely involves sending a signal to the current process.
299 * To avoid double faults, lower our priority to IRQ5 first.
301 r7.h = _exception_to_level5;
302 r7.l = _exception_to_level5;
309 * Save these registers, as they are only valid in exception context
310 * (where we are now - as soon as we defer to IRQ5, they can change)
311 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
312 * but they are not very interesting, so don't save them
315 p4.l = lo(DCPLB_FAULT_ADDR);
316 p4.h = hi(DCPLB_FAULT_ADDR);
318 [p5 + PDA_DCPLB] = r7;
320 p4.l = lo(ICPLB_FAULT_ADDR);
321 p4.h = hi(ICPLB_FAULT_ADDR);
323 [p5 + PDA_ICPLB] = r6;
326 [p5 + PDA_RETX] = r6;
329 [p5 + PDA_SEQSTAT] = r6;
331 /* Save the state of single stepping */
333 [p5 + PDA_SYSCFG] = r6;
334 /* Clear it while we handle the exception in IRQ5 mode */
335 BITCLR(r6, SYSCFG_SSSTEP_P);
338 /* Save the current IMASK, since we change in order to jump to level 5 */
340 [p5 + PDA_EXIMASK] = r6;
342 p4.l = lo(SAFE_USER_INSTRUCTION);
343 p4.h = hi(SAFE_USER_INSTRUCTION);
346 /* Disable all interrupts, but make sure level 5 is enabled so
347 * we can switch to that level.
352 /* In case interrupts are disabled IPEND[4] (global interrupt disable bit)
353 * clear it (re-enabling interrupts again) by the special sequence of pushing
354 * RETI onto the stack. This way we can lower ourselves to IVG5 even if the
355 * exception was taken after the interrupt handler was called but before it
356 * got a chance to enable global interrupts itself.
362 jump.s _bfin_return_from_exception;
365 /* We just realized we got an exception, while we were processing a different
366 * exception. This is a unrecoverable event, so crash.
367 * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
370 /* Turn caches & protection off, to ensure we don't get any more
374 P4.L = LO(IMEM_CONTROL);
375 P4.H = HI(IMEM_CONTROL);
377 R5 = [P4]; /* Control Register*/
378 BITCLR(R5,ENICPLB_P);
379 CSYNC; /* Disabling of CPLBs should be proceeded by a CSYNC */
383 P4.L = LO(DMEM_CONTROL);
384 P4.H = HI(DMEM_CONTROL);
386 BITCLR(R5,ENDCPLB_P);
387 CSYNC; /* Disabling of CPLBs should be proceeded by a CSYNC */
391 /* Fix up the stack */
392 (R7:6,P5:4) = [sp++];
396 /* We should be out of the exception stack, and back down into
397 * kernel or user space stack
401 /* The dumping functions expect the return address in the RETI
406 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
408 call _double_fault_c;
410 .L_double_fault_panic:
411 JUMP .L_double_fault_panic
413 ENDPROC(_double_fault)
415 ENTRY(_exception_to_level5)
418 GET_PDA(p5, r7); /* Fetch current PDA */
419 r6 = [p5 + PDA_RETX];
422 r6 = [p5 + PDA_SYSCFG];
423 [sp + PT_SYSCFG] = r6;
425 r6 = [p5 + PDA_SEQSTAT]; /* Read back seqstat */
426 [sp + PT_SEQSTAT] = r6;
428 /* Restore the hardware error vector. */
436 #ifdef CONFIG_DEBUG_DOUBLEFAULT
437 /* Now that we have the hardware error vector programmed properly
438 * we can re-enable interrupts (IPEND[4]), so if the _trap_c causes
439 * another hardware error, we can catch it (self-nesting).
445 r7 = [p5 + PDA_EXIPEND] /* Read the IPEND from the Exception state */
446 [sp + PT_IPEND] = r7; /* Store IPEND onto the stack */
448 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
453 /* If interrupts were off during the exception (IPEND[4] = 1), turn them off
456 CC = BITTST(r7, EVT_IRPTEN_P)
458 /* this will load a random value into the reti register - but that is OK,
459 * since we do restore it to the correct value in the 'RESTORE_ALL_SYS' macro
464 /* restore the interrupt mask (IMASK) */
465 r6 = [p5 + PDA_EXIMASK];
468 call _ret_from_exception;
471 ENDPROC(_exception_to_level5)
473 ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
474 /* Since the kernel stack can be anywhere, it's not guaranteed to be
475 * covered by a CPLB. Switch to an exception stack; use RETN as a
476 * scratch register (for want of a better option).
480 sp = [sp + PDA_EXSTACK];
481 /* Try to deal with syscalls quickly. */
483 [--sp] = (R7:6,P5:4);
485 #ifdef CONFIG_EXACT_HWERR
486 /* Make sure all pending read/writes complete. This will ensure any
487 * accesses which could cause hardware errors completes, and signal
488 * the the hardware before we do something silly, like crash the
489 * kernel. We don't need to work around anomaly 05000312, since
490 * we are already atomic
495 ANOMALY_283_315_WORKAROUND(p5, r7)
497 #ifdef CONFIG_DEBUG_DOUBLEFAULT
499 * Save these registers, as they are only valid in exception context
500 * (where we are now - as soon as we defer to IRQ5, they can change)
501 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
502 * but they are not very interesting, so don't save them
506 p4.l = lo(DCPLB_FAULT_ADDR);
507 p4.h = hi(DCPLB_FAULT_ADDR);
509 [p5 + PDA_DF_DCPLB] = r7;
511 p4.l = lo(ICPLB_FAULT_ADDR);
512 p4.h = hi(ICPLB_FAULT_ADDR);
514 [p5 + PDA_DF_ICPLB] = r7;
517 [p5 + PDA_DF_RETX] = r7;
519 r7 = SEQSTAT; /* reason code is in bit 5:0 */
520 [p5 + PDA_DF_SEQSTAT] = r7;
522 r7 = SEQSTAT; /* reason code is in bit 5:0 */
524 r6.l = lo(SEQSTAT_EXCAUSE);
525 r6.h = hi(SEQSTAT_EXCAUSE);
535 r7 = -ENOSYS; /* signextending enough */
536 [sp + PT_R0] = r7; /* return value from system call */
537 jump .Lsyscall_really_exit;
540 ENTRY(_kernel_execve)
543 r3 = SIZEOF_PTREGS / 4;
549 if !cc jump .Lclear_regs (bp);
557 if ! cc jump .Lexecve_failed;
558 /* Success. Copy our temporary pt_regs to the top of the kernel
559 * stack and do a normal exception return.
562 r0 = (-KERNEL_STACK_SIZE) (x);
566 r0 = KERNEL_STACK_SIZE - 4 (z);
572 r3 = SIZEOF_PTREGS / 4;
578 if ! cc jump .Lcopy_regs (bp);
580 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
585 [SP + PT_SYSCFG] = r0;
586 [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
593 ENDPROC(_kernel_execve)
601 [sp + PT_IPEND] = r0;
603 /* Store RETS for now */
605 [sp + PT_RESERVED] = r0;
606 /* Set the stack for the current process */
608 r6.l = lo(ALIGN_PAGE_MASK);
609 r6.h = hi(ALIGN_PAGE_MASK);
610 r7 = r7 & r6; /* thread_info */
614 [p2+(TASK_THREAD+THREAD_KSP)] = sp;
618 call ___ipipe_syscall_root;
621 if cc jump .Lsyscall_really_exit;
623 if cc jump .Lresume_userspace;
626 p0 = [sp + PT_ORIG_P0];
627 #endif /* CONFIG_IPIPE */
629 /* Check the System Call */
631 /* System call number is passed in P0 */
634 if ! cc jump .Lbadsys;
636 /* are we tracing syscalls?*/
638 r6.l = lo(ALIGN_PAGE_MASK);
639 r6.h = hi(ALIGN_PAGE_MASK);
643 CC = BITTST(r7,TIF_SYSCALL_TRACE);
644 if CC JUMP _sys_trace;
646 /* Execute the appropriate system call */
649 p5.l = _sys_call_table;
650 p5.h = _sys_call_table;
667 r4.l = lo(ALIGN_PAGE_MASK);
668 r4.h = hi(ALIGN_PAGE_MASK);
669 r7 = r7 & r4; /* thread_info->flags */
671 .Lresume_userspace_1:
672 /* Disable interrupts. */
676 r7 = [p5 + TI_FLAGS];
677 r4.l = lo(_TIF_WORK_MASK);
678 r4.h = hi(_TIF_WORK_MASK);
683 cc = BITTST(r7, TIF_IRQ_SYNC);
684 if !cc jump .Lsyscall_no_irqsync;
686 * Clear IPEND[4] manually to undo what resume_userspace_1 just did;
687 * we need this so that high priority domain interrupts may still
688 * preempt the current domain while the pipeline log is being played
692 SP += 4; /* don't merge with next insn to keep the pattern obvious */
694 call ___ipipe_sync_root;
696 jump .Lresume_userspace_1;
697 .Lsyscall_no_irqsync:
699 cc = BITTST(r7, TIF_NEED_RESCHED);
700 if !cc jump .Lsyscall_sigpending;
702 /* Reenable interrupts. */
710 jump .Lresume_userspace_1;
712 .Lsyscall_sigpending:
713 cc = BITTST(r7, TIF_RESTORE_SIGMASK);
714 if cc jump .Lsyscall_do_signals;
715 cc = BITTST(r7, TIF_SIGPENDING);
716 if !cc jump .Lsyscall_really_exit;
717 .Lsyscall_do_signals:
718 /* Reenable interrupts. */
727 .Lsyscall_really_exit:
728 r5 = [sp + PT_RESERVED];
731 ENDPROC(_system_call)
733 /* Do not mark as ENTRY() to avoid error in assembler ...
734 * this symbol need not be global anyways, so ...
739 /* Execute the appropriate system call */
742 p5.l = _sys_call_table;
743 p5.h = _sys_call_table;
762 jump .Lresume_userspace;
767 * Beware - when entering resume, prev (the current task) is
768 * in r0, next (the new task) is in r1.
774 [--sp] = (r7:4, p5:3);
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)];
796 p0 = [p1+(TASK_THREAD+THREAD_PC)];
800 * Following code actually lands up in a new (old) task.
804 (r7:4, p5:3) = [sp++];
809 * When we come out of resume, r0 carries "old" task, becuase we are
815 ENTRY(_ret_from_exception)
817 p2.l = _per_cpu__ipipe_percpu_domain;
818 p2.h = _per_cpu__ipipe_percpu_domain;
823 if !cc jump 4f; /* not on behalf of the root domain, get out */
824 #endif /* CONFIG_IPIPE */
830 [sp + PT_IPEND] = r0;
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
848 r1 = (EVT_IVG14 | EVT_IVG15) (z);
853 /* Set the stack for the current process */
855 r4.l = lo(ALIGN_PAGE_MASK);
856 r4.h = hi(ALIGN_PAGE_MASK);
857 r7 = r7 & r4; /* thread_info->flags */
859 r7 = [p5 + TI_FLAGS];
860 r4.l = lo(_TIF_WORK_MASK);
861 r4.h = hi(_TIF_WORK_MASK);
868 p1.l = _schedule_and_signal;
869 p1.h = _schedule_and_signal;
872 raise 15; /* raise evt15 to do signal or reschedule */
875 bitclr(r0, SYSCFG_SSSTEP_P); /* Turn off single step */
879 ENDPROC(_ret_from_exception)
883 _resume_kernel_from_int:
884 r0.l = ___ipipe_sync_root;
885 r0.h = ___ipipe_sync_root;
887 [--sp] = ( r7:4, p5:3 );
889 call ___ipipe_call_irqtail
891 ( r7:4, p5:3 ) = [sp++];
895 #define _resume_kernel_from_int 2f
898 ENTRY(_return_from_int)
899 /* If someone else already raised IRQ 15, do nothing. */
904 cc = bittst (r0, EVT_IVG15_P);
907 /* if not return to user mode, get out */
919 if !cc jump _resume_kernel_from_int;
921 /* Lower the interrupt level to 15. */
924 p1.l = _schedule_and_signal_from_int;
925 p1.h = _schedule_and_signal_from_int;
928 #if ANOMALY_05000281 || ANOMALY_05000461
929 r0.l = lo(SAFE_USER_INSTRUCTION);
930 r0.h = hi(SAFE_USER_INSTRUCTION);
935 raise 15; /* raise evt15 to do signal or reschedule */
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);
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);
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);
958 ENDPROC(_lower_to_irq14)
961 #ifdef CONFIG_DEBUG_HWERR
962 r0 = (EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
972 ENTRY(_schedule_and_signal_from_int)
973 /* To end up here, vector 15 was changed - so we have to change it
978 p1.l = _evt_system_call;
979 p1.h = _evt_system_call;
983 /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */
985 [sp + PT_ORIG_P0] = r0;
988 [sp + PT_RESERVED] = p1;
991 GET_PDA(p0, r0); /* Fetch current PDA (can't migrate to other CPU here) */
992 r0 = [p0 + PDA_IRQFLAGS];
994 p0.l = _bfin_irq_flags;
995 p0.h = _bfin_irq_flags;
1000 /* finish the userspace "atomic" functions for it */
1001 r1 = FIXED_CODE_END;
1004 if cc jump .Lresume_userspace (bp);
1008 call _finish_atomic_sections;
1010 jump.s .Lresume_userspace;
1011 ENDPROC(_schedule_and_signal_from_int)
1013 ENTRY(_schedule_and_signal)
1014 SAVE_CONTEXT_SYSCALL
1015 /* To end up here, vector 15 was changed - so we have to change it
1020 p1.l = _evt_system_call;
1021 p1.h = _evt_system_call;
1026 [sp + PT_RESERVED] = P0;
1027 call .Lresume_userspace;
1031 ENDPROC(_schedule_and_signal)
1033 /* We handle this 100% in exception space - to reduce overhead
1034 * Only potiential problem is if the software buffer gets swapped out of the
1035 * CPLB table - then double fault. - so we don't let this happen in other places
1037 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1038 ENTRY(_ex_trace_buff_full)
1044 P5.L = _trace_buff_offset;
1045 P5.H = _trace_buff_offset;
1046 P3 = [P5]; /* trace_buff_offset */
1047 P5.L = lo(TBUFSTAT);
1048 P5.H = hi(TBUFSTAT);
1050 R7 <<= 1; /* double, since we need to read twice */
1052 R7 <<= 2; /* need to shift over again,
1053 * to get the number of bytes */
1056 R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;
1063 P2.L = _trace_buff_offset;
1064 P2.H = _trace_buff_offset;
1067 P2.L = _software_trace_buff;
1068 P2.H = _software_trace_buff;
1070 LSETUP (.Lstart, .Lend) LC0;
1072 R7 = [P5]; /* read TBUF */
1086 jump _bfin_return_from_exception;
1087 ENDPROC(_ex_trace_buff_full)
1089 #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
1093 #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
1094 ENTRY(_trace_buff_offset)
1097 ENTRY(_software_trace_buff)
1098 .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
1101 #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
1103 #if CONFIG_EARLY_PRINTK
1107 trace_buffer_stop(p0,r0);
1109 ANOMALY_283_315_WORKAROUND(p4, r5)
1111 /* Turn caches off, to ensure we don't get double exceptions */
1113 P4.L = LO(IMEM_CONTROL);
1114 P4.H = HI(IMEM_CONTROL);
1116 R5 = [P4]; /* Control Register*/
1117 BITCLR(R5,ENICPLB_P);
1118 CSYNC; /* Disabling of CPLBs should be proceeded by a CSYNC */
1122 P4.L = LO(DMEM_CONTROL);
1123 P4.H = HI(DMEM_CONTROL);
1125 BITCLR(R5,ENDCPLB_P);
1126 CSYNC; /* Disabling of CPLBs should be proceeded by a CSYNC */
1130 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
1136 ENDPROC(_early_trap)
1138 #endif /* CONFIG_EARLY_PRINTK */
1141 * Put these in the kernel data section - that should always be covered by
1142 * a CPLB. This is needed to ensure we don't get double fault conditions
1145 #ifdef CONFIG_SYSCALL_TAB_L1
1152 /* entry for each EXCAUSE[5:0]
1153 * This table must be in sync with the table in ./kernel/traps.c
1154 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
1156 .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
1157 .long _ex_trap_c /* 0x01 - User Defined - Software breakpoint */
1159 .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection
1160 and break signal trap */
1162 .long _ex_replaceable /* 0x02 - User Defined */
1164 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
1165 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
1166 .long _ex_replaceable /* 0x05 - User Defined */
1167 .long _ex_replaceable /* 0x06 - User Defined */
1168 .long _ex_replaceable /* 0x07 - User Defined */
1169 .long _ex_replaceable /* 0x08 - User Defined */
1170 .long _ex_replaceable /* 0x09 - User Defined */
1171 .long _ex_replaceable /* 0x0A - User Defined */
1172 .long _ex_replaceable /* 0x0B - User Defined */
1173 .long _ex_replaceable /* 0x0C - User Defined */
1174 .long _ex_replaceable /* 0x0D - User Defined */
1175 .long _ex_replaceable /* 0x0E - User Defined */
1176 .long _ex_replaceable /* 0x0F - User Defined */
1177 .long _ex_single_step /* 0x10 - HW Single step */
1178 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1179 .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
1181 .long _ex_trap_c /* 0x11 - Trace Buffer Full */
1183 .long _ex_trap_c /* 0x12 - Reserved */
1184 .long _ex_trap_c /* 0x13 - Reserved */
1185 .long _ex_trap_c /* 0x14 - Reserved */
1186 .long _ex_trap_c /* 0x15 - Reserved */
1187 .long _ex_trap_c /* 0x16 - Reserved */
1188 .long _ex_trap_c /* 0x17 - Reserved */
1189 .long _ex_trap_c /* 0x18 - Reserved */
1190 .long _ex_trap_c /* 0x19 - Reserved */
1191 .long _ex_trap_c /* 0x1A - Reserved */
1192 .long _ex_trap_c /* 0x1B - Reserved */
1193 .long _ex_trap_c /* 0x1C - Reserved */
1194 .long _ex_trap_c /* 0x1D - Reserved */
1195 .long _ex_trap_c /* 0x1E - Reserved */
1196 .long _ex_trap_c /* 0x1F - Reserved */
1197 .long _ex_trap_c /* 0x20 - Reserved */
1198 .long _ex_trap_c /* 0x21 - Undefined Instruction */
1199 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
1200 .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
1201 .long _ex_trap_c /* 0x24 - Data access misaligned */
1202 .long _ex_trap_c /* 0x25 - Unrecoverable Event */
1203 .long _ex_dmiss /* 0x26 - Data CPLB Miss */
1204 .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
1205 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
1206 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
1207 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
1208 .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
1209 .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
1210 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
1211 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1212 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1213 .long _ex_trap_c /* 0x2F - Reserved */
1214 .long _ex_trap_c /* 0x30 - Reserved */
1215 .long _ex_trap_c /* 0x31 - Reserved */
1216 .long _ex_trap_c /* 0x32 - Reserved */
1217 .long _ex_trap_c /* 0x33 - Reserved */
1218 .long _ex_trap_c /* 0x34 - Reserved */
1219 .long _ex_trap_c /* 0x35 - Reserved */
1220 .long _ex_trap_c /* 0x36 - Reserved */
1221 .long _ex_trap_c /* 0x37 - Reserved */
1222 .long _ex_trap_c /* 0x38 - Reserved */
1223 .long _ex_trap_c /* 0x39 - Reserved */
1224 .long _ex_trap_c /* 0x3A - Reserved */
1225 .long _ex_trap_c /* 0x3B - Reserved */
1226 .long _ex_trap_c /* 0x3C - Reserved */
1227 .long _ex_trap_c /* 0x3D - Reserved */
1228 .long _ex_trap_c /* 0x3E - Reserved */
1229 .long _ex_trap_c /* 0x3F - Reserved */
1232 ENTRY(_sys_call_table)
1233 .long _sys_restart_syscall /* 0 */
1238 .long _sys_open /* 5 */
1240 .long _sys_ni_syscall /* old waitpid */
1243 .long _sys_unlink /* 10 */
1248 .long _sys_chmod /* 15 */
1249 .long _sys_chown /* chown16 */
1250 .long _sys_ni_syscall /* old break syscall holder */
1251 .long _sys_ni_syscall /* old stat */
1253 .long _sys_getpid /* 20 */
1255 .long _sys_ni_syscall /* old umount */
1258 .long _sys_stime /* 25 */
1261 .long _sys_ni_syscall /* old fstat */
1263 .long _sys_ni_syscall /* old utime */ /* 30 */
1264 .long _sys_ni_syscall /* old stty syscall holder */
1265 .long _sys_ni_syscall /* old gtty syscall holder */
1268 .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */
1273 .long _sys_rmdir /* 40 */
1277 .long _sys_ni_syscall /* old prof syscall holder */
1278 .long _sys_brk /* 45 */
1281 .long _sys_ni_syscall /* old sys_signal */
1282 .long _sys_geteuid /* geteuid16 */
1283 .long _sys_getegid /* getegid16 */ /* 50 */
1285 .long _sys_umount /* recycled never used phys() */
1286 .long _sys_ni_syscall /* old lock syscall holder */
1288 .long _sys_fcntl /* 55 */
1289 .long _sys_ni_syscall /* old mpx syscall holder */
1291 .long _sys_ni_syscall /* old ulimit syscall holder */
1292 .long _sys_ni_syscall /* old old uname */
1293 .long _sys_umask /* 60 */
1298 .long _sys_getpgrp /* 65 */
1300 .long _sys_ni_syscall /* old sys_sigaction */
1303 .long _sys_setreuid /* setreuid16 */ /* 70 */
1304 .long _sys_setregid /* setregid16 */
1305 .long _sys_ni_syscall /* old sys_sigsuspend */
1306 .long _sys_ni_syscall /* old sys_sigpending */
1307 .long _sys_sethostname
1308 .long _sys_setrlimit /* 75 */
1309 .long _sys_ni_syscall /* old getrlimit */
1310 .long _sys_getrusage
1311 .long _sys_gettimeofday
1312 .long _sys_settimeofday
1313 .long _sys_getgroups /* getgroups16 */ /* 80 */
1314 .long _sys_setgroups /* setgroups16 */
1315 .long _sys_ni_syscall /* old_select */
1317 .long _sys_ni_syscall /* old lstat */
1318 .long _sys_readlink /* 85 */
1320 .long _sys_ni_syscall /* sys_swapon */
1322 .long _sys_ni_syscall /* old_readdir */
1323 .long _sys_ni_syscall /* sys_mmap */ /* 90 */
1326 .long _sys_ftruncate
1328 .long _sys_fchown /* fchown16 */ /* 95 */
1329 .long _sys_getpriority
1330 .long _sys_setpriority
1331 .long _sys_ni_syscall /* old profil syscall holder */
1333 .long _sys_fstatfs /* 100 */
1334 .long _sys_ni_syscall
1335 .long _sys_ni_syscall /* old sys_socketcall */
1337 .long _sys_setitimer
1338 .long _sys_getitimer /* 105 */
1342 .long _sys_ni_syscall /* old uname */
1343 .long _sys_ni_syscall /* iopl for i386 */ /* 110 */
1345 .long _sys_ni_syscall /* obsolete idle() syscall */
1346 .long _sys_ni_syscall /* vm86old for i386 */
1348 .long _sys_ni_syscall /* 115 */ /* sys_swapoff */
1350 .long _sys_ni_syscall /* old sys_ipc */
1352 .long _sys_ni_syscall /* old sys_sigreturn */
1353 .long _sys_clone /* 120 */
1354 .long _sys_setdomainname
1356 .long _sys_ni_syscall /* old sys_modify_ldt */
1358 .long _sys_ni_syscall /* 125 */ /* sys_mprotect */
1359 .long _sys_ni_syscall /* old sys_sigprocmask */
1360 .long _sys_ni_syscall /* old "creat_module" */
1361 .long _sys_init_module
1362 .long _sys_delete_module
1363 .long _sys_ni_syscall /* 130: old "get_kernel_syms" */
1368 .long _sys_ni_syscall /* 135 */ /* sys_sysfs */
1369 .long _sys_personality
1370 .long _sys_ni_syscall /* for afs_syscall */
1371 .long _sys_setfsuid /* setfsuid16 */
1372 .long _sys_setfsgid /* setfsgid16 */
1373 .long _sys_llseek /* 140 */
1375 .long _sys_ni_syscall /* sys_select */
1377 .long _sys_ni_syscall /* sys_msync */
1378 .long _sys_readv /* 145 */
1381 .long _sys_fdatasync
1383 .long _sys_ni_syscall /* 150 */ /* sys_mlock */
1384 .long _sys_ni_syscall /* sys_munlock */
1385 .long _sys_ni_syscall /* sys_mlockall */
1386 .long _sys_ni_syscall /* sys_munlockall */
1387 .long _sys_sched_setparam
1388 .long _sys_sched_getparam /* 155 */
1389 .long _sys_sched_setscheduler
1390 .long _sys_sched_getscheduler
1391 .long _sys_sched_yield
1392 .long _sys_sched_get_priority_max
1393 .long _sys_sched_get_priority_min /* 160 */
1394 .long _sys_sched_rr_get_interval
1395 .long _sys_nanosleep
1397 .long _sys_setresuid /* setresuid16 */
1398 .long _sys_getresuid /* getresuid16 */ /* 165 */
1399 .long _sys_ni_syscall /* for vm86 */
1400 .long _sys_ni_syscall /* old "query_module" */
1401 .long _sys_ni_syscall /* sys_poll */
1402 .long _sys_nfsservctl
1403 .long _sys_setresgid /* setresgid16 */ /* 170 */
1404 .long _sys_getresgid /* getresgid16 */
1406 .long _sys_rt_sigreturn
1407 .long _sys_rt_sigaction
1408 .long _sys_rt_sigprocmask /* 175 */
1409 .long _sys_rt_sigpending
1410 .long _sys_rt_sigtimedwait
1411 .long _sys_rt_sigqueueinfo
1412 .long _sys_rt_sigsuspend
1413 .long _sys_pread64 /* 180 */
1415 .long _sys_lchown /* lchown16 */
1418 .long _sys_capset /* 185 */
1419 .long _sys_sigaltstack
1421 .long _sys_ni_syscall /* streams1 */
1422 .long _sys_ni_syscall /* streams2 */
1423 .long _sys_vfork /* 190 */
1424 .long _sys_getrlimit
1425 .long _sys_mmap_pgoff
1426 .long _sys_truncate64
1427 .long _sys_ftruncate64
1428 .long _sys_stat64 /* 195 */
1433 .long _sys_getgid /* 200 */
1438 .long _sys_getgroups /* 205 */
1439 .long _sys_setgroups
1441 .long _sys_setresuid
1442 .long _sys_getresuid
1443 .long _sys_setresgid /* 210 */
1444 .long _sys_getresgid
1448 .long _sys_setfsuid /* 215 */
1450 .long _sys_pivot_root
1451 .long _sys_ni_syscall /* sys_mincore */
1452 .long _sys_ni_syscall /* sys_madvise */
1453 .long _sys_getdents64 /* 220 */
1455 .long _sys_ni_syscall /* reserved for TUX */
1456 .long _sys_ni_syscall
1458 .long _sys_readahead /* 225 */
1460 .long _sys_lsetxattr
1461 .long _sys_fsetxattr
1463 .long _sys_lgetxattr /* 230 */
1464 .long _sys_fgetxattr
1465 .long _sys_listxattr
1466 .long _sys_llistxattr
1467 .long _sys_flistxattr
1468 .long _sys_removexattr /* 235 */
1469 .long _sys_lremovexattr
1470 .long _sys_fremovexattr
1472 .long _sys_sendfile64
1473 .long _sys_futex /* 240 */
1474 .long _sys_sched_setaffinity
1475 .long _sys_sched_getaffinity
1476 .long _sys_ni_syscall /* sys_set_thread_area */
1477 .long _sys_ni_syscall /* sys_get_thread_area */
1478 .long _sys_io_setup /* 245 */
1479 .long _sys_io_destroy
1480 .long _sys_io_getevents
1481 .long _sys_io_submit
1482 .long _sys_io_cancel
1483 .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */
1484 .long _sys_ni_syscall /* sys_freec_hugepages */
1485 .long _sys_exit_group
1486 .long _sys_lookup_dcookie
1487 .long _sys_bfin_spinlock
1488 .long _sys_epoll_create /* 255 */
1489 .long _sys_epoll_ctl
1490 .long _sys_epoll_wait
1491 .long _sys_ni_syscall /* remap_file_pages */
1492 .long _sys_set_tid_address
1493 .long _sys_timer_create /* 260 */
1494 .long _sys_timer_settime
1495 .long _sys_timer_gettime
1496 .long _sys_timer_getoverrun
1497 .long _sys_timer_delete
1498 .long _sys_clock_settime /* 265 */
1499 .long _sys_clock_gettime
1500 .long _sys_clock_getres
1501 .long _sys_clock_nanosleep
1503 .long _sys_fstatfs64 /* 270 */
1506 .long _sys_fadvise64_64
1507 .long _sys_ni_syscall /* vserver */
1508 .long _sys_ni_syscall /* 275, mbind */
1509 .long _sys_ni_syscall /* get_mempolicy */
1510 .long _sys_ni_syscall /* set_mempolicy */
1512 .long _sys_mq_unlink
1513 .long _sys_mq_timedsend /* 280 */
1514 .long _sys_mq_timedreceive
1515 .long _sys_mq_notify
1516 .long _sys_mq_getsetattr
1517 .long _sys_ni_syscall /* kexec_load */
1518 .long _sys_waitid /* 285 */
1520 .long _sys_request_key
1522 .long _sys_ioprio_set
1523 .long _sys_ioprio_get /* 290 */
1524 .long _sys_inotify_init
1525 .long _sys_inotify_add_watch
1526 .long _sys_inotify_rm_watch
1527 .long _sys_ni_syscall /* migrate_pages */
1528 .long _sys_openat /* 295 */
1532 .long _sys_futimesat
1533 .long _sys_fstatat64 /* 300 */
1537 .long _sys_symlinkat
1538 .long _sys_readlinkat /* 305 */
1540 .long _sys_faccessat
1543 .long _sys_unshare /* 310 */
1544 .long _sys_sram_alloc
1545 .long _sys_sram_free
1546 .long _sys_dma_memcpy
1548 .long _sys_bind /* 315 */
1550 .long _sys_getpeername
1551 .long _sys_getsockname
1552 .long _sys_getsockopt
1553 .long _sys_listen /* 320 */
1558 .long _sys_sendmsg /* 325 */
1560 .long _sys_setsockopt
1563 .long _sys_socketpair /* 330 */
1568 .long _sys_msgget /* 335 */
1573 .long _sys_shmdt /* 340 */
1576 .long _sys_sync_file_range
1578 .long _sys_vmsplice /* 345 */
1579 .long _sys_epoll_pwait
1580 .long _sys_utimensat
1582 .long _sys_timerfd_create
1583 .long _sys_eventfd /* 350 */
1586 .long _sys_fadvise64
1587 .long _sys_set_robust_list
1588 .long _sys_get_robust_list /* 355 */
1589 .long _sys_fallocate
1590 .long _sys_semtimedop
1591 .long _sys_timerfd_settime
1592 .long _sys_timerfd_gettime
1593 .long _sys_signalfd4 /* 360 */
1595 .long _sys_epoll_create1
1598 .long _sys_inotify_init1 /* 365 */
1601 .long _sys_rt_tgsigqueueinfo
1602 .long _sys_perf_event_open
1604 .rept NR_syscalls-(.-_sys_call_table)/4
1605 .long _sys_ni_syscall
1607 END(_sys_call_table)