traps.c 16 KB

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