traps.c 16 KB

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