2 * File: arch/blackfin/kernel/traps.c
4 * Author: Hamish Macdonald
7 * Description: uses S/W interrupt 15 for the system calls
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include <linux/uaccess.h>
31 #include <linux/interrupt.h>
32 #include <linux/module.h>
33 #include <linux/kallsyms.h>
35 #include <asm/traps.h>
36 #include <asm/cacheflush.h>
37 #include <asm/blackfin.h>
38 #include <asm/irq_handler.h>
39 #include <asm/trace.h>
40 #include <asm/fixed_code.h>
43 # include <linux/debugger.h>
44 # include <linux/kgdb.h>
46 # define CHK_DEBUGGER_TRAP() \
48 CHK_DEBUGGER(trapnr, sig, info.si_code, fp, ); \
50 # define CHK_DEBUGGER_TRAP_MAYBE() \
53 CHK_DEBUGGER_TRAP(); \
56 # define CHK_DEBUGGER_TRAP() do { } while (0)
57 # define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0)
60 /* Initiate the event table handler */
61 void __init trap_init(void)
64 bfin_write_EVT3(trap);
68 int kstack_depth_to_print = 48;
70 static void decode_address(char *buf, unsigned long address)
72 struct vm_list_struct *vml;
73 struct task_struct *p;
75 unsigned long flags, offset;
76 unsigned int in_exception = bfin_read_IPEND() & 0x10;
78 #ifdef CONFIG_KALLSYMS
79 unsigned long symsize;
85 /* look up the address and see if we are in kernel space */
86 symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
89 /* yeah! kernel space! */
92 sprintf(buf, "<0x%p> { %s%s%s%s + 0x%lx }",
93 (void *)address, delim, modname, delim, symname,
94 (unsigned long)offset);
100 /* Problem in fixed code section? */
101 if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
102 sprintf(buf, "<0x%p> /* Maybe fixed code section */", (void *)address);
106 /* Problem somewhere before the kernel start address */
107 if (address < CONFIG_BOOT_LOAD) {
108 sprintf(buf, "<0x%p> /* Maybe null pointer? */", (void *)address);
112 /* looks like we're off in user-land, so let's walk all the
113 * mappings of all our processes and see if we can't be a whee
116 write_lock_irqsave(&tasklist_lock, flags);
117 for_each_process(p) {
118 mm = (in_exception ? p->mm : get_task_mm(p));
122 vml = mm->context.vmlist;
124 struct vm_area_struct *vma = vml->vma;
126 if (address >= vma->vm_start && address < vma->vm_end) {
127 char *name = p->comm;
128 struct file *file = vma->vm_file;
131 name = d_path(file->f_dentry,
137 /* FLAT does not have its text aligned to the start of
138 * the map while FDPIC ELF does ...
141 (address > current->mm->start_code) &&
142 (address < current->mm->end_code))
143 offset = address - current->mm->start_code;
145 offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
147 sprintf(buf, "<0x%p> [ %s + 0x%lx ]",
148 (void *)address, name, offset);
160 /* we were unable to find this address anywhere */
161 sprintf(buf, "<0x%p> /* unknown address */", (void *)address);
164 write_unlock_irqrestore(&tasklist_lock, flags);
167 asmlinkage void double_fault_c(struct pt_regs *fp)
170 oops_in_progress = 1;
171 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
172 dump_bfin_process(fp);
173 dump_bfin_mem((void *)fp->retx);
175 panic("Double Fault - unrecoverable event\n");
179 asmlinkage void trap_c(struct pt_regs *fp)
181 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
186 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
188 trace_buffer_save(j);
190 /* Important - be very careful dereferncing pointers - will lead to
191 * double faults if the stack has become corrupt
194 /* If the fault was caused by a kernel thread, or interrupt handler
195 * we will kernel panic, so the system reboots.
196 * If KGDB is enabled, don't set this for kernel breakpoints
198 if ((bfin_read_IPEND() & 0xFFC0)
200 && trapnr != VEC_EXCPT02
204 oops_in_progress = 1;
205 } else if (current) {
206 if (current->mm == NULL) {
208 oops_in_progress = 1;
212 /* trap_c() will be called for exceptions. During exceptions
213 * processing, the pc value should be set with retx value.
214 * With this change we can cleanup some code in signal.c- TODO
216 fp->orig_pc = fp->retx;
217 /* printk("exception: 0x%x, ipend=%x, reti=%x, retx=%x\n",
218 trapnr, fp->ipend, fp->pc, fp->retx); */
220 /* send the appropriate signal to the user program */
223 /* This table works in conjuction with the one in ./mach-common/entry.S
224 * Some exceptions are handled there (in assembly, in exception space)
225 * Some are handled here, (in C, in interrupt space)
226 * Some, like CPLB, are handled in both, where the normal path is
227 * handled in assembly/exception space, and the error path is handled
231 /* 0x00 - Linux Syscall, getting here is an error */
232 /* 0x01 - userspace gdb breakpoint, handled here */
234 info.si_code = TRAP_ILLTRAP;
236 CHK_DEBUGGER_TRAP_MAYBE();
237 /* Check if this is a breakpoint in kernel space */
238 if (fp->ipend & 0xffc0)
243 case VEC_EXCPT02 : /* gdb connection */
244 info.si_code = TRAP_ILLTRAP;
249 /* 0x02 - User Defined, Caught by default */
251 /* 0x03 - User Defined, userspace stack overflow */
253 info.si_code = SEGV_STACKFLOW;
255 printk(KERN_NOTICE EXC_0x03(KERN_NOTICE));
258 /* 0x04 - User Defined, Caught by default */
259 /* 0x05 - User Defined, Caught by default */
260 /* 0x06 - User Defined, Caught by default */
261 /* 0x07 - User Defined, Caught by default */
262 /* 0x08 - User Defined, Caught by default */
263 /* 0x09 - User Defined, Caught by default */
264 /* 0x0A - User Defined, Caught by default */
265 /* 0x0B - User Defined, Caught by default */
266 /* 0x0C - User Defined, Caught by default */
267 /* 0x0D - User Defined, Caught by default */
268 /* 0x0E - User Defined, Caught by default */
269 /* 0x0F - User Defined, Caught by default */
270 /* 0x10 HW Single step, handled here */
272 info.si_code = TRAP_STEP;
274 CHK_DEBUGGER_TRAP_MAYBE();
275 /* Check if this is a single step in kernel space */
276 if (fp->ipend & 0xffc0)
280 /* 0x11 - Trace Buffer Full, handled here */
282 info.si_code = TRAP_TRACEFLOW;
284 printk(KERN_NOTICE EXC_0x11(KERN_NOTICE));
287 /* 0x12 - Reserved, Caught by default */
288 /* 0x13 - Reserved, Caught by default */
289 /* 0x14 - Reserved, Caught by default */
290 /* 0x15 - Reserved, Caught by default */
291 /* 0x16 - Reserved, Caught by default */
292 /* 0x17 - Reserved, Caught by default */
293 /* 0x18 - Reserved, Caught by default */
294 /* 0x19 - Reserved, Caught by default */
295 /* 0x1A - Reserved, Caught by default */
296 /* 0x1B - Reserved, Caught by default */
297 /* 0x1C - Reserved, Caught by default */
298 /* 0x1D - Reserved, Caught by default */
299 /* 0x1E - Reserved, Caught by default */
300 /* 0x1F - Reserved, Caught by default */
301 /* 0x20 - Reserved, Caught by default */
302 /* 0x21 - Undefined Instruction, handled here */
304 info.si_code = ILL_ILLOPC;
306 printk(KERN_NOTICE EXC_0x21(KERN_NOTICE));
309 /* 0x22 - Illegal Instruction Combination, handled here */
311 info.si_code = ILL_ILLPARAOP;
313 printk(KERN_NOTICE EXC_0x22(KERN_NOTICE));
316 /* 0x23 - Data CPLB protection violation, handled here */
318 info.si_code = ILL_CPLB_VI;
320 printk(KERN_NOTICE EXC_0x23(KERN_NOTICE));
323 /* 0x24 - Data access misaligned, handled here */
325 info.si_code = BUS_ADRALN;
327 printk(KERN_NOTICE EXC_0x24(KERN_NOTICE));
330 /* 0x25 - Unrecoverable Event, handled here */
332 info.si_code = ILL_ILLEXCPT;
334 printk(KERN_NOTICE EXC_0x25(KERN_NOTICE));
337 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
338 error case is handled here */
340 info.si_code = BUS_ADRALN;
342 printk(KERN_NOTICE EXC_0x26(KERN_NOTICE));
345 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
347 info.si_code = ILL_CPLB_MULHIT;
348 #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
350 printk(KERN_NOTICE "NULL pointer access (probably)\n");
353 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE));
357 /* 0x28 - Emulation Watchpoint, handled here */
359 info.si_code = TRAP_WATCHPT;
361 pr_debug(EXC_0x28(KERN_DEBUG));
362 CHK_DEBUGGER_TRAP_MAYBE();
363 /* Check if this is a watchpoint in kernel space */
364 if (fp->ipend & 0xffc0)
369 /* 0x29 - Instruction fetch access error (535 only) */
370 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */
371 info.si_code = BUS_OPFETCH;
373 printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n");
377 /* 0x29 - Reserved, Caught by default */
379 /* 0x2A - Instruction fetch misaligned, handled here */
381 info.si_code = BUS_ADRALN;
383 printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE));
386 /* 0x2B - Instruction CPLB protection violation, handled here */
388 info.si_code = ILL_CPLB_VI;
390 printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE));
393 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */
395 info.si_code = ILL_CPLB_MISS;
397 printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE));
400 /* 0x2D - Instruction CPLB Multiple Hits, handled here */
401 case VEC_CPLB_I_MHIT:
402 info.si_code = ILL_CPLB_MULHIT;
403 #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
405 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n");
408 printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE));
412 /* 0x2E - Illegal use of Supervisor Resource, handled here */
414 info.si_code = ILL_PRVOPC;
416 printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE));
419 /* 0x2F - Reserved, Caught by default */
420 /* 0x30 - Reserved, Caught by default */
421 /* 0x31 - Reserved, Caught by default */
422 /* 0x32 - Reserved, Caught by default */
423 /* 0x33 - Reserved, Caught by default */
424 /* 0x34 - Reserved, Caught by default */
425 /* 0x35 - Reserved, Caught by default */
426 /* 0x36 - Reserved, Caught by default */
427 /* 0x37 - Reserved, Caught by default */
428 /* 0x38 - Reserved, Caught by default */
429 /* 0x39 - Reserved, Caught by default */
430 /* 0x3A - Reserved, Caught by default */
431 /* 0x3B - Reserved, Caught by default */
432 /* 0x3C - Reserved, Caught by default */
433 /* 0x3D - Reserved, Caught by default */
434 /* 0x3E - Reserved, Caught by default */
435 /* 0x3F - Reserved, Caught by default */
437 info.si_code = BUS_ADRALN;
439 switch (fp->seqstat & SEQSTAT_HWERRCAUSE) {
440 /* System MMR Error */
441 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR):
442 info.si_code = BUS_ADRALN;
444 printk(KERN_NOTICE HWC_x2(KERN_NOTICE));
446 /* External Memory Addressing Error */
447 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR):
448 info.si_code = BUS_ADRERR;
450 printk(KERN_NOTICE HWC_x3(KERN_NOTICE));
452 /* Performance Monitor Overflow */
453 case (SEQSTAT_HWERRCAUSE_PERF_FLOW):
454 printk(KERN_NOTICE HWC_x12(KERN_NOTICE));
456 /* RAISE 5 instruction */
457 case (SEQSTAT_HWERRCAUSE_RAISE_5):
458 printk(KERN_NOTICE HWC_x18(KERN_NOTICE));
460 default: /* Reserved */
461 printk(KERN_NOTICE HWC_default(KERN_NOTICE));
467 info.si_code = TRAP_ILLTRAP;
469 printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n",
470 (fp->seqstat & SEQSTAT_EXCAUSE));
477 if (sig != SIGTRAP) {
479 dump_bfin_process(fp);
480 /* Is it an interrupt, or an exception? */
481 if (trapnr == VEC_HWERR)
482 dump_bfin_mem((void *)fp->pc);
484 dump_bfin_mem((void *)fp->retx);
487 /* Print out the trace buffer if it makes sense */
488 #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
489 if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M)
490 printk(KERN_NOTICE "No trace since you do not have "
491 "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n"
495 dump_bfin_trace_buffer();
496 show_stack(current, &stack);
497 if (oops_in_progress) {
498 #ifndef CONFIG_ACCESS_CHECK
499 printk(KERN_EMERG "Please turn on "
500 "CONFIG_ACCESS_CHECK\n");
502 panic("Kernel exception");
508 info.si_addr = (void *)fp->pc;
509 force_sig_info(sig, &info, current);
511 /* Ensure that bad return addresses don't end up in an infinite
512 * loop, due to speculative loads/reads. This needs to be done after
513 * the signal has been sent.
515 if (trapnr == VEC_CPLB_I_M && sig != SIGTRAP)
516 fp->pc = SAFE_USER_INSTRUCTION;
518 trace_buffer_restore(j);
522 /* Typical exception handling routines */
524 #define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1)
526 void dump_bfin_trace_buffer(void)
528 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
531 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
535 trace_buffer_save(tflags);
537 printk(KERN_NOTICE "Hardware Trace:\n");
539 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) {
540 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
541 decode_address(buf, (unsigned long)bfin_read_TBUF());
542 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
543 decode_address(buf, (unsigned long)bfin_read_TBUF());
544 printk(KERN_NOTICE " Source : %s\n", buf);
548 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
549 if (trace_buff_offset)
550 index = trace_buff_offset/4 - 1;
554 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128;
556 decode_address(buf, software_trace_buff[index]);
557 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
561 decode_address(buf, software_trace_buff[index]);
562 printk(KERN_NOTICE " Source : %s\n", buf);
571 trace_buffer_restore(tflags);
574 EXPORT_SYMBOL(dump_bfin_trace_buffer);
576 static void show_trace(struct task_struct *tsk, unsigned long *sp)
580 printk(KERN_NOTICE "\n" KERN_NOTICE "Call Trace:\n");
582 while (!kstack_end(sp)) {
585 * If the address is either in the text segment of the
586 * kernel, or in the region which contains vmalloc'ed
587 * memory, it *may* be the address of a calling
588 * routine; if so, print it so that someone tracing
589 * down the cause of the crash will be able to figure
590 * out the call path that was taken.
592 if (kernel_text_address(addr))
596 printk(KERN_NOTICE "\n");
599 void show_stack(struct task_struct *task, unsigned long *stack)
601 unsigned long *endstack, addr;
604 /* Cannot call dump_bfin_trace_buffer() here as show_stack() is
605 * called externally in some places in the kernel.
610 stack = (unsigned long *)task->thread.ksp;
612 stack = (unsigned long *)&stack;
615 addr = (unsigned long)stack;
616 endstack = (unsigned long *)PAGE_ALIGN(addr);
618 printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack);
619 for (i = 0; i < kstack_depth_to_print; i++) {
620 if (stack + 1 > endstack)
623 printk("\n" KERN_NOTICE " ");
624 printk(" %08lx", *stack++);
628 show_trace(task, stack);
631 void dump_stack(void)
634 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
637 trace_buffer_save(tflags);
638 dump_bfin_trace_buffer();
639 show_stack(current, &stack);
640 trace_buffer_restore(tflags);
642 EXPORT_SYMBOL(dump_stack);
644 void dump_bfin_process(struct pt_regs *fp)
646 /* We should be able to look at fp->ipend, but we don't push it on the
647 * stack all the time, so do this until we fix that */
648 unsigned int context = bfin_read_IPEND();
650 if (oops_in_progress)
651 printk(KERN_EMERG "Kernel OOPS in progress\n");
653 if (context & 0x0020)
654 printk(KERN_NOTICE "Deferred excecption or HW Error context\n");
655 else if (context & 0x3FC0)
656 printk(KERN_NOTICE "Interrupt context\n");
657 else if (context & 0x4000)
658 printk(KERN_NOTICE "Deferred Interrupt context\n");
659 else if (context & 0x8000)
660 printk(KERN_NOTICE "Kernel process context\n");
662 if (current->pid && current->mm) {
663 printk(KERN_NOTICE "CURRENT PROCESS:\n");
664 printk(KERN_NOTICE "COMM=%s PID=%d\n",
665 current->comm, current->pid);
667 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
668 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
670 (void *)current->mm->start_code,
671 (void *)current->mm->end_code,
672 (void *)current->mm->start_data,
673 (void *)current->mm->end_data,
674 (void *)current->mm->end_data,
675 (void *)current->mm->brk,
676 (void *)current->mm->start_stack);
678 printk(KERN_NOTICE "\n" KERN_NOTICE
679 "No Valid process in current context\n");
682 void dump_bfin_mem(void *retaddr)
685 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end
686 #if L1_CODE_LENGTH != 0
687 /* FIXME: Copy the code out of L1 Instruction SRAM through dma
689 && !(retaddr >= (void *)L1_CODE_START
690 && retaddr < (void *)(L1_CODE_START + L1_CODE_LENGTH))
693 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32;
694 unsigned short x = 0;
695 printk(KERN_NOTICE "return address: [0x%p]; contents of:", retaddr);
696 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) {
698 printk("\n" KERN_NOTICE "0x%08x: ", i);
700 if (get_user(x, (unsigned short *)i))
702 #ifndef CONFIG_DEBUG_HWERR
703 /* If one of the last few instructions was a STI
704 * it is likely that the error occured awhile ago
705 * and we just noticed. This only happens in kernel
706 * context, which should mean an oops is happening
708 if (oops_in_progress && x >= 0x0040 && x <= 0x0047 && i <= 0)
709 printk(KERN_EMERG "\n"
710 KERN_EMERG "WARNING : You should reconfigure"
711 " the kernel to turn on\n"
712 KERN_EMERG " 'Hardware error interrupt debugging'\n"
713 KERN_EMERG " The rest of this error is meanless\n");
715 if (i == (unsigned int)retaddr)
722 printk("\n" KERN_NOTICE
723 "Cannot look at the [PC] <%p> for it is"
724 " in unreadable memory - sorry\n", retaddr);
727 void show_regs(struct pt_regs *fp)
731 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
732 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
733 (long)fp->seqstat, fp->ipend, fp->syscfg);
734 printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n",
735 (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14);
736 printk(KERN_NOTICE " EXCAUSE : 0x%lx\n",
737 fp->seqstat & SEQSTAT_EXCAUSE);
739 decode_address(buf, fp->rete);
740 printk(KERN_NOTICE " RETE: %s\n", buf);
741 decode_address(buf, fp->retn);
742 printk(KERN_NOTICE " RETN: %s\n", buf);
743 decode_address(buf, fp->retx);
744 printk(KERN_NOTICE " RETX: %s\n", buf);
745 decode_address(buf, fp->rets);
746 printk(KERN_NOTICE " RETS: %s\n", buf);
747 decode_address(buf, fp->pc);
748 printk(KERN_NOTICE " PC : %s\n", buf);
750 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) &&
751 (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) {
752 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
753 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
754 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR());
755 printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf);
758 printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n");
759 printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
760 fp->r0, fp->r1, fp->r2, fp->r3);
761 printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
762 fp->r4, fp->r5, fp->r6, fp->r7);
763 printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n",
764 fp->p0, fp->p1, fp->p2, fp->p3);
765 printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n",
766 fp->p4, fp->p5, fp->fp, (long)fp);
767 printk(KERN_NOTICE " LB0: %08lx LT0: %08lx LC0: %08lx\n",
768 fp->lb0, fp->lt0, fp->lc0);
769 printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n",
770 fp->lb1, fp->lt1, fp->lc1);
771 printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n",
772 fp->b0, fp->l0, fp->m0, fp->i0);
773 printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n",
774 fp->b1, fp->l1, fp->m1, fp->i1);
775 printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n",
776 fp->b2, fp->l2, fp->m2, fp->i2);
777 printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n",
778 fp->b3, fp->l3, fp->m3, fp->i3);
779 printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
780 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
782 printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n",
785 printk(KERN_NOTICE "\n");
788 #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
789 asmlinkage int sys_bfin_spinlock(int *spinlock)__attribute__((l1_text));
792 asmlinkage int sys_bfin_spinlock(int *spinlock)
798 ret = get_user(tmp, spinlock);
803 put_user(tmp, spinlock);
809 int bfin_request_exception(unsigned int exception, void (*handler)(void))
811 void (*curr_handler)(void);
813 if (exception > 0x3F)
816 curr_handler = ex_table[exception];
818 if (curr_handler != ex_replaceable)
821 ex_table[exception] = handler;
825 EXPORT_SYMBOL(bfin_request_exception);
827 int bfin_free_exception(unsigned int exception, void (*handler)(void))
829 void (*curr_handler)(void);
831 if (exception > 0x3F)
834 curr_handler = ex_table[exception];
836 if (curr_handler != handler)
839 ex_table[exception] = ex_replaceable;
843 EXPORT_SYMBOL(bfin_free_exception);
845 void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
847 switch (cplb_panic) {
848 case CPLB_NO_UNLOCKED:
849 printk(KERN_EMERG "All CPLBs are locked\n");
853 case CPLB_NO_ADDR_MATCH:
855 case CPLB_UNKNOWN_ERR:
856 printk(KERN_EMERG "Unknown CPLB Exception\n");
860 oops_in_progress = 1;
862 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
863 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
864 dump_bfin_process(fp);
865 dump_bfin_mem((void *)fp->retx);
868 panic("Unrecoverable event\n");