traps.c 16 KB

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