Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 2 | * Main exception handling logic. |
| 3 | * |
| 4 | * Copyright 2004-2010 Analog Devices Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 6 | * Licensed under the GPL-2 or later |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Mike Frysinger | 70f1256 | 2009-06-07 17:18:25 -0400 | [diff] [blame] | 9 | #include <linux/bug.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 10 | #include <linux/uaccess.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 11 | #include <linux/module.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 12 | #include <asm/traps.h> |
Mike Frysinger | f4585a0 | 2008-10-13 14:45:21 +0800 | [diff] [blame] | 13 | #include <asm/cplb.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 14 | #include <asm/blackfin.h> |
| 15 | #include <asm/irq_handler.h> |
Robin Getz | d8f66c8 | 2007-12-24 15:27:56 +0800 | [diff] [blame] | 16 | #include <linux/irq.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 17 | #include <asm/trace.h> |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 18 | #include <asm/fixed_code.h> |
Robin Getz | 6ce3e9c | 2010-03-16 14:40:17 +0000 | [diff] [blame^] | 19 | #include <asm/pseudo_instructions.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 20 | |
| 21 | #ifdef CONFIG_KGDB |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 22 | # include <linux/kgdb.h> |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 23 | |
| 24 | # define CHK_DEBUGGER_TRAP() \ |
| 25 | do { \ |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 26 | kgdb_handle_exception(trapnr, sig, info.si_code, fp); \ |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 27 | } while (0) |
| 28 | # define CHK_DEBUGGER_TRAP_MAYBE() \ |
| 29 | do { \ |
| 30 | if (kgdb_connected) \ |
| 31 | CHK_DEBUGGER_TRAP(); \ |
| 32 | } while (0) |
| 33 | #else |
| 34 | # define CHK_DEBUGGER_TRAP() do { } while (0) |
| 35 | # define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 36 | #endif |
| 37 | |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 38 | |
Robin Getz | 4ee1c45 | 2008-10-28 11:36:11 +0800 | [diff] [blame] | 39 | #ifdef CONFIG_DEBUG_VERBOSE |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 40 | #define verbose_printk(fmt, arg...) \ |
| 41 | printk(fmt, ##arg) |
| 42 | #else |
| 43 | #define verbose_printk(fmt, arg...) \ |
| 44 | ({ if (0) printk(fmt, ##arg); 0; }) |
| 45 | #endif |
| 46 | |
Robin Getz | 81f7f45 | 2009-06-03 18:58:26 +0000 | [diff] [blame] | 47 | #if defined(CONFIG_DEBUG_MMRS) || defined(CONFIG_DEBUG_MMRS_MODULE) |
| 48 | u32 last_seqstat; |
| 49 | #ifdef CONFIG_DEBUG_MMRS_MODULE |
| 50 | EXPORT_SYMBOL(last_seqstat); |
| 51 | #endif |
| 52 | #endif |
| 53 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 54 | /* Initiate the event table handler */ |
| 55 | void __init trap_init(void) |
| 56 | { |
| 57 | CSYNC(); |
| 58 | bfin_write_EVT3(trap); |
| 59 | CSYNC(); |
| 60 | } |
| 61 | |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 62 | static int kernel_mode_regs(struct pt_regs *regs) |
| 63 | { |
| 64 | return regs->ipend & 0xffc0; |
| 65 | } |
| 66 | |
Yi Li | c4baebf | 2009-08-12 23:05:35 +0000 | [diff] [blame] | 67 | asmlinkage notrace void trap_c(struct pt_regs *fp) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 68 | { |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 69 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
| 70 | int j; |
| 71 | #endif |
Robin Getz | 6ce3e9c | 2010-03-16 14:40:17 +0000 | [diff] [blame^] | 72 | #ifdef CONFIG_BFIN_PSEUDODBG_INSNS |
| 73 | int opcode; |
| 74 | #endif |
Yi Li | b6dbde2 | 2009-08-20 04:17:47 +0000 | [diff] [blame] | 75 | unsigned int cpu = raw_smp_processor_id(); |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 76 | const char *strerror = NULL; |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 77 | int sig = 0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 78 | siginfo_t info; |
| 79 | unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE; |
| 80 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 81 | trace_buffer_save(j); |
Robin Getz | 81f7f45 | 2009-06-03 18:58:26 +0000 | [diff] [blame] | 82 | #if defined(CONFIG_DEBUG_MMRS) || defined(CONFIG_DEBUG_MMRS_MODULE) |
| 83 | last_seqstat = (u32)fp->seqstat; |
| 84 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 85 | |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 86 | /* Important - be very careful dereferncing pointers - will lead to |
| 87 | * double faults if the stack has become corrupt |
| 88 | */ |
| 89 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 90 | /* trap_c() will be called for exceptions. During exceptions |
| 91 | * processing, the pc value should be set with retx value. |
| 92 | * With this change we can cleanup some code in signal.c- TODO |
| 93 | */ |
| 94 | fp->orig_pc = fp->retx; |
| 95 | /* printk("exception: 0x%x, ipend=%x, reti=%x, retx=%x\n", |
| 96 | trapnr, fp->ipend, fp->pc, fp->retx); */ |
| 97 | |
| 98 | /* send the appropriate signal to the user program */ |
| 99 | switch (trapnr) { |
| 100 | |
| 101 | /* This table works in conjuction with the one in ./mach-common/entry.S |
| 102 | * Some exceptions are handled there (in assembly, in exception space) |
| 103 | * Some are handled here, (in C, in interrupt space) |
| 104 | * Some, like CPLB, are handled in both, where the normal path is |
| 105 | * handled in assembly/exception space, and the error path is handled |
| 106 | * here |
| 107 | */ |
| 108 | |
| 109 | /* 0x00 - Linux Syscall, getting here is an error */ |
| 110 | /* 0x01 - userspace gdb breakpoint, handled here */ |
| 111 | case VEC_EXCPT01: |
| 112 | info.si_code = TRAP_ILLTRAP; |
| 113 | sig = SIGTRAP; |
| 114 | CHK_DEBUGGER_TRAP_MAYBE(); |
| 115 | /* Check if this is a breakpoint in kernel space */ |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 116 | if (kernel_mode_regs(fp)) |
Mike Frysinger | 6510a20 | 2009-06-07 15:07:25 -0400 | [diff] [blame] | 117 | goto traps_done; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 118 | else |
| 119 | break; |
Mike Frysinger | 9401e61 | 2007-07-12 11:50:43 +0800 | [diff] [blame] | 120 | /* 0x03 - User Defined, userspace stack overflow */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 121 | case VEC_EXCPT03: |
| 122 | info.si_code = SEGV_STACKFLOW; |
| 123 | sig = SIGSEGV; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 124 | strerror = KERN_NOTICE EXC_0x03(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 125 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 126 | break; |
Sonic Zhang | 27707d3 | 2008-10-09 14:04:41 +0800 | [diff] [blame] | 127 | /* 0x02 - KGDB initial connection and break signal trap */ |
| 128 | case VEC_EXCPT02: |
| 129 | #ifdef CONFIG_KGDB |
| 130 | info.si_code = TRAP_ILLTRAP; |
| 131 | sig = SIGTRAP; |
| 132 | CHK_DEBUGGER_TRAP(); |
Mike Frysinger | 6510a20 | 2009-06-07 15:07:25 -0400 | [diff] [blame] | 133 | goto traps_done; |
Sonic Zhang | 27707d3 | 2008-10-09 14:04:41 +0800 | [diff] [blame] | 134 | #endif |
Robin Getz | 5c64e0d | 2008-10-08 14:43:47 +0800 | [diff] [blame] | 135 | /* 0x04 - User Defined */ |
| 136 | /* 0x05 - User Defined */ |
| 137 | /* 0x06 - User Defined */ |
| 138 | /* 0x07 - User Defined */ |
| 139 | /* 0x08 - User Defined */ |
| 140 | /* 0x09 - User Defined */ |
| 141 | /* 0x0A - User Defined */ |
| 142 | /* 0x0B - User Defined */ |
| 143 | /* 0x0C - User Defined */ |
| 144 | /* 0x0D - User Defined */ |
| 145 | /* 0x0E - User Defined */ |
| 146 | /* 0x0F - User Defined */ |
Sonic Zhang | 27707d3 | 2008-10-09 14:04:41 +0800 | [diff] [blame] | 147 | /* If we got here, it is most likely that someone was trying to use a |
Robin Getz | 5c64e0d | 2008-10-08 14:43:47 +0800 | [diff] [blame] | 148 | * custom exception handler, and it is not actually installed properly |
| 149 | */ |
| 150 | case VEC_EXCPT04 ... VEC_EXCPT15: |
| 151 | info.si_code = ILL_ILLPARAOP; |
| 152 | sig = SIGILL; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 153 | strerror = KERN_NOTICE EXC_0x04(KERN_NOTICE); |
Robin Getz | 5c64e0d | 2008-10-08 14:43:47 +0800 | [diff] [blame] | 154 | CHK_DEBUGGER_TRAP_MAYBE(); |
| 155 | break; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 156 | /* 0x10 HW Single step, handled here */ |
| 157 | case VEC_STEP: |
| 158 | info.si_code = TRAP_STEP; |
| 159 | sig = SIGTRAP; |
| 160 | CHK_DEBUGGER_TRAP_MAYBE(); |
| 161 | /* Check if this is a single step in kernel space */ |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 162 | if (kernel_mode_regs(fp)) |
Mike Frysinger | 6510a20 | 2009-06-07 15:07:25 -0400 | [diff] [blame] | 163 | goto traps_done; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 164 | else |
| 165 | break; |
| 166 | /* 0x11 - Trace Buffer Full, handled here */ |
| 167 | case VEC_OVFLOW: |
| 168 | info.si_code = TRAP_TRACEFLOW; |
| 169 | sig = SIGTRAP; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 170 | strerror = KERN_NOTICE EXC_0x11(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 171 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 172 | break; |
| 173 | /* 0x12 - Reserved, Caught by default */ |
| 174 | /* 0x13 - Reserved, Caught by default */ |
| 175 | /* 0x14 - Reserved, Caught by default */ |
| 176 | /* 0x15 - Reserved, Caught by default */ |
| 177 | /* 0x16 - Reserved, Caught by default */ |
| 178 | /* 0x17 - Reserved, Caught by default */ |
| 179 | /* 0x18 - Reserved, Caught by default */ |
| 180 | /* 0x19 - Reserved, Caught by default */ |
| 181 | /* 0x1A - Reserved, Caught by default */ |
| 182 | /* 0x1B - Reserved, Caught by default */ |
| 183 | /* 0x1C - Reserved, Caught by default */ |
| 184 | /* 0x1D - Reserved, Caught by default */ |
| 185 | /* 0x1E - Reserved, Caught by default */ |
| 186 | /* 0x1F - Reserved, Caught by default */ |
| 187 | /* 0x20 - Reserved, Caught by default */ |
| 188 | /* 0x21 - Undefined Instruction, handled here */ |
| 189 | case VEC_UNDEF_I: |
Mike Frysinger | 70f1256 | 2009-06-07 17:18:25 -0400 | [diff] [blame] | 190 | #ifdef CONFIG_BUG |
| 191 | if (kernel_mode_regs(fp)) { |
| 192 | switch (report_bug(fp->pc, fp)) { |
| 193 | case BUG_TRAP_TYPE_NONE: |
| 194 | break; |
| 195 | case BUG_TRAP_TYPE_WARN: |
| 196 | dump_bfin_trace_buffer(); |
| 197 | fp->pc += 2; |
| 198 | goto traps_done; |
| 199 | case BUG_TRAP_TYPE_BUG: |
| 200 | /* call to panic() will dump trace, and it is |
| 201 | * off at this point, so it won't be clobbered |
| 202 | */ |
| 203 | panic("BUG()"); |
| 204 | } |
| 205 | } |
| 206 | #endif |
Robin Getz | 6ce3e9c | 2010-03-16 14:40:17 +0000 | [diff] [blame^] | 207 | #ifdef CONFIG_BFIN_PSEUDODBG_INSNS |
| 208 | /* |
| 209 | * Support for the fake instructions, if the instruction fails, |
| 210 | * then just execute a illegal opcode failure (like normal). |
| 211 | * Don't support these instructions inside the kernel |
| 212 | */ |
| 213 | if (!kernel_mode_regs(fp) && get_instruction(&opcode, (unsigned short *)fp->pc)) { |
| 214 | if (execute_pseudodbg_assert(fp, opcode)) |
| 215 | goto traps_done; |
| 216 | } |
| 217 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 218 | info.si_code = ILL_ILLOPC; |
| 219 | sig = SIGILL; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 220 | strerror = KERN_NOTICE EXC_0x21(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 221 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 222 | break; |
| 223 | /* 0x22 - Illegal Instruction Combination, handled here */ |
| 224 | case VEC_ILGAL_I: |
| 225 | info.si_code = ILL_ILLPARAOP; |
| 226 | sig = SIGILL; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 227 | strerror = KERN_NOTICE EXC_0x22(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 228 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 229 | break; |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 230 | /* 0x23 - Data CPLB protection violation, handled here */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 231 | case VEC_CPLB_VL: |
| 232 | info.si_code = ILL_CPLB_VI; |
Graf Yang | 36b8412 | 2009-07-21 02:26:57 +0000 | [diff] [blame] | 233 | sig = SIGSEGV; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 234 | strerror = KERN_NOTICE EXC_0x23(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 235 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 236 | break; |
| 237 | /* 0x24 - Data access misaligned, handled here */ |
| 238 | case VEC_MISALI_D: |
| 239 | info.si_code = BUS_ADRALN; |
| 240 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 241 | strerror = KERN_NOTICE EXC_0x24(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 242 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 243 | break; |
| 244 | /* 0x25 - Unrecoverable Event, handled here */ |
| 245 | case VEC_UNCOV: |
| 246 | info.si_code = ILL_ILLEXCPT; |
| 247 | sig = SIGILL; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 248 | strerror = KERN_NOTICE EXC_0x25(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 249 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 250 | break; |
| 251 | /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, |
| 252 | error case is handled here */ |
| 253 | case VEC_CPLB_M: |
| 254 | info.si_code = BUS_ADRALN; |
| 255 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 256 | strerror = KERN_NOTICE EXC_0x26(KERN_NOTICE); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 257 | break; |
| 258 | /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ |
| 259 | case VEC_CPLB_MHIT: |
| 260 | info.si_code = ILL_CPLB_MULHIT; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 261 | sig = SIGSEGV; |
Mike Frysinger | c6c6f75 | 2008-05-17 16:18:08 +0800 | [diff] [blame] | 262 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO |
Graf Yang | 8f65873 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 263 | if (cpu_pda[cpu].dcplb_fault_addr < FIXED_CODE_START) |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 264 | strerror = KERN_NOTICE "NULL pointer access\n"; |
Mike Frysinger | c6c6f75 | 2008-05-17 16:18:08 +0800 | [diff] [blame] | 265 | else |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 266 | #endif |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 267 | strerror = KERN_NOTICE EXC_0x27(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 268 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 269 | break; |
| 270 | /* 0x28 - Emulation Watchpoint, handled here */ |
| 271 | case VEC_WATCH: |
| 272 | info.si_code = TRAP_WATCHPT; |
| 273 | sig = SIGTRAP; |
Robin Getz | 569a50c | 2007-11-21 16:35:57 +0800 | [diff] [blame] | 274 | pr_debug(EXC_0x28(KERN_DEBUG)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 275 | CHK_DEBUGGER_TRAP_MAYBE(); |
| 276 | /* Check if this is a watchpoint in kernel space */ |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 277 | if (kernel_mode_regs(fp)) |
Mike Frysinger | 6510a20 | 2009-06-07 15:07:25 -0400 | [diff] [blame] | 278 | goto traps_done; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 279 | else |
| 280 | break; |
| 281 | #ifdef CONFIG_BF535 |
| 282 | /* 0x29 - Instruction fetch access error (535 only) */ |
| 283 | case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ |
| 284 | info.si_code = BUS_OPFETCH; |
| 285 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 286 | strerror = KERN_NOTICE "BF535: VEC_ISTRU_VL\n"; |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 287 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 288 | break; |
| 289 | #else |
| 290 | /* 0x29 - Reserved, Caught by default */ |
| 291 | #endif |
| 292 | /* 0x2A - Instruction fetch misaligned, handled here */ |
| 293 | case VEC_MISALI_I: |
| 294 | info.si_code = BUS_ADRALN; |
| 295 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 296 | strerror = KERN_NOTICE EXC_0x2A(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 297 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 298 | break; |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 299 | /* 0x2B - Instruction CPLB protection violation, handled here */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 300 | case VEC_CPLB_I_VL: |
| 301 | info.si_code = ILL_CPLB_VI; |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 302 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 303 | strerror = KERN_NOTICE EXC_0x2B(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 304 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 305 | break; |
| 306 | /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ |
| 307 | case VEC_CPLB_I_M: |
| 308 | info.si_code = ILL_CPLB_MISS; |
| 309 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 310 | strerror = KERN_NOTICE EXC_0x2C(KERN_NOTICE); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 311 | break; |
| 312 | /* 0x2D - Instruction CPLB Multiple Hits, handled here */ |
| 313 | case VEC_CPLB_I_MHIT: |
| 314 | info.si_code = ILL_CPLB_MULHIT; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 315 | sig = SIGSEGV; |
Mike Frysinger | c6c6f75 | 2008-05-17 16:18:08 +0800 | [diff] [blame] | 316 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO |
Graf Yang | 8f65873 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 317 | if (cpu_pda[cpu].icplb_fault_addr < FIXED_CODE_START) |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 318 | strerror = KERN_NOTICE "Jump to NULL address\n"; |
Mike Frysinger | c6c6f75 | 2008-05-17 16:18:08 +0800 | [diff] [blame] | 319 | else |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 320 | #endif |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 321 | strerror = KERN_NOTICE EXC_0x2D(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 322 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 323 | break; |
| 324 | /* 0x2E - Illegal use of Supervisor Resource, handled here */ |
| 325 | case VEC_ILL_RES: |
| 326 | info.si_code = ILL_PRVOPC; |
| 327 | sig = SIGILL; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 328 | strerror = KERN_NOTICE EXC_0x2E(KERN_NOTICE); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 329 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 330 | break; |
| 331 | /* 0x2F - Reserved, Caught by default */ |
| 332 | /* 0x30 - Reserved, Caught by default */ |
| 333 | /* 0x31 - Reserved, Caught by default */ |
| 334 | /* 0x32 - Reserved, Caught by default */ |
| 335 | /* 0x33 - Reserved, Caught by default */ |
| 336 | /* 0x34 - Reserved, Caught by default */ |
| 337 | /* 0x35 - Reserved, Caught by default */ |
| 338 | /* 0x36 - Reserved, Caught by default */ |
| 339 | /* 0x37 - Reserved, Caught by default */ |
| 340 | /* 0x38 - Reserved, Caught by default */ |
| 341 | /* 0x39 - Reserved, Caught by default */ |
| 342 | /* 0x3A - Reserved, Caught by default */ |
| 343 | /* 0x3B - Reserved, Caught by default */ |
| 344 | /* 0x3C - Reserved, Caught by default */ |
| 345 | /* 0x3D - Reserved, Caught by default */ |
| 346 | /* 0x3E - Reserved, Caught by default */ |
| 347 | /* 0x3F - Reserved, Caught by default */ |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 348 | case VEC_HWERR: |
| 349 | info.si_code = BUS_ADRALN; |
| 350 | sig = SIGBUS; |
| 351 | switch (fp->seqstat & SEQSTAT_HWERRCAUSE) { |
| 352 | /* System MMR Error */ |
| 353 | case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): |
| 354 | info.si_code = BUS_ADRALN; |
| 355 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 356 | strerror = KERN_NOTICE HWC_x2(KERN_NOTICE); |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 357 | break; |
| 358 | /* External Memory Addressing Error */ |
| 359 | case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): |
Barry Song | a00b4fe | 2009-11-27 09:18:21 +0000 | [diff] [blame] | 360 | if (ANOMALY_05000310) { |
| 361 | static unsigned long anomaly_rets; |
| 362 | |
| 363 | if ((fp->pc >= (L1_CODE_START + L1_CODE_LENGTH - 512)) && |
| 364 | (fp->pc < (L1_CODE_START + L1_CODE_LENGTH))) { |
| 365 | /* |
| 366 | * A false hardware error will happen while fetching at |
| 367 | * the L1 instruction SRAM boundary. Ignore it. |
| 368 | */ |
| 369 | anomaly_rets = fp->rets; |
| 370 | goto traps_done; |
| 371 | } else if (fp->rets == anomaly_rets) { |
| 372 | /* |
| 373 | * While boundary code returns to a function, at the ret |
| 374 | * point, a new false hardware error might occur too based |
| 375 | * on tests. Ignore it too. |
| 376 | */ |
| 377 | goto traps_done; |
| 378 | } else if ((fp->rets >= (L1_CODE_START + L1_CODE_LENGTH - 512)) && |
| 379 | (fp->rets < (L1_CODE_START + L1_CODE_LENGTH))) { |
| 380 | /* |
| 381 | * If boundary code calls a function, at the entry point, |
| 382 | * a new false hardware error maybe happen based on tests. |
| 383 | * Ignore it too. |
| 384 | */ |
| 385 | goto traps_done; |
| 386 | } else |
| 387 | anomaly_rets = 0; |
| 388 | } |
| 389 | |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 390 | info.si_code = BUS_ADRERR; |
| 391 | sig = SIGBUS; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 392 | strerror = KERN_NOTICE HWC_x3(KERN_NOTICE); |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 393 | break; |
| 394 | /* Performance Monitor Overflow */ |
| 395 | case (SEQSTAT_HWERRCAUSE_PERF_FLOW): |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 396 | strerror = KERN_NOTICE HWC_x12(KERN_NOTICE); |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 397 | break; |
| 398 | /* RAISE 5 instruction */ |
| 399 | case (SEQSTAT_HWERRCAUSE_RAISE_5): |
| 400 | printk(KERN_NOTICE HWC_x18(KERN_NOTICE)); |
| 401 | break; |
| 402 | default: /* Reserved */ |
| 403 | printk(KERN_NOTICE HWC_default(KERN_NOTICE)); |
| 404 | break; |
| 405 | } |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 406 | CHK_DEBUGGER_TRAP_MAYBE(); |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 407 | break; |
Robin Getz | 5c64e0d | 2008-10-08 14:43:47 +0800 | [diff] [blame] | 408 | /* |
| 409 | * We should be handling all known exception types above, |
| 410 | * if we get here we hit a reserved one, so panic |
| 411 | */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 412 | default: |
Robin Getz | 5c64e0d | 2008-10-08 14:43:47 +0800 | [diff] [blame] | 413 | info.si_code = ILL_ILLPARAOP; |
| 414 | sig = SIGILL; |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 415 | verbose_printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 416 | (fp->seqstat & SEQSTAT_EXCAUSE)); |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 417 | CHK_DEBUGGER_TRAP_MAYBE(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 418 | break; |
| 419 | } |
| 420 | |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 421 | BUG_ON(sig == 0); |
| 422 | |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 423 | /* If the fault was caused by a kernel thread, or interrupt handler |
| 424 | * we will kernel panic, so the system reboots. |
| 425 | */ |
| 426 | if (kernel_mode_regs(fp) || (current && !current->mm)) { |
| 427 | console_verbose(); |
| 428 | oops_in_progress = 1; |
Mike Frysinger | 82bd1d7 | 2009-06-07 17:08:28 -0400 | [diff] [blame] | 429 | } |
| 430 | |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 431 | if (sig != SIGTRAP) { |
Mike Frysinger | 15627bd | 2009-06-23 11:21:34 +0000 | [diff] [blame] | 432 | if (strerror) |
| 433 | verbose_printk(strerror); |
| 434 | |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 435 | dump_bfin_process(fp); |
Robin Getz | b03b08b | 2007-12-23 22:57:01 +0800 | [diff] [blame] | 436 | dump_bfin_mem(fp); |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 437 | show_regs(fp); |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 438 | |
| 439 | /* Print out the trace buffer if it makes sense */ |
| 440 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE |
| 441 | if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M) |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 442 | verbose_printk(KERN_NOTICE "No trace since you do not have " |
Joe Perches | ad361c9 | 2009-07-06 13:05:40 -0700 | [diff] [blame] | 443 | "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n\n"); |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 444 | else |
| 445 | #endif |
| 446 | dump_bfin_trace_buffer(); |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 447 | |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 448 | if (oops_in_progress) { |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 449 | /* Dump the current kernel stack */ |
Joe Perches | ad361c9 | 2009-07-06 13:05:40 -0700 | [diff] [blame] | 450 | verbose_printk(KERN_NOTICE "Kernel Stack\n"); |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 451 | show_stack(current, NULL); |
Robin Getz | aee3a29 | 2008-01-11 16:53:00 +0800 | [diff] [blame] | 452 | print_modules(); |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 453 | #ifndef CONFIG_ACCESS_CHECK |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 454 | verbose_printk(KERN_EMERG "Please turn on " |
Robin Getz | 90c7f46 | 2007-11-18 00:35:33 +0800 | [diff] [blame] | 455 | "CONFIG_ACCESS_CHECK\n"); |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 456 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 457 | panic("Kernel exception"); |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 458 | } else { |
Robin Getz | 4ee1c45 | 2008-10-28 11:36:11 +0800 | [diff] [blame] | 459 | #ifdef CONFIG_DEBUG_VERBOSE |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 460 | unsigned long *stack; |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 461 | /* Dump the user space stack */ |
| 462 | stack = (unsigned long *)rdusp(); |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 463 | verbose_printk(KERN_NOTICE "Userspace Stack\n"); |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 464 | show_stack(NULL, stack); |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 465 | #endif |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 466 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 467 | } |
Robin Getz | fb32291 | 2007-11-21 16:38:05 +0800 | [diff] [blame] | 468 | |
Yi Li | 6a01f23 | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 469 | #ifdef CONFIG_IPIPE |
| 470 | if (!ipipe_trap_notify(fp->seqstat & 0x3f, fp)) |
| 471 | #endif |
| 472 | { |
| 473 | info.si_signo = sig; |
| 474 | info.si_errno = 0; |
Barry Song | 5e8d321 | 2010-01-19 11:01:08 +0000 | [diff] [blame] | 475 | switch (trapnr) { |
| 476 | case VEC_CPLB_VL: |
| 477 | case VEC_MISALI_D: |
| 478 | case VEC_CPLB_M: |
| 479 | case VEC_CPLB_MHIT: |
| 480 | info.si_addr = (void __user *)cpu_pda[cpu].dcplb_fault_addr; |
| 481 | break; |
| 482 | default: |
| 483 | info.si_addr = (void __user *)fp->pc; |
| 484 | break; |
| 485 | } |
Yi Li | 6a01f23 | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 486 | force_sig_info(sig, &info, current); |
| 487 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 488 | |
Robin Getz | 0e4edcf | 2009-06-22 20:23:48 +0000 | [diff] [blame] | 489 | if ((ANOMALY_05000461 && trapnr == VEC_HWERR && !access_ok(VERIFY_READ, fp->pc, 8)) || |
Robin Getz | f574a76 | 2009-07-09 15:11:52 +0000 | [diff] [blame] | 490 | (ANOMALY_05000281 && trapnr == VEC_HWERR) || |
| 491 | (ANOMALY_05000189 && (trapnr == VEC_CPLB_I_VL || trapnr == VEC_CPLB_VL))) |
Robin Getz | 0acad8d | 2009-05-11 18:55:16 +0000 | [diff] [blame] | 492 | fp->pc = SAFE_USER_INSTRUCTION; |
| 493 | |
Mike Frysinger | 6510a20 | 2009-06-07 15:07:25 -0400 | [diff] [blame] | 494 | traps_done: |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 495 | trace_buffer_restore(j); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 496 | } |
| 497 | |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 498 | asmlinkage void double_fault_c(struct pt_regs *fp) |
Robin Getz | f09630b | 2008-07-26 19:45:46 +0800 | [diff] [blame] | 499 | { |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 500 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 501 | int j; |
| 502 | trace_buffer_save(j); |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 503 | #endif |
| 504 | |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 505 | console_verbose(); |
| 506 | oops_in_progress = 1; |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 507 | #ifdef CONFIG_DEBUG_VERBOSE |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 508 | printk(KERN_EMERG "Double Fault\n"); |
| 509 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT |
| 510 | if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) { |
| 511 | unsigned int cpu = raw_smp_processor_id(); |
| 512 | char buf[150]; |
| 513 | decode_address(buf, cpu_pda[cpu].retx_doublefault); |
| 514 | printk(KERN_EMERG "While handling exception (EXCAUSE = 0x%x) at %s:\n", |
| 515 | (unsigned int)cpu_pda[cpu].seqstat_doublefault & SEQSTAT_EXCAUSE, buf); |
| 516 | decode_address(buf, cpu_pda[cpu].dcplb_doublefault_addr); |
| 517 | printk(KERN_NOTICE " DCPLB_FAULT_ADDR: %s\n", buf); |
| 518 | decode_address(buf, cpu_pda[cpu].icplb_doublefault_addr); |
| 519 | printk(KERN_NOTICE " ICPLB_FAULT_ADDR: %s\n", buf); |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 520 | |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 521 | decode_address(buf, fp->retx); |
| 522 | printk(KERN_NOTICE "The instruction at %s caused a double exception\n", buf); |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 523 | } else |
Robin Getz | 9f06c38 | 2008-10-10 18:13:21 +0800 | [diff] [blame] | 524 | #endif |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 525 | { |
| 526 | dump_bfin_process(fp); |
| 527 | dump_bfin_mem(fp); |
| 528 | show_regs(fp); |
| 529 | dump_bfin_trace_buffer(); |
| 530 | } |
| 531 | #endif |
| 532 | panic("Double Fault - unrecoverable event"); |
| 533 | |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 534 | } |
| 535 | |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 536 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 537 | void panic_cplb_error(int cplb_panic, struct pt_regs *fp) |
| 538 | { |
| 539 | switch (cplb_panic) { |
| 540 | case CPLB_NO_UNLOCKED: |
| 541 | printk(KERN_EMERG "All CPLBs are locked\n"); |
| 542 | break; |
| 543 | case CPLB_PROT_VIOL: |
| 544 | return; |
| 545 | case CPLB_NO_ADDR_MATCH: |
| 546 | return; |
| 547 | case CPLB_UNKNOWN_ERR: |
| 548 | printk(KERN_EMERG "Unknown CPLB Exception\n"); |
| 549 | break; |
| 550 | } |
| 551 | |
Robin Getz | 226eb1e | 2007-10-29 17:59:07 +0800 | [diff] [blame] | 552 | oops_in_progress = 1; |
| 553 | |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 554 | dump_bfin_process(fp); |
Robin Getz | b03b08b | 2007-12-23 22:57:01 +0800 | [diff] [blame] | 555 | dump_bfin_mem(fp); |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 556 | show_regs(fp); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 557 | dump_stack(); |
Mike Frysinger | d8804ad | 2009-04-29 06:26:46 +0000 | [diff] [blame] | 558 | panic("Unrecoverable event"); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 559 | } |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 560 | |
| 561 | #ifdef CONFIG_BUG |
| 562 | int is_valid_bugaddr(unsigned long addr) |
| 563 | { |
Robin Getz | 9a95e2f | 2010-03-15 17:42:07 +0000 | [diff] [blame] | 564 | unsigned int opcode; |
Robin Getz | 2a12c46 | 2010-03-11 16:24:18 +0000 | [diff] [blame] | 565 | |
| 566 | if (!get_instruction(&opcode, (unsigned short *)addr)) |
| 567 | return 0; |
| 568 | |
| 569 | return opcode == BFIN_BUG_OPCODE; |
| 570 | } |
| 571 | #endif |
Robin Getz | d28cff4 | 2010-03-11 19:26:38 +0000 | [diff] [blame] | 572 | |
| 573 | /* stub this out */ |
| 574 | #ifndef CONFIG_DEBUG_VERBOSE |
| 575 | void show_regs(struct pt_regs *fp) |
| 576 | { |
| 577 | |
| 578 | } |
| 579 | #endif |