void show_regs(struct pt_regs *fp) { #ifdef CONFIG_DEBUG_VERBOSE char buf [150]; struct irqaction *action; unsigned int i; unsigned long flags = 0; unsigned int cpu = smp_processor_id(); unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", (long)fp->seqstat, fp->ipend, fp->syscfg); if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) { verbose_printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n", (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14); #ifdef EBIU_ERRMST /* If the error was from the EBIU, print it out */ if (bfin_read_EBIU_ERRMST() & CORE_ERROR) { verbose_printk(KERN_NOTICE " EBIU Error Reason : 0x%04x\n", bfin_read_EBIU_ERRMST()); verbose_printk(KERN_NOTICE " EBIU Error Address : 0x%08x\n", bfin_read_EBIU_ERRADD()); } #endif }
asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs) { struct pt_regs *old_regs; struct irq_desc *desc = irq_desc + irq; unsigned short pending, other_ints; old_regs = set_irq_regs(regs); /* * Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ if (irq >= NR_IRQS) desc = &bad_irq_desc; irq_enter(); generic_handle_irq(irq); /* If we're the only interrupt running (ignoring IRQ15 which is for syscalls), lower our priority to IRQ14 so that softirqs run at that level. If there's another, lower-level interrupt, irq_exit will defer softirqs to that. */ CSYNC(); pending = bfin_read_IPEND() & ~0x8000; other_ints = pending & (pending - 1); if (other_ints == 0) lower_to_irq14(); irq_exit(); set_irq_regs(old_regs); }
void show_regs(struct pt_regs *fp) { char buf[150]; struct irqaction *action; unsigned int i; unsigned long flags = 0; unsigned int cpu = raw_smp_processor_id(); unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); pr_notice("\n"); if (CPUID != bfin_cpuid()) pr_notice("Compiled for cpu family 0x%04x (Rev %d), " "but running on:0x%04x (Rev %d)\n", CPUID, bfin_compiled_revid(), bfin_cpuid(), bfin_revid()); pr_notice("ADSP-%s-0.%d", CPU, bfin_compiled_revid()); if (bfin_compiled_revid() != bfin_revid()) pr_cont("(Detected 0.%d)", bfin_revid()); pr_cont(" %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n", get_cclk()/1000000, get_sclk()/1000000, #ifdef CONFIG_MPU "mpu on" #else "mpu off" #endif ); if(board_rom_type()) pr_notice("%s", linux_banner_stockui); else pr_notice("%s", linux_banner); pr_notice("\nSEQUENCER STATUS:\t\t%s\n", print_tainted()); pr_notice(" SEQSTAT: %08lx IPEND: %04lx IMASK: %04lx SYSCFG: %04lx\n", (long)fp->seqstat, fp->ipend, cpu_pda[raw_smp_processor_id()].ex_imask, fp->syscfg); if (fp->ipend & EVT_IRPTEN) pr_notice(" Global Interrupts Disabled (IPEND[4])\n"); if (!(cpu_pda[raw_smp_processor_id()].ex_imask & (EVT_IVG13 | EVT_IVG12 | EVT_IVG11 | EVT_IVG10 | EVT_IVG9 | EVT_IVG8 | EVT_IVG7 | EVT_IVTMR))) pr_notice(" Peripheral interrupts masked off\n"); if (!(cpu_pda[raw_smp_processor_id()].ex_imask & (EVT_IVG15 | EVT_IVG14))) pr_notice(" Kernel interrupts masked off\n"); if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) { pr_notice(" HWERRCAUSE: 0x%lx\n", (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14); #ifdef EBIU_ERRMST if (bfin_read_EBIU_ERRMST() & CORE_ERROR) { pr_notice(" EBIU Error Reason : 0x%04x\n", bfin_read_EBIU_ERRMST()); pr_notice(" EBIU Error Address : 0x%08x\n", bfin_read_EBIU_ERRADD()); } #endif }
static int get_kernel(void) { int ipend, is_kernel; ipend = bfin_read_IPEND(); /* test bit 15 */ is_kernel = ((ipend & 0x8000) != 0); return is_kernel; }
asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs) { struct pt_regs *old_regs; struct irq_desc *desc = irq_desc + irq; #ifndef CONFIG_IPIPE unsigned short pending, other_ints; #endif old_regs = set_irq_regs(regs); /* * Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ if (irq >= NR_IRQS) desc = &bad_irq_desc; irq_enter(); #ifdef CONFIG_DEBUG_STACKOVERFLOW /* Debugging check for stack overflow: is there less than STACK_WARN free? */ { long sp; sp = __get_SP() & (THREAD_SIZE-1); if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { dump_stack(); printk(KERN_EMERG "%s: possible stack overflow while handling irq %i " " only %ld bytes free\n", __func__, irq, sp - sizeof(struct thread_info)); } } #endif generic_handle_irq(irq); #ifndef CONFIG_IPIPE /* * If we're the only interrupt running (ignoring IRQ15 which * is for syscalls), lower our priority to IRQ14 so that * softirqs run at that level. If there's another, * lower-level interrupt, irq_exit will defer softirqs to * that. If the interrupt pipeline is enabled, we are already * running at IRQ14 priority, so we don't need this code. */ CSYNC(); pending = bfin_read_IPEND() & ~0x8000; other_ints = pending & (pending - 1); if (other_ints == 0) lower_to_irq14(); #endif /* !CONFIG_IPIPE */ irq_exit(); set_irq_regs(old_regs); }
void dump_bfin_process(struct pt_regs *fp) { #ifdef CONFIG_DEBUG_VERBOSE /* We should be able to look at fp->ipend, but we don't push it on the * stack all the time, so do this until we fix that */ unsigned int context = bfin_read_IPEND(); if (oops_in_progress) verbose_printk(KERN_EMERG "Kernel OOPS in progress\n"); if (context & 0x0020 && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) verbose_printk(KERN_NOTICE "HW Error context\n"); else if (context & 0x0020) verbose_printk(KERN_NOTICE "Deferred Exception context\n"); else if (context & 0x3FC0) verbose_printk(KERN_NOTICE "Interrupt context\n"); else if (context & 0x4000) verbose_printk(KERN_NOTICE "Deferred Interrupt context\n"); else if (context & 0x8000) verbose_printk(KERN_NOTICE "Kernel process context\n"); /* Because we are crashing, and pointers could be bad, we check things * pretty closely before we use them */ if ((unsigned long)current >= FIXED_CODE_START && !((unsigned long)current & 0x3) && current->pid) { verbose_printk(KERN_NOTICE "CURRENT PROCESS:\n"); if (current->comm >= (char *)FIXED_CODE_START) verbose_printk(KERN_NOTICE "COMM=%s PID=%d\n", current->comm, current->pid); else verbose_printk(KERN_NOTICE "COMM= invalid\n"); printk(KERN_NOTICE "CPU = %d\n", current_thread_info()->cpu); if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) verbose_printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n" KERN_NOTICE "\n", (void *)current->mm->start_code, (void *)current->mm->end_code, (void *)current->mm->start_data, (void *)current->mm->end_data, (void *)current->mm->end_data, (void *)current->mm->brk, (void *)current->mm->start_stack); else verbose_printk(KERN_NOTICE "invalid mm\n"); } else verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "No Valid process in current context\n"); #endif }
static void maybe_lower_to_irq14(void) { unsigned short pending, other_ints; /* * If we're the only interrupt running (ignoring IRQ15 which * is for syscalls), lower our priority to IRQ14 so that * softirqs run at that level. If there's another, * lower-level interrupt, irq_exit will defer softirqs to * that. If the interrupt pipeline is enabled, we are already * running at IRQ14 priority, so we don't need this code. */ CSYNC(); pending = bfin_read_IPEND() & ~0x8000; other_ints = pending & (pending - 1); if (other_ints == 0) lower_to_irq14(); }
void dump_bfin_process(struct pt_regs *fp) { unsigned int context = bfin_read_IPEND(); if (oops_in_progress) pr_emerg("Kernel OOPS in progress\n"); if (context & 0x0020 && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) pr_notice("HW Error context\n"); else if (context & 0x0020) pr_notice("Deferred Exception context\n"); else if (context & 0x3FC0) pr_notice("Interrupt context\n"); else if (context & 0x4000) pr_notice("Deferred Interrupt context\n"); else if (context & 0x8000) pr_notice("Kernel process context\n"); if ((unsigned long)current >= FIXED_CODE_START && !((unsigned long)current & 0x3) && current->pid) { pr_notice("CURRENT PROCESS:\n"); if (current->comm >= (char *)FIXED_CODE_START) pr_notice("COMM=%s PID=%d", current->comm, current->pid); else pr_notice("COMM= invalid"); pr_cont(" CPU=%d\n", current_thread_info()->cpu); if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) { pr_notice("TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n", (void *)current->mm->start_code, (void *)current->mm->end_code, (void *)current->mm->start_data, (void *)current->mm->end_data); pr_notice(" BSS = 0x%p-0x%p USER-STACK = 0x%p\n\n", (void *)current->mm->end_data, (void *)current->mm->brk, (void *)current->mm->start_stack); } else pr_notice("invalid mm\n"); } else pr_notice("No Valid process in current context\n"); }
void dump_bfin_process(struct pt_regs *fp) { /* We should be able to look at fp->ipend, but we don't push it on the * stack all the time, so do this until we fix that */ unsigned int context = bfin_read_IPEND(); if (oops_in_progress) printk(KERN_EMERG "Kernel OOPS in progress\n"); if (context & 0x0020) printk(KERN_NOTICE "Deferred excecption or HW Error context\n"); else if (context & 0x3FC0) printk(KERN_NOTICE "Interrupt context\n"); else if (context & 0x4000) printk(KERN_NOTICE "Deferred Interrupt context\n"); else if (context & 0x8000) printk(KERN_NOTICE "Kernel process context\n"); if (current->pid && current->mm) { printk(KERN_NOTICE "CURRENT PROCESS:\n"); printk(KERN_NOTICE "COMM=%s PID=%d\n", current->comm, current->pid); printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" KERN_NOTICE "\n", (void *)current->mm->start_code, (void *)current->mm->end_code, (void *)current->mm->start_data, (void *)current->mm->end_data, (void *)current->mm->end_data, (void *)current->mm->brk, (void *)current->mm->start_stack); } else printk(KERN_NOTICE "\n" KERN_NOTICE "No Valid process in current context\n"); }
static void decode_address(char *buf, unsigned long address) { struct vm_list_struct *vml; struct task_struct *p; struct mm_struct *mm; unsigned long flags, offset; unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); #ifdef CONFIG_KALLSYMS unsigned long symsize; const char *symname; char *modname; char *delim = ":"; char namebuf[128]; /* look up the address and see if we are in kernel space */ symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf); if (symname) { /* yeah! kernel space! */ if (!modname) modname = delim = ""; sprintf(buf, "<0x%p> { %s%s%s%s + 0x%lx }", (void *)address, delim, modname, delim, symname, (unsigned long)offset); return; } #endif /* Problem in fixed code section? */ if (address >= FIXED_CODE_START && address < FIXED_CODE_END) { sprintf(buf, "<0x%p> /* Maybe fixed code section */", (void *)address); return; } /* Problem somewhere before the kernel start address */ if (address < CONFIG_BOOT_LOAD) { sprintf(buf, "<0x%p> /* Maybe null pointer? */", (void *)address); return; } /* looks like we're off in user-land, so let's walk all the * mappings of all our processes and see if we can't be a whee * bit more specific */ write_lock_irqsave(&tasklist_lock, flags); for_each_process(p) { mm = (in_atomic ? p->mm : get_task_mm(p)); if (!mm) continue; vml = mm->context.vmlist; while (vml) { struct vm_area_struct *vma = vml->vma; if (address >= vma->vm_start && address < vma->vm_end) { char _tmpbuf[256]; char *name = p->comm; struct file *file = vma->vm_file; if (file) name = d_path(&file->f_path, _tmpbuf, sizeof(_tmpbuf)); /* FLAT does not have its text aligned to the start of * the map while FDPIC ELF does ... */ /* before we can check flat/fdpic, we need to * make sure current is valid */ if ((unsigned long)current >= FIXED_CODE_START && !((unsigned long)current & 0x3)) { if (current->mm && (address > current->mm->start_code) && (address < current->mm->end_code)) offset = address - current->mm->start_code; else offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); sprintf(buf, "<0x%p> [ %s + 0x%lx ]", (void *)address, name, offset); } else sprintf(buf, "<0x%p> [ %s vma:0x%lx-0x%lx]", (void *)address, name, vma->vm_start, vma->vm_end); if (!in_atomic) mmput(mm); if (!strlen(buf)) sprintf(buf, "<0x%p> [ %s ] dynamic memory", (void *)address, name); goto done; } vml = vml->next; } if (!in_atomic) mmput(mm); } /* we were unable to find this address anywhere */ sprintf(buf, "<0x%p> /* kernel dynamic memory */", (void *)address); done: write_unlock_irqrestore(&tasklist_lock, flags); }
asmlinkage void trap_c(struct pt_regs *fp) { #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON int j; #endif int sig = 0; siginfo_t info; unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE; trace_buffer_save(j); /* Important - be very careful dereferncing pointers - will lead to * double faults if the stack has become corrupt */ /* If the fault was caused by a kernel thread, or interrupt handler * we will kernel panic, so the system reboots. * If KGDB is enabled, don't set this for kernel breakpoints */ /* TODO: check to see if we are in some sort of deferred HWERR * that we should be able to recover from, not kernel panic */ if ((bfin_read_IPEND() & 0xFFC0) && (trapnr != VEC_STEP) #ifdef CONFIG_KGDB && (trapnr != VEC_EXCPT02) #endif ) { console_verbose(); oops_in_progress = 1; } else if (current) { if (current->mm == NULL) { console_verbose(); oops_in_progress = 1; } } /* trap_c() will be called for exceptions. During exceptions * processing, the pc value should be set with retx value. * With this change we can cleanup some code in signal.c- TODO */ fp->orig_pc = fp->retx; /* printk("exception: 0x%x, ipend=%x, reti=%x, retx=%x\n", trapnr, fp->ipend, fp->pc, fp->retx); */ /* send the appropriate signal to the user program */ switch (trapnr) { /* This table works in conjuction with the one in ./mach-common/entry.S * Some exceptions are handled there (in assembly, in exception space) * Some are handled here, (in C, in interrupt space) * Some, like CPLB, are handled in both, where the normal path is * handled in assembly/exception space, and the error path is handled * here */ /* 0x00 - Linux Syscall, getting here is an error */ /* 0x01 - userspace gdb breakpoint, handled here */ case VEC_EXCPT01: info.si_code = TRAP_ILLTRAP; sig = SIGTRAP; CHK_DEBUGGER_TRAP_MAYBE(); /* Check if this is a breakpoint in kernel space */ if (fp->ipend & 0xffc0) return; else break; #ifdef CONFIG_KGDB case VEC_EXCPT02 : /* gdb connection */ info.si_code = TRAP_ILLTRAP; sig = SIGTRAP; CHK_DEBUGGER_TRAP(); return; #else /* 0x02 - User Defined, Caught by default */ #endif /* 0x03 - User Defined, userspace stack overflow */ case VEC_EXCPT03: info.si_code = SEGV_STACKFLOW; sig = SIGSEGV; printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x04 - User Defined, Caught by default */ /* 0x05 - User Defined, Caught by default */ /* 0x06 - User Defined, Caught by default */ /* 0x07 - User Defined, Caught by default */ /* 0x08 - User Defined, Caught by default */ /* 0x09 - User Defined, Caught by default */ /* 0x0A - User Defined, Caught by default */ /* 0x0B - User Defined, Caught by default */ /* 0x0C - User Defined, Caught by default */ /* 0x0D - User Defined, Caught by default */ /* 0x0E - User Defined, Caught by default */ /* 0x0F - User Defined, Caught by default */ /* 0x10 HW Single step, handled here */ case VEC_STEP: info.si_code = TRAP_STEP; sig = SIGTRAP; CHK_DEBUGGER_TRAP_MAYBE(); /* Check if this is a single step in kernel space */ if (fp->ipend & 0xffc0) return; else break; /* 0x11 - Trace Buffer Full, handled here */ case VEC_OVFLOW: info.si_code = TRAP_TRACEFLOW; sig = SIGTRAP; printk(KERN_NOTICE EXC_0x11(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x12 - Reserved, Caught by default */ /* 0x13 - Reserved, Caught by default */ /* 0x14 - Reserved, Caught by default */ /* 0x15 - Reserved, Caught by default */ /* 0x16 - Reserved, Caught by default */ /* 0x17 - Reserved, Caught by default */ /* 0x18 - Reserved, Caught by default */ /* 0x19 - Reserved, Caught by default */ /* 0x1A - Reserved, Caught by default */ /* 0x1B - Reserved, Caught by default */ /* 0x1C - Reserved, Caught by default */ /* 0x1D - Reserved, Caught by default */ /* 0x1E - Reserved, Caught by default */ /* 0x1F - Reserved, Caught by default */ /* 0x20 - Reserved, Caught by default */ /* 0x21 - Undefined Instruction, handled here */ case VEC_UNDEF_I: info.si_code = ILL_ILLOPC; sig = SIGILL; printk(KERN_NOTICE EXC_0x21(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x22 - Illegal Instruction Combination, handled here */ case VEC_ILGAL_I: info.si_code = ILL_ILLPARAOP; sig = SIGILL; printk(KERN_NOTICE EXC_0x22(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x23 - Data CPLB protection violation, handled here */ case VEC_CPLB_VL: info.si_code = ILL_CPLB_VI; sig = SIGBUS; printk(KERN_NOTICE EXC_0x23(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x24 - Data access misaligned, handled here */ case VEC_MISALI_D: info.si_code = BUS_ADRALN; sig = SIGBUS; printk(KERN_NOTICE EXC_0x24(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x25 - Unrecoverable Event, handled here */ case VEC_UNCOV: info.si_code = ILL_ILLEXCPT; sig = SIGILL; printk(KERN_NOTICE EXC_0x25(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, error case is handled here */ case VEC_CPLB_M: info.si_code = BUS_ADRALN; sig = SIGBUS; printk(KERN_NOTICE EXC_0x26(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ case VEC_CPLB_MHIT: info.si_code = ILL_CPLB_MULHIT; sig = SIGSEGV; #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO if (saved_dcplb_fault_addr < FIXED_CODE_START) printk(KERN_NOTICE "NULL pointer access\n"); else #endif printk(KERN_NOTICE EXC_0x27(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x28 - Emulation Watchpoint, handled here */ case VEC_WATCH: info.si_code = TRAP_WATCHPT; sig = SIGTRAP; pr_debug(EXC_0x28(KERN_DEBUG)); CHK_DEBUGGER_TRAP_MAYBE(); /* Check if this is a watchpoint in kernel space */ if (fp->ipend & 0xffc0) return; else break; #ifdef CONFIG_BF535 /* 0x29 - Instruction fetch access error (535 only) */ case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ info.si_code = BUS_OPFETCH; sig = SIGBUS; printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n"); CHK_DEBUGGER_TRAP(); break; #else /* 0x29 - Reserved, Caught by default */ #endif /* 0x2A - Instruction fetch misaligned, handled here */ case VEC_MISALI_I: info.si_code = BUS_ADRALN; sig = SIGBUS; printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x2B - Instruction CPLB protection violation, handled here */ case VEC_CPLB_I_VL: info.si_code = ILL_CPLB_VI; sig = SIGBUS; printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ case VEC_CPLB_I_M: info.si_code = ILL_CPLB_MISS; sig = SIGBUS; printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x2D - Instruction CPLB Multiple Hits, handled here */ case VEC_CPLB_I_MHIT: info.si_code = ILL_CPLB_MULHIT; sig = SIGSEGV; #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO if (saved_icplb_fault_addr < FIXED_CODE_START) printk(KERN_NOTICE "Jump to NULL address\n"); else #endif printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x2E - Illegal use of Supervisor Resource, handled here */ case VEC_ILL_RES: info.si_code = ILL_PRVOPC; sig = SIGILL; printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE)); CHK_DEBUGGER_TRAP(); break; /* 0x2F - Reserved, Caught by default */ /* 0x30 - Reserved, Caught by default */ /* 0x31 - Reserved, Caught by default */ /* 0x32 - Reserved, Caught by default */ /* 0x33 - Reserved, Caught by default */ /* 0x34 - Reserved, Caught by default */ /* 0x35 - Reserved, Caught by default */ /* 0x36 - Reserved, Caught by default */ /* 0x37 - Reserved, Caught by default */ /* 0x38 - Reserved, Caught by default */ /* 0x39 - Reserved, Caught by default */ /* 0x3A - Reserved, Caught by default */ /* 0x3B - Reserved, Caught by default */ /* 0x3C - Reserved, Caught by default */ /* 0x3D - Reserved, Caught by default */ /* 0x3E - Reserved, Caught by default */ /* 0x3F - Reserved, Caught by default */ case VEC_HWERR: info.si_code = BUS_ADRALN; sig = SIGBUS; switch (fp->seqstat & SEQSTAT_HWERRCAUSE) { /* System MMR Error */ case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): info.si_code = BUS_ADRALN; sig = SIGBUS; printk(KERN_NOTICE HWC_x2(KERN_NOTICE)); break; /* External Memory Addressing Error */ case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): info.si_code = BUS_ADRERR; sig = SIGBUS; printk(KERN_NOTICE HWC_x3(KERN_NOTICE)); break; /* Performance Monitor Overflow */ case (SEQSTAT_HWERRCAUSE_PERF_FLOW): printk(KERN_NOTICE HWC_x12(KERN_NOTICE)); break; /* RAISE 5 instruction */ case (SEQSTAT_HWERRCAUSE_RAISE_5): printk(KERN_NOTICE HWC_x18(KERN_NOTICE)); break; default: /* Reserved */ printk(KERN_NOTICE HWC_default(KERN_NOTICE)); break; } CHK_DEBUGGER_TRAP(); break; default: info.si_code = TRAP_ILLTRAP; sig = SIGTRAP; printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", (fp->seqstat & SEQSTAT_EXCAUSE)); CHK_DEBUGGER_TRAP(); break; } BUG_ON(sig == 0); if (sig != SIGTRAP) { unsigned long *stack; dump_bfin_process(fp); dump_bfin_mem(fp); show_regs(fp); /* Print out the trace buffer if it makes sense */ #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M) printk(KERN_NOTICE "No trace since you do not have " "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n" KERN_NOTICE "\n"); else #endif dump_bfin_trace_buffer(); if (oops_in_progress) { /* Dump the current kernel stack */ printk(KERN_NOTICE "\n" KERN_NOTICE "Kernel Stack\n"); show_stack(current, NULL); print_modules(); #ifndef CONFIG_ACCESS_CHECK printk(KERN_EMERG "Please turn on " "CONFIG_ACCESS_CHECK\n"); #endif panic("Kernel exception"); } else { /* Dump the user space stack */ stack = (unsigned long *)rdusp(); printk(KERN_NOTICE "Userspace Stack\n"); show_stack(NULL, stack); } } info.si_signo = sig; info.si_errno = 0; info.si_addr = (void __user *)fp->pc; force_sig_info(sig, &info, current); trace_buffer_restore(j); return; }
void decode_address(char *buf, unsigned long address) { struct task_struct *p; struct mm_struct *mm; unsigned long flags, offset; unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); struct rb_node *n; #ifdef CONFIG_KALLSYMS unsigned long symsize; const char *symname; char *modname; char *delim = ":"; char namebuf[128]; #endif buf += sprintf(buf, "<0x%08lx> ", address); #ifdef CONFIG_KALLSYMS symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf); if (symname) { if (!modname) modname = delim = ""; sprintf(buf, "{ %s%s%s%s + 0x%lx }", delim, modname, delim, symname, (unsigned long)offset); return; } #endif if (address >= FIXED_CODE_START && address < FIXED_CODE_END) { strcat(buf, "/* Maybe fixed code section */"); return; } else if (address < CONFIG_BOOT_LOAD) { strcat(buf, "/* Maybe null pointer? */"); return; } else if (address >= COREMMR_BASE) { strcat(buf, "/* core mmrs */"); return; } else if (address >= SYSMMR_BASE) { strcat(buf, "/* system mmrs */"); return; } else if (address >= L1_ROM_START && address < L1_ROM_START + L1_ROM_LENGTH) { strcat(buf, "/* on-chip L1 ROM */"); return; } else if (address >= L1_SCRATCH_START && address < L1_SCRATCH_START + L1_SCRATCH_LENGTH) { strcat(buf, "/* on-chip scratchpad */"); return; } else if (address >= physical_mem_end && address < ASYNC_BANK0_BASE) { strcat(buf, "/* unconnected memory */"); return; } else if (address >= ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE && address < BOOT_ROM_START) { strcat(buf, "/* reserved memory */"); return; } else if (address >= L1_DATA_A_START && address < L1_DATA_A_START + L1_DATA_A_LENGTH) { strcat(buf, "/* on-chip Data Bank A */"); return; } else if (address >= L1_DATA_B_START && address < L1_DATA_B_START + L1_DATA_B_LENGTH) { strcat(buf, "/* on-chip Data Bank B */"); return; } if (oops_in_progress) { strcat(buf, "/* kernel dynamic memory (maybe user-space) */"); return; } write_lock_irqsave(&tasklist_lock, flags); for_each_process(p) { mm = (in_atomic ? p->mm : get_task_mm(p)); if (!mm) continue; if (!down_read_trylock(&mm->mmap_sem)) { if (!in_atomic) mmput(mm); continue; } for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { struct vm_area_struct *vma; vma = rb_entry(n, struct vm_area_struct, vm_rb); if (address >= vma->vm_start && address < vma->vm_end) { char _tmpbuf[256]; char *name = p->comm; struct file *file = vma->vm_file; if (file) { char *d_name = d_path(&file->f_path, _tmpbuf, sizeof(_tmpbuf)); if (!IS_ERR(d_name)) name = d_name; } if ((unsigned long)current >= FIXED_CODE_START && !((unsigned long)current & 0x3)) { if (current->mm && (address > current->mm->start_code) && (address < current->mm->end_code)) offset = address - current->mm->start_code; else offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); sprintf(buf, "[ %s + 0x%lx ]", name, offset); } else sprintf(buf, "[ %s vma:0x%lx-0x%lx]", name, vma->vm_start, vma->vm_end); up_read(&mm->mmap_sem); if (!in_atomic) mmput(mm); if (buf[0] == '\0') sprintf(buf, "[ %s ] dynamic memory", name); goto done; } } up_read(&mm->mmap_sem); if (!in_atomic) mmput(mm); } sprintf(buf, "/* kernel dynamic memory */"); done: write_unlock_irqrestore(&tasklist_lock, flags); }