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 <linux/irq.h>
40 #include <asm/trace.h>
41 #include <asm/fixed_code.h>
44 # include <linux/debugger.h>
45 # include <linux/kgdb.h>
47 # define CHK_DEBUGGER_TRAP() \
49 CHK_DEBUGGER(trapnr, sig, info.si_code, fp, ); \
51 # define CHK_DEBUGGER_TRAP_MAYBE() \
54 CHK_DEBUGGER_TRAP(); \
57 # define CHK_DEBUGGER_TRAP() do { } while (0)
58 # define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0)
61 /* Initiate the event table handler */
62 void __init trap_init(void)
65 bfin_write_EVT3(trap);
69 int kstack_depth_to_print = 48;
71 static void decode_address(char *buf, unsigned long address)
73 struct vm_list_struct *vml;
74 struct task_struct *p;
76 unsigned long flags, offset;
77 unsigned int in_exception = bfin_read_IPEND() & 0x10;
79 #ifdef CONFIG_KALLSYMS
80 unsigned long symsize;
86 /* look up the address and see if we are in kernel space */
87 symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
90 /* yeah! kernel space! */
93 sprintf(buf, "<0x%p> { %s%s%s%s + 0x%lx }",
94 (void *)address, delim, modname, delim, symname,
95 (unsigned long)offset);
101 /* Problem in fixed code section? */
102 if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
103 sprintf(buf, "<0x%p> /* Maybe fixed code section */", (void *)address);
107 /* Problem somewhere before the kernel start address */
108 if (address < CONFIG_BOOT_LOAD) {
109 sprintf(buf, "<0x%p> /* Maybe null pointer? */", (void *)address);
113 /* looks like we're off in user-land, so let's walk all the
114 * mappings of all our processes and see if we can't be a whee
117 write_lock_irqsave(&tasklist_lock, flags);
118 for_each_process(p) {
119 mm = (in_exception ? p->mm : get_task_mm(p));
123 vml = mm->context.vmlist;
125 struct vm_area_struct *vma = vml->vma;
127 if (address >= vma->vm_start && address < vma->vm_end) {
128 char *name = p->comm;
129 struct file *file = vma->vm_file;
132 name = d_path(file->f_dentry,
138 /* FLAT does not have its text aligned to the start of
139 * the map while FDPIC ELF does ...
142 (address > current->mm->start_code) &&
143 (address < current->mm->end_code))
144 offset = address - current->mm->start_code;
146 offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
148 sprintf(buf, "<0x%p> [ %s + 0x%lx ]",
149 (void *)address, name, offset);
161 /* we were unable to find this address anywhere */
162 sprintf(buf, "<0x%p> /* unknown address */", (void *)address);
165 write_unlock_irqrestore(&tasklist_lock, flags);
168 asmlinkage void double_fault_c(struct pt_regs *fp)
171 oops_in_progress = 1;
172 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
173 dump_bfin_process(fp);
174 dump_bfin_mem((void *)fp->retx);
176 panic("Double Fault - unrecoverable event\n");
180 asmlinkage void trap_c(struct pt_regs *fp)
182 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
187 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
189 trace_buffer_save(j);
191 /* Important - be very careful dereferncing pointers - will lead to
192 * double faults if the stack has become corrupt
195 /* If the fault was caused by a kernel thread, or interrupt handler
196 * we will kernel panic, so the system reboots.
197 * If KGDB is enabled, don't set this for kernel breakpoints
199 if ((bfin_read_IPEND() & 0xFFC0)
201 && trapnr != VEC_EXCPT02
205 oops_in_progress = 1;
206 } else if (current) {
207 if (current->mm == NULL) {
209 oops_in_progress = 1;
213 /* trap_c() will be called for exceptions. During exceptions
214 * processing, the pc value should be set with retx value.
215 * With this change we can cleanup some code in signal.c- TODO
217 fp->orig_pc = fp->retx;
218 /* printk("exception: 0x%x, ipend=%x, reti=%x, retx=%x\n",
219 trapnr, fp->ipend, fp->pc, fp->retx); */
221 /* send the appropriate signal to the user program */
224 /* This table works in conjuction with the one in ./mach-common/entry.S
225 * Some exceptions are handled there (in assembly, in exception space)
226 * Some are handled here, (in C, in interrupt space)
227 * Some, like CPLB, are handled in both, where the normal path is
228 * handled in assembly/exception space, and the error path is handled
232 /* 0x00 - Linux Syscall, getting here is an error */
233 /* 0x01 - userspace gdb breakpoint, handled here */
235 info.si_code = TRAP_ILLTRAP;
237 CHK_DEBUGGER_TRAP_MAYBE();
238 /* Check if this is a breakpoint in kernel space */
239 if (fp->ipend & 0xffc0)
244 case VEC_EXCPT02 : /* gdb connection */
245 info.si_code = TRAP_ILLTRAP;
250 /* 0x02 - User Defined, Caught by default */
252 /* 0x03 - User Defined, userspace stack overflow */
254 info.si_code = SEGV_STACKFLOW;
256 printk(KERN_NOTICE EXC_0x03(KERN_NOTICE));
259 /* 0x04 - User Defined, Caught by default */
260 /* 0x05 - User Defined, Caught by default */
261 /* 0x06 - User Defined, Caught by default */
262 /* 0x07 - User Defined, Caught by default */
263 /* 0x08 - User Defined, Caught by default */
264 /* 0x09 - User Defined, Caught by default */
265 /* 0x0A - User Defined, Caught by default */
266 /* 0x0B - User Defined, Caught by default */
267 /* 0x0C - User Defined, Caught by default */
268 /* 0x0D - User Defined, Caught by default */
269 /* 0x0E - User Defined, Caught by default */
270 /* 0x0F - User Defined, Caught by default */
271 /* 0x10 HW Single step, handled here */
273 info.si_code = TRAP_STEP;
275 CHK_DEBUGGER_TRAP_MAYBE();
276 /* Check if this is a single step in kernel space */
277 if (fp->ipend & 0xffc0)
281 /* 0x11 - Trace Buffer Full, handled here */
283 info.si_code = TRAP_TRACEFLOW;
285 printk(KERN_NOTICE EXC_0x11(KERN_NOTICE));
288 /* 0x12 - Reserved, Caught by default */
289 /* 0x13 - Reserved, Caught by default */
290 /* 0x14 - Reserved, Caught by default */
291 /* 0x15 - Reserved, Caught by default */
292 /* 0x16 - Reserved, Caught by default */
293 /* 0x17 - Reserved, Caught by default */
294 /* 0x18 - Reserved, Caught by default */
295 /* 0x19 - Reserved, Caught by default */
296 /* 0x1A - Reserved, Caught by default */
297 /* 0x1B - Reserved, Caught by default */
298 /* 0x1C - Reserved, Caught by default */
299 /* 0x1D - Reserved, Caught by default */
300 /* 0x1E - Reserved, Caught by default */
301 /* 0x1F - Reserved, Caught by default */
302 /* 0x20 - Reserved, Caught by default */
303 /* 0x21 - Undefined Instruction, handled here */
305 info.si_code = ILL_ILLOPC;
307 printk(KERN_NOTICE EXC_0x21(KERN_NOTICE));
310 /* 0x22 - Illegal Instruction Combination, handled here */
312 info.si_code = ILL_ILLPARAOP;
314 printk(KERN_NOTICE EXC_0x22(KERN_NOTICE));
317 /* 0x23 - Data CPLB protection violation, handled here */
319 info.si_code = ILL_CPLB_VI;
321 printk(KERN_NOTICE EXC_0x23(KERN_NOTICE));
324 /* 0x24 - Data access misaligned, handled here */
326 info.si_code = BUS_ADRALN;
328 printk(KERN_NOTICE EXC_0x24(KERN_NOTICE));
331 /* 0x25 - Unrecoverable Event, handled here */
333 info.si_code = ILL_ILLEXCPT;
335 printk(KERN_NOTICE EXC_0x25(KERN_NOTICE));
338 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
339 error case is handled here */
341 info.si_code = BUS_ADRALN;
343 printk(KERN_NOTICE EXC_0x26(KERN_NOTICE));
346 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
348 info.si_code = ILL_CPLB_MULHIT;
349 #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
351 printk(KERN_NOTICE "NULL pointer access (probably)\n");
354 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE));
358 /* 0x28 - Emulation Watchpoint, handled here */
360 info.si_code = TRAP_WATCHPT;
362 pr_debug(EXC_0x28(KERN_DEBUG));
363 CHK_DEBUGGER_TRAP_MAYBE();
364 /* Check if this is a watchpoint in kernel space */
365 if (fp->ipend & 0xffc0)
370 /* 0x29 - Instruction fetch access error (535 only) */
371 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */
372 info.si_code = BUS_OPFETCH;
374 printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n");
378 /* 0x29 - Reserved, Caught by default */
380 /* 0x2A - Instruction fetch misaligned, handled here */
382 info.si_code = BUS_ADRALN;
384 printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE));
387 /* 0x2B - Instruction CPLB protection violation, handled here */
389 info.si_code = ILL_CPLB_VI;
391 printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE));
394 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */
396 info.si_code = ILL_CPLB_MISS;
398 printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE));
401 /* 0x2D - Instruction CPLB Multiple Hits, handled here */
402 case VEC_CPLB_I_MHIT:
403 info.si_code = ILL_CPLB_MULHIT;
404 #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
406 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n");
409 printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE));
413 /* 0x2E - Illegal use of Supervisor Resource, handled here */
415 info.si_code = ILL_PRVOPC;
417 printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE));
420 /* 0x2F - Reserved, Caught by default */
421 /* 0x30 - Reserved, Caught by default */
422 /* 0x31 - Reserved, Caught by default */
423 /* 0x32 - Reserved, Caught by default */
424 /* 0x33 - Reserved, Caught by default */
425 /* 0x34 - Reserved, Caught by default */
426 /* 0x35 - Reserved, Caught by default */
427 /* 0x36 - Reserved, Caught by default */
428 /* 0x37 - Reserved, Caught by default */
429 /* 0x38 - Reserved, Caught by default */
430 /* 0x39 - Reserved, Caught by default */
431 /* 0x3A - Reserved, Caught by default */
432 /* 0x3B - Reserved, Caught by default */
433 /* 0x3C - Reserved, Caught by default */
434 /* 0x3D - Reserved, Caught by default */
435 /* 0x3E - Reserved, Caught by default */
436 /* 0x3F - Reserved, Caught by default */
438 info.si_code = BUS_ADRALN;
440 switch (fp->seqstat & SEQSTAT_HWERRCAUSE) {
441 /* System MMR Error */
442 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR):
443 info.si_code = BUS_ADRALN;
445 printk(KERN_NOTICE HWC_x2(KERN_NOTICE));
447 /* External Memory Addressing Error */
448 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR):
449 info.si_code = BUS_ADRERR;
451 printk(KERN_NOTICE HWC_x3(KERN_NOTICE));
453 /* Performance Monitor Overflow */
454 case (SEQSTAT_HWERRCAUSE_PERF_FLOW):
455 printk(KERN_NOTICE HWC_x12(KERN_NOTICE));
457 /* RAISE 5 instruction */
458 case (SEQSTAT_HWERRCAUSE_RAISE_5):
459 printk(KERN_NOTICE HWC_x18(KERN_NOTICE));
461 default: /* Reserved */
462 printk(KERN_NOTICE HWC_default(KERN_NOTICE));
468 info.si_code = TRAP_ILLTRAP;
470 printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n",
471 (fp->seqstat & SEQSTAT_EXCAUSE));
478 if (sig != SIGTRAP) {
480 dump_bfin_process(fp);
481 /* Is it an interrupt, or an exception? */
482 if (trapnr == VEC_HWERR)
483 dump_bfin_mem((void *)fp->pc);
485 dump_bfin_mem((void *)fp->retx);
488 /* Print out the trace buffer if it makes sense */
489 #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
490 if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M)
491 printk(KERN_NOTICE "No trace since you do not have "
492 "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n"
496 dump_bfin_trace_buffer();
497 show_stack(current, &stack);
498 if (oops_in_progress) {
499 #ifndef CONFIG_ACCESS_CHECK
500 printk(KERN_EMERG "Please turn on "
501 "CONFIG_ACCESS_CHECK\n");
503 panic("Kernel exception");
509 info.si_addr = (void *)fp->pc;
510 force_sig_info(sig, &info, current);
512 trace_buffer_restore(j);
516 /* Typical exception handling routines */
518 #define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1)
520 void dump_bfin_trace_buffer(void)
522 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
525 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
529 trace_buffer_save(tflags);
531 printk(KERN_NOTICE "Hardware Trace:\n");
533 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) {
534 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
535 decode_address(buf, (unsigned long)bfin_read_TBUF());
536 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
537 decode_address(buf, (unsigned long)bfin_read_TBUF());
538 printk(KERN_NOTICE " Source : %s\n", buf);
542 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
543 if (trace_buff_offset)
544 index = trace_buff_offset/4 - 1;
548 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128;
550 decode_address(buf, software_trace_buff[index]);
551 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
555 decode_address(buf, software_trace_buff[index]);
556 printk(KERN_NOTICE " Source : %s\n", buf);
565 trace_buffer_restore(tflags);
568 EXPORT_SYMBOL(dump_bfin_trace_buffer);
570 static void show_trace(struct task_struct *tsk, unsigned long *sp)
574 printk(KERN_NOTICE "\n" KERN_NOTICE "Call Trace:\n");
576 while (!kstack_end(sp)) {
579 * If the address is either in the text segment of the
580 * kernel, or in the region which contains vmalloc'ed
581 * memory, it *may* be the address of a calling
582 * routine; if so, print it so that someone tracing
583 * down the cause of the crash will be able to figure
584 * out the call path that was taken.
586 if (kernel_text_address(addr))
590 printk(KERN_NOTICE "\n");
593 void show_stack(struct task_struct *task, unsigned long *stack)
595 unsigned long *endstack, addr;
598 /* Cannot call dump_bfin_trace_buffer() here as show_stack() is
599 * called externally in some places in the kernel.
604 stack = (unsigned long *)task->thread.ksp;
606 stack = (unsigned long *)&stack;
609 addr = (unsigned long)stack;
610 endstack = (unsigned long *)PAGE_ALIGN(addr);
612 printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack);
613 for (i = 0; i < kstack_depth_to_print; i++) {
614 if (stack + 1 > endstack)
617 printk("\n" KERN_NOTICE " ");
618 printk(" %08lx", *stack++);
622 show_trace(task, stack);
625 void dump_stack(void)
628 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
631 trace_buffer_save(tflags);
632 dump_bfin_trace_buffer();
633 show_stack(current, &stack);
634 trace_buffer_restore(tflags);
636 EXPORT_SYMBOL(dump_stack);
638 void dump_bfin_process(struct pt_regs *fp)
640 /* We should be able to look at fp->ipend, but we don't push it on the
641 * stack all the time, so do this until we fix that */
642 unsigned int context = bfin_read_IPEND();
644 if (oops_in_progress)
645 printk(KERN_EMERG "Kernel OOPS in progress\n");
647 if (context & 0x0020)
648 printk(KERN_NOTICE "Deferred excecption or HW Error context\n");
649 else if (context & 0x3FC0)
650 printk(KERN_NOTICE "Interrupt context\n");
651 else if (context & 0x4000)
652 printk(KERN_NOTICE "Deferred Interrupt context\n");
653 else if (context & 0x8000)
654 printk(KERN_NOTICE "Kernel process context\n");
656 if (current->pid && current->mm) {
657 printk(KERN_NOTICE "CURRENT PROCESS:\n");
658 printk(KERN_NOTICE "COMM=%s PID=%d\n",
659 current->comm, current->pid);
661 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
662 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
664 (void *)current->mm->start_code,
665 (void *)current->mm->end_code,
666 (void *)current->mm->start_data,
667 (void *)current->mm->end_data,
668 (void *)current->mm->end_data,
669 (void *)current->mm->brk,
670 (void *)current->mm->start_stack);
672 printk(KERN_NOTICE "\n" KERN_NOTICE
673 "No Valid process in current context\n");
676 void dump_bfin_mem(void *retaddr)
679 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end
680 #if L1_CODE_LENGTH != 0
681 /* FIXME: Copy the code out of L1 Instruction SRAM through dma
683 && !(retaddr >= (void *)L1_CODE_START
684 && retaddr < (void *)(L1_CODE_START + L1_CODE_LENGTH))
687 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32;
688 unsigned short x = 0;
689 printk(KERN_NOTICE "return address: [0x%p]; contents of:", retaddr);
690 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) {
692 printk("\n" KERN_NOTICE "0x%08x: ", i);
694 if (get_user(x, (unsigned short *)i))
696 #ifndef CONFIG_DEBUG_HWERR
697 /* If one of the last few instructions was a STI
698 * it is likely that the error occured awhile ago
699 * and we just noticed. This only happens in kernel
700 * context, which should mean an oops is happening
702 if (oops_in_progress && x >= 0x0040 && x <= 0x0047 && i <= 0)
703 printk(KERN_EMERG "\n"
704 KERN_EMERG "WARNING : You should reconfigure"
705 " the kernel to turn on\n"
706 KERN_EMERG " 'Hardware error interrupt debugging'\n"
707 KERN_EMERG " The rest of this error is meanless\n");
709 if (i == (unsigned int)retaddr)
716 printk("\n" KERN_NOTICE
717 "Cannot look at the [PC] <%p> for it is"
718 " in unreadable memory - sorry\n", retaddr);
721 void show_regs(struct pt_regs *fp)
724 struct irqaction *action;
728 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
729 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
730 (long)fp->seqstat, fp->ipend, fp->syscfg);
731 printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n",
732 (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14);
733 printk(KERN_NOTICE " EXCAUSE : 0x%lx\n",
734 fp->seqstat & SEQSTAT_EXCAUSE);
735 for (i = 6; i <= 15 ; i++) {
736 if (fp->ipend & (1 << i)) {
737 decode_address(buf, bfin_read32(EVT0 + 4*i));
738 printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf);
742 /* if no interrupts are going off, don't print this out */
743 if (fp->ipend & ~0x3F) {
744 for (i = 0; i < (NR_IRQS - 1); i++) {
745 spin_lock_irqsave(&irq_desc[i].lock, flags);
746 action = irq_desc[i].action;
750 decode_address(buf, (unsigned int)action->handler);
751 printk(KERN_NOTICE " logical irq %3d mapped : %s", i, buf);
752 for (action = action->next; action; action = action->next) {
753 decode_address(buf, (unsigned int)action->handler);
758 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
762 decode_address(buf, fp->rete);
763 printk(KERN_NOTICE " RETE: %s\n", buf);
764 decode_address(buf, fp->retn);
765 printk(KERN_NOTICE " RETN: %s\n", buf);
766 decode_address(buf, fp->retx);
767 printk(KERN_NOTICE " RETX: %s\n", buf);
768 decode_address(buf, fp->rets);
769 printk(KERN_NOTICE " RETS: %s\n", buf);
770 decode_address(buf, fp->pc);
771 printk(KERN_NOTICE " PC : %s\n", buf);
773 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) &&
774 (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) {
775 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
776 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
777 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR());
778 printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf);
781 printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n");
782 printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
783 fp->r0, fp->r1, fp->r2, fp->r3);
784 printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
785 fp->r4, fp->r5, fp->r6, fp->r7);
786 printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n",
787 fp->p0, fp->p1, fp->p2, fp->p3);
788 printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n",
789 fp->p4, fp->p5, fp->fp, (long)fp);
790 printk(KERN_NOTICE " LB0: %08lx LT0: %08lx LC0: %08lx\n",
791 fp->lb0, fp->lt0, fp->lc0);
792 printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n",
793 fp->lb1, fp->lt1, fp->lc1);
794 printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n",
795 fp->b0, fp->l0, fp->m0, fp->i0);
796 printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n",
797 fp->b1, fp->l1, fp->m1, fp->i1);
798 printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n",
799 fp->b2, fp->l2, fp->m2, fp->i2);
800 printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n",
801 fp->b3, fp->l3, fp->m3, fp->i3);
802 printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
803 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
805 printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n",
808 printk(KERN_NOTICE "\n");
811 #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
812 asmlinkage int sys_bfin_spinlock(int *spinlock)__attribute__((l1_text));
815 asmlinkage int sys_bfin_spinlock(int *spinlock)
821 ret = get_user(tmp, spinlock);
826 put_user(tmp, spinlock);
832 int bfin_request_exception(unsigned int exception, void (*handler)(void))
834 void (*curr_handler)(void);
836 if (exception > 0x3F)
839 curr_handler = ex_table[exception];
841 if (curr_handler != ex_replaceable)
844 ex_table[exception] = handler;
848 EXPORT_SYMBOL(bfin_request_exception);
850 int bfin_free_exception(unsigned int exception, void (*handler)(void))
852 void (*curr_handler)(void);
854 if (exception > 0x3F)
857 curr_handler = ex_table[exception];
859 if (curr_handler != handler)
862 ex_table[exception] = ex_replaceable;
866 EXPORT_SYMBOL(bfin_free_exception);
868 void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
870 switch (cplb_panic) {
871 case CPLB_NO_UNLOCKED:
872 printk(KERN_EMERG "All CPLBs are locked\n");
876 case CPLB_NO_ADDR_MATCH:
878 case CPLB_UNKNOWN_ERR:
879 printk(KERN_EMERG "Unknown CPLB Exception\n");
883 oops_in_progress = 1;
885 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
886 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
887 dump_bfin_process(fp);
888 dump_bfin_mem((void *)fp->retx);
891 panic("Unrecoverable event\n");