traps.c 16 KB

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