traps.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  1. /*
  2. * linux/arch/m68k/kernel/traps.c
  3. *
  4. * Copyright (C) 1993, 1994 by Hamish Macdonald
  5. *
  6. * 68040 fixes by Michael Rausch
  7. * 68040 fixes by Martin Apel
  8. * 68040 fixes and writeback by Richard Zidlicky
  9. * 68060 fixes by Roman Hodek
  10. * 68060 fixes by Jesper Skov
  11. *
  12. * This file is subject to the terms and conditions of the GNU General Public
  13. * License. See the file COPYING in the main directory of this archive
  14. * for more details.
  15. */
  16. /*
  17. * Sets up all exception vectors
  18. */
  19. #include <linux/sched.h>
  20. #include <linux/signal.h>
  21. #include <linux/kernel.h>
  22. #include <linux/mm.h>
  23. #include <linux/module.h>
  24. #include <linux/user.h>
  25. #include <linux/string.h>
  26. #include <linux/linkage.h>
  27. #include <linux/init.h>
  28. #include <linux/ptrace.h>
  29. #include <linux/kallsyms.h>
  30. #include <asm/setup.h>
  31. #include <asm/fpu.h>
  32. #include <asm/uaccess.h>
  33. #include <asm/traps.h>
  34. #include <asm/pgalloc.h>
  35. #include <asm/machdep.h>
  36. #include <asm/siginfo.h>
  37. static const char *vec_names[] = {
  38. [VEC_RESETSP] = "RESET SP",
  39. [VEC_RESETPC] = "RESET PC",
  40. [VEC_BUSERR] = "BUS ERROR",
  41. [VEC_ADDRERR] = "ADDRESS ERROR",
  42. [VEC_ILLEGAL] = "ILLEGAL INSTRUCTION",
  43. [VEC_ZERODIV] = "ZERO DIVIDE",
  44. [VEC_CHK] = "CHK",
  45. [VEC_TRAP] = "TRAPcc",
  46. [VEC_PRIV] = "PRIVILEGE VIOLATION",
  47. [VEC_TRACE] = "TRACE",
  48. [VEC_LINE10] = "LINE 1010",
  49. [VEC_LINE11] = "LINE 1111",
  50. [VEC_RESV12] = "UNASSIGNED RESERVED 12",
  51. [VEC_COPROC] = "COPROCESSOR PROTOCOL VIOLATION",
  52. [VEC_FORMAT] = "FORMAT ERROR",
  53. [VEC_UNINT] = "UNINITIALIZED INTERRUPT",
  54. [VEC_RESV16] = "UNASSIGNED RESERVED 16",
  55. [VEC_RESV17] = "UNASSIGNED RESERVED 17",
  56. [VEC_RESV18] = "UNASSIGNED RESERVED 18",
  57. [VEC_RESV19] = "UNASSIGNED RESERVED 19",
  58. [VEC_RESV20] = "UNASSIGNED RESERVED 20",
  59. [VEC_RESV21] = "UNASSIGNED RESERVED 21",
  60. [VEC_RESV22] = "UNASSIGNED RESERVED 22",
  61. [VEC_RESV23] = "UNASSIGNED RESERVED 23",
  62. [VEC_SPUR] = "SPURIOUS INTERRUPT",
  63. [VEC_INT1] = "LEVEL 1 INT",
  64. [VEC_INT2] = "LEVEL 2 INT",
  65. [VEC_INT3] = "LEVEL 3 INT",
  66. [VEC_INT4] = "LEVEL 4 INT",
  67. [VEC_INT5] = "LEVEL 5 INT",
  68. [VEC_INT6] = "LEVEL 6 INT",
  69. [VEC_INT7] = "LEVEL 7 INT",
  70. [VEC_SYS] = "SYSCALL",
  71. [VEC_TRAP1] = "TRAP #1",
  72. [VEC_TRAP2] = "TRAP #2",
  73. [VEC_TRAP3] = "TRAP #3",
  74. [VEC_TRAP4] = "TRAP #4",
  75. [VEC_TRAP5] = "TRAP #5",
  76. [VEC_TRAP6] = "TRAP #6",
  77. [VEC_TRAP7] = "TRAP #7",
  78. [VEC_TRAP8] = "TRAP #8",
  79. [VEC_TRAP9] = "TRAP #9",
  80. [VEC_TRAP10] = "TRAP #10",
  81. [VEC_TRAP11] = "TRAP #11",
  82. [VEC_TRAP12] = "TRAP #12",
  83. [VEC_TRAP13] = "TRAP #13",
  84. [VEC_TRAP14] = "TRAP #14",
  85. [VEC_TRAP15] = "TRAP #15",
  86. [VEC_FPBRUC] = "FPCP BSUN",
  87. [VEC_FPIR] = "FPCP INEXACT",
  88. [VEC_FPDIVZ] = "FPCP DIV BY 0",
  89. [VEC_FPUNDER] = "FPCP UNDERFLOW",
  90. [VEC_FPOE] = "FPCP OPERAND ERROR",
  91. [VEC_FPOVER] = "FPCP OVERFLOW",
  92. [VEC_FPNAN] = "FPCP SNAN",
  93. [VEC_FPUNSUP] = "FPCP UNSUPPORTED OPERATION",
  94. [VEC_MMUCFG] = "MMU CONFIGURATION ERROR",
  95. [VEC_MMUILL] = "MMU ILLEGAL OPERATION ERROR",
  96. [VEC_MMUACC] = "MMU ACCESS LEVEL VIOLATION ERROR",
  97. [VEC_RESV59] = "UNASSIGNED RESERVED 59",
  98. [VEC_UNIMPEA] = "UNASSIGNED RESERVED 60",
  99. [VEC_UNIMPII] = "UNASSIGNED RESERVED 61",
  100. [VEC_RESV62] = "UNASSIGNED RESERVED 62",
  101. [VEC_RESV63] = "UNASSIGNED RESERVED 63",
  102. };
  103. static const char *space_names[] = {
  104. [0] = "Space 0",
  105. [USER_DATA] = "User Data",
  106. [USER_PROGRAM] = "User Program",
  107. #ifndef CONFIG_SUN3
  108. [3] = "Space 3",
  109. #else
  110. [FC_CONTROL] = "Control",
  111. #endif
  112. [4] = "Space 4",
  113. [SUPER_DATA] = "Super Data",
  114. [SUPER_PROGRAM] = "Super Program",
  115. [CPU_SPACE] = "CPU"
  116. };
  117. void die_if_kernel(char *,struct pt_regs *,int);
  118. asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
  119. unsigned long error_code);
  120. int send_fault_sig(struct pt_regs *regs);
  121. asmlinkage void trap_c(struct frame *fp);
  122. #if defined (CONFIG_M68060)
  123. static inline void access_error060 (struct frame *fp)
  124. {
  125. unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
  126. pr_debug("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
  127. if (fslw & MMU060_BPE) {
  128. /* branch prediction error -> clear branch cache */
  129. __asm__ __volatile__ ("movec %/cacr,%/d0\n\t"
  130. "orl #0x00400000,%/d0\n\t"
  131. "movec %/d0,%/cacr"
  132. : : : "d0" );
  133. /* return if there's no other error */
  134. if (!(fslw & MMU060_ERR_BITS) && !(fslw & MMU060_SEE))
  135. return;
  136. }
  137. if (fslw & (MMU060_DESC_ERR | MMU060_WP | MMU060_SP)) {
  138. unsigned long errorcode;
  139. unsigned long addr = fp->un.fmt4.effaddr;
  140. if (fslw & MMU060_MA)
  141. addr = (addr + PAGE_SIZE - 1) & PAGE_MASK;
  142. errorcode = 1;
  143. if (fslw & MMU060_DESC_ERR) {
  144. __flush_tlb040_one(addr);
  145. errorcode = 0;
  146. }
  147. if (fslw & MMU060_W)
  148. errorcode |= 2;
  149. pr_debug("errorcode = %ld\n", errorcode);
  150. do_page_fault(&fp->ptregs, addr, errorcode);
  151. } else if (fslw & (MMU060_SEE)){
  152. /* Software Emulation Error.
  153. * fault during mem_read/mem_write in ifpsp060/os.S
  154. */
  155. send_fault_sig(&fp->ptregs);
  156. } else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
  157. send_fault_sig(&fp->ptregs) > 0) {
  158. pr_err("pc=%#lx, fa=%#lx\n", fp->ptregs.pc,
  159. fp->un.fmt4.effaddr);
  160. pr_err("68060 access error, fslw=%lx\n", fslw);
  161. trap_c( fp );
  162. }
  163. }
  164. #endif /* CONFIG_M68060 */
  165. #if defined (CONFIG_M68040)
  166. static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
  167. {
  168. unsigned long mmusr;
  169. mm_segment_t old_fs = get_fs();
  170. set_fs(MAKE_MM_SEG(wbs));
  171. if (iswrite)
  172. asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr));
  173. else
  174. asm volatile (".chip 68040; ptestr (%0); .chip 68k" : : "a" (addr));
  175. asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
  176. set_fs(old_fs);
  177. return mmusr;
  178. }
  179. static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
  180. unsigned long wbd)
  181. {
  182. int res = 0;
  183. mm_segment_t old_fs = get_fs();
  184. /* set_fs can not be moved, otherwise put_user() may oops */
  185. set_fs(MAKE_MM_SEG(wbs));
  186. switch (wbs & WBSIZ_040) {
  187. case BA_SIZE_BYTE:
  188. res = put_user(wbd & 0xff, (char __user *)wba);
  189. break;
  190. case BA_SIZE_WORD:
  191. res = put_user(wbd & 0xffff, (short __user *)wba);
  192. break;
  193. case BA_SIZE_LONG:
  194. res = put_user(wbd, (int __user *)wba);
  195. break;
  196. }
  197. /* set_fs can not be moved, otherwise put_user() may oops */
  198. set_fs(old_fs);
  199. pr_debug("do_040writeback1, res=%d\n", res);
  200. return res;
  201. }
  202. /* after an exception in a writeback the stack frame corresponding
  203. * to that exception is discarded, set a few bits in the old frame
  204. * to simulate what it should look like
  205. */
  206. static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
  207. {
  208. fp->un.fmt7.faddr = wba;
  209. fp->un.fmt7.ssw = wbs & 0xff;
  210. if (wba != current->thread.faddr)
  211. fp->un.fmt7.ssw |= MA_040;
  212. }
  213. static inline void do_040writebacks(struct frame *fp)
  214. {
  215. int res = 0;
  216. #if 0
  217. if (fp->un.fmt7.wb1s & WBV_040)
  218. pr_err("access_error040: cannot handle 1st writeback. oops.\n");
  219. #endif
  220. if ((fp->un.fmt7.wb2s & WBV_040) &&
  221. !(fp->un.fmt7.wb2s & WBTT_040)) {
  222. res = do_040writeback1(fp->un.fmt7.wb2s, fp->un.fmt7.wb2a,
  223. fp->un.fmt7.wb2d);
  224. if (res)
  225. fix_xframe040(fp, fp->un.fmt7.wb2a, fp->un.fmt7.wb2s);
  226. else
  227. fp->un.fmt7.wb2s = 0;
  228. }
  229. /* do the 2nd wb only if the first one was successful (except for a kernel wb) */
  230. if (fp->un.fmt7.wb3s & WBV_040 && (!res || fp->un.fmt7.wb3s & 4)) {
  231. res = do_040writeback1(fp->un.fmt7.wb3s, fp->un.fmt7.wb3a,
  232. fp->un.fmt7.wb3d);
  233. if (res)
  234. {
  235. fix_xframe040(fp, fp->un.fmt7.wb3a, fp->un.fmt7.wb3s);
  236. fp->un.fmt7.wb2s = fp->un.fmt7.wb3s;
  237. fp->un.fmt7.wb3s &= (~WBV_040);
  238. fp->un.fmt7.wb2a = fp->un.fmt7.wb3a;
  239. fp->un.fmt7.wb2d = fp->un.fmt7.wb3d;
  240. }
  241. else
  242. fp->un.fmt7.wb3s = 0;
  243. }
  244. if (res)
  245. send_fault_sig(&fp->ptregs);
  246. }
  247. /*
  248. * called from sigreturn(), must ensure userspace code didn't
  249. * manipulate exception frame to circumvent protection, then complete
  250. * pending writebacks
  251. * we just clear TM2 to turn it into a userspace access
  252. */
  253. asmlinkage void berr_040cleanup(struct frame *fp)
  254. {
  255. fp->un.fmt7.wb2s &= ~4;
  256. fp->un.fmt7.wb3s &= ~4;
  257. do_040writebacks(fp);
  258. }
  259. static inline void access_error040(struct frame *fp)
  260. {
  261. unsigned short ssw = fp->un.fmt7.ssw;
  262. unsigned long mmusr;
  263. pr_debug("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
  264. pr_debug("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
  265. fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
  266. pr_debug("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
  267. fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
  268. fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
  269. if (ssw & ATC_040) {
  270. unsigned long addr = fp->un.fmt7.faddr;
  271. unsigned long errorcode;
  272. /*
  273. * The MMU status has to be determined AFTER the address
  274. * has been corrected if there was a misaligned access (MA).
  275. */
  276. if (ssw & MA_040)
  277. addr = (addr + 7) & -8;
  278. /* MMU error, get the MMUSR info for this access */
  279. mmusr = probe040(!(ssw & RW_040), addr, ssw);
  280. pr_debug("mmusr = %lx\n", mmusr);
  281. errorcode = 1;
  282. if (!(mmusr & MMU_R_040)) {
  283. /* clear the invalid atc entry */
  284. __flush_tlb040_one(addr);
  285. errorcode = 0;
  286. }
  287. /* despite what documentation seems to say, RMW
  288. * accesses have always both the LK and RW bits set */
  289. if (!(ssw & RW_040) || (ssw & LK_040))
  290. errorcode |= 2;
  291. if (do_page_fault(&fp->ptregs, addr, errorcode)) {
  292. pr_debug("do_page_fault() !=0\n");
  293. if (user_mode(&fp->ptregs)){
  294. /* delay writebacks after signal delivery */
  295. pr_debug(".. was usermode - return\n");
  296. return;
  297. }
  298. /* disable writeback into user space from kernel
  299. * (if do_page_fault didn't fix the mapping,
  300. * the writeback won't do good)
  301. */
  302. disable_wb:
  303. pr_debug(".. disabling wb2\n");
  304. if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr)
  305. fp->un.fmt7.wb2s &= ~WBV_040;
  306. if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr)
  307. fp->un.fmt7.wb3s &= ~WBV_040;
  308. }
  309. } else {
  310. /* In case of a bus error we either kill the process or expect
  311. * the kernel to catch the fault, which then is also responsible
  312. * for cleaning up the mess.
  313. */
  314. current->thread.signo = SIGBUS;
  315. current->thread.faddr = fp->un.fmt7.faddr;
  316. if (send_fault_sig(&fp->ptregs) >= 0)
  317. pr_err("68040 bus error (ssw=%x, faddr=%lx)\n", ssw,
  318. fp->un.fmt7.faddr);
  319. goto disable_wb;
  320. }
  321. do_040writebacks(fp);
  322. }
  323. #endif /* CONFIG_M68040 */
  324. #if defined(CONFIG_SUN3)
  325. #include <asm/sun3mmu.h>
  326. extern int mmu_emu_handle_fault (unsigned long, int, int);
  327. /* sun3 version of bus_error030 */
  328. static inline void bus_error030 (struct frame *fp)
  329. {
  330. unsigned char buserr_type = sun3_get_buserr ();
  331. unsigned long addr, errorcode;
  332. unsigned short ssw = fp->un.fmtb.ssw;
  333. extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
  334. if (ssw & (FC | FB))
  335. pr_debug("Instruction fault at %#010lx\n",
  336. ssw & FC ?
  337. fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
  338. :
  339. fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
  340. if (ssw & DF)
  341. pr_debug("Data %s fault at %#010lx in %s (pc=%#lx)\n",
  342. ssw & RW ? "read" : "write",
  343. fp->un.fmtb.daddr,
  344. space_names[ssw & DFC], fp->ptregs.pc);
  345. /*
  346. * Check if this page should be demand-mapped. This needs to go before
  347. * the testing for a bad kernel-space access (demand-mapping applies
  348. * to kernel accesses too).
  349. */
  350. if ((ssw & DF)
  351. && (buserr_type & (SUN3_BUSERR_PROTERR | SUN3_BUSERR_INVALID))) {
  352. if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 0))
  353. return;
  354. }
  355. /* Check for kernel-space pagefault (BAD). */
  356. if (fp->ptregs.sr & PS_S) {
  357. /* kernel fault must be a data fault to user space */
  358. if (! ((ssw & DF) && ((ssw & DFC) == USER_DATA))) {
  359. // try checking the kernel mappings before surrender
  360. if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 1))
  361. return;
  362. /* instruction fault or kernel data fault! */
  363. if (ssw & (FC | FB))
  364. pr_err("Instruction fault at %#010lx\n",
  365. fp->ptregs.pc);
  366. if (ssw & DF) {
  367. /* was this fault incurred testing bus mappings? */
  368. if((fp->ptregs.pc >= (unsigned long)&_sun3_map_test_start) &&
  369. (fp->ptregs.pc <= (unsigned long)&_sun3_map_test_end)) {
  370. send_fault_sig(&fp->ptregs);
  371. return;
  372. }
  373. pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
  374. ssw & RW ? "read" : "write",
  375. fp->un.fmtb.daddr,
  376. space_names[ssw & DFC], fp->ptregs.pc);
  377. }
  378. pr_err("BAD KERNEL BUSERR\n");
  379. die_if_kernel("Oops", &fp->ptregs,0);
  380. force_sig(SIGKILL, current);
  381. return;
  382. }
  383. } else {
  384. /* user fault */
  385. if (!(ssw & (FC | FB)) && !(ssw & DF))
  386. /* not an instruction fault or data fault! BAD */
  387. panic ("USER BUSERR w/o instruction or data fault");
  388. }
  389. /* First handle the data fault, if any. */
  390. if (ssw & DF) {
  391. addr = fp->un.fmtb.daddr;
  392. // errorcode bit 0: 0 -> no page 1 -> protection fault
  393. // errorcode bit 1: 0 -> read fault 1 -> write fault
  394. // (buserr_type & SUN3_BUSERR_PROTERR) -> protection fault
  395. // (buserr_type & SUN3_BUSERR_INVALID) -> invalid page fault
  396. if (buserr_type & SUN3_BUSERR_PROTERR)
  397. errorcode = 0x01;
  398. else if (buserr_type & SUN3_BUSERR_INVALID)
  399. errorcode = 0x00;
  400. else {
  401. pr_debug("*** unexpected busfault type=%#04x\n",
  402. buserr_type);
  403. pr_debug("invalid %s access at %#lx from pc %#lx\n",
  404. !(ssw & RW) ? "write" : "read", addr,
  405. fp->ptregs.pc);
  406. die_if_kernel ("Oops", &fp->ptregs, buserr_type);
  407. force_sig (SIGBUS, current);
  408. return;
  409. }
  410. //todo: wtf is RM bit? --m
  411. if (!(ssw & RW) || ssw & RM)
  412. errorcode |= 0x02;
  413. /* Handle page fault. */
  414. do_page_fault (&fp->ptregs, addr, errorcode);
  415. /* Retry the data fault now. */
  416. return;
  417. }
  418. /* Now handle the instruction fault. */
  419. /* Get the fault address. */
  420. if (fp->ptregs.format == 0xA)
  421. addr = fp->ptregs.pc + 4;
  422. else
  423. addr = fp->un.fmtb.baddr;
  424. if (ssw & FC)
  425. addr -= 2;
  426. if (buserr_type & SUN3_BUSERR_INVALID) {
  427. if (!mmu_emu_handle_fault(addr, 1, 0))
  428. do_page_fault (&fp->ptregs, addr, 0);
  429. } else {
  430. pr_debug("protection fault on insn access (segv).\n");
  431. force_sig (SIGSEGV, current);
  432. }
  433. }
  434. #else
  435. #if defined(CPU_M68020_OR_M68030)
  436. static inline void bus_error030 (struct frame *fp)
  437. {
  438. volatile unsigned short temp;
  439. unsigned short mmusr;
  440. unsigned long addr, errorcode;
  441. unsigned short ssw = fp->un.fmtb.ssw;
  442. #ifdef DEBUG
  443. unsigned long desc;
  444. #endif
  445. pr_debug("pid = %x ", current->pid);
  446. pr_debug("SSW=%#06x ", ssw);
  447. if (ssw & (FC | FB))
  448. pr_debug("Instruction fault at %#010lx\n",
  449. ssw & FC ?
  450. fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
  451. :
  452. fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
  453. if (ssw & DF)
  454. pr_debug("Data %s fault at %#010lx in %s (pc=%#lx)\n",
  455. ssw & RW ? "read" : "write",
  456. fp->un.fmtb.daddr,
  457. space_names[ssw & DFC], fp->ptregs.pc);
  458. /* ++andreas: If a data fault and an instruction fault happen
  459. at the same time map in both pages. */
  460. /* First handle the data fault, if any. */
  461. if (ssw & DF) {
  462. addr = fp->un.fmtb.daddr;
  463. #ifdef DEBUG
  464. asm volatile ("ptestr %3,%2@,#7,%0\n\t"
  465. "pmove %%psr,%1"
  466. : "=a&" (desc), "=m" (temp)
  467. : "a" (addr), "d" (ssw));
  468. pr_debug("mmusr is %#x for addr %#lx in task %p\n",
  469. temp, addr, current);
  470. pr_debug("descriptor address is 0x%p, contents %#lx\n",
  471. __va(desc), *(unsigned long *)__va(desc));
  472. #else
  473. asm volatile ("ptestr %2,%1@,#7\n\t"
  474. "pmove %%psr,%0"
  475. : "=m" (temp) : "a" (addr), "d" (ssw));
  476. #endif
  477. mmusr = temp;
  478. errorcode = (mmusr & MMU_I) ? 0 : 1;
  479. if (!(ssw & RW) || (ssw & RM))
  480. errorcode |= 2;
  481. if (mmusr & (MMU_I | MMU_WP)) {
  482. if (ssw & 4) {
  483. pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
  484. ssw & RW ? "read" : "write",
  485. fp->un.fmtb.daddr,
  486. space_names[ssw & DFC], fp->ptregs.pc);
  487. goto buserr;
  488. }
  489. /* Don't try to do anything further if an exception was
  490. handled. */
  491. if (do_page_fault (&fp->ptregs, addr, errorcode) < 0)
  492. return;
  493. } else if (!(mmusr & MMU_I)) {
  494. /* probably a 020 cas fault */
  495. if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0)
  496. pr_err("unexpected bus error (%#x,%#x)\n", ssw,
  497. mmusr);
  498. } else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
  499. pr_err("invalid %s access at %#lx from pc %#lx\n",
  500. !(ssw & RW) ? "write" : "read", addr,
  501. fp->ptregs.pc);
  502. die_if_kernel("Oops",&fp->ptregs,mmusr);
  503. force_sig(SIGSEGV, current);
  504. return;
  505. } else {
  506. #if 0
  507. static volatile long tlong;
  508. #endif
  509. pr_err("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
  510. !(ssw & RW) ? "write" : "read", addr,
  511. fp->ptregs.pc, ssw);
  512. asm volatile ("ptestr #1,%1@,#0\n\t"
  513. "pmove %%psr,%0"
  514. : "=m" (temp)
  515. : "a" (addr));
  516. mmusr = temp;
  517. pr_err("level 0 mmusr is %#x\n", mmusr);
  518. #if 0
  519. asm volatile ("pmove %%tt0,%0"
  520. : "=m" (tlong));
  521. pr_debug("tt0 is %#lx, ", tlong);
  522. asm volatile ("pmove %%tt1,%0"
  523. : "=m" (tlong));
  524. pr_debug("tt1 is %#lx\n", tlong);
  525. #endif
  526. pr_debug("Unknown SIGSEGV - 1\n");
  527. die_if_kernel("Oops",&fp->ptregs,mmusr);
  528. force_sig(SIGSEGV, current);
  529. return;
  530. }
  531. /* setup an ATC entry for the access about to be retried */
  532. if (!(ssw & RW) || (ssw & RM))
  533. asm volatile ("ploadw %1,%0@" : /* no outputs */
  534. : "a" (addr), "d" (ssw));
  535. else
  536. asm volatile ("ploadr %1,%0@" : /* no outputs */
  537. : "a" (addr), "d" (ssw));
  538. }
  539. /* Now handle the instruction fault. */
  540. if (!(ssw & (FC|FB)))
  541. return;
  542. if (fp->ptregs.sr & PS_S) {
  543. pr_err("Instruction fault at %#010lx\n", fp->ptregs.pc);
  544. buserr:
  545. pr_err("BAD KERNEL BUSERR\n");
  546. die_if_kernel("Oops",&fp->ptregs,0);
  547. force_sig(SIGKILL, current);
  548. return;
  549. }
  550. /* get the fault address */
  551. if (fp->ptregs.format == 10)
  552. addr = fp->ptregs.pc + 4;
  553. else
  554. addr = fp->un.fmtb.baddr;
  555. if (ssw & FC)
  556. addr -= 2;
  557. if ((ssw & DF) && ((addr ^ fp->un.fmtb.daddr) & PAGE_MASK) == 0)
  558. /* Insn fault on same page as data fault. But we
  559. should still create the ATC entry. */
  560. goto create_atc_entry;
  561. #ifdef DEBUG
  562. asm volatile ("ptestr #1,%2@,#7,%0\n\t"
  563. "pmove %%psr,%1"
  564. : "=a&" (desc), "=m" (temp)
  565. : "a" (addr));
  566. pr_debug("mmusr is %#x for addr %#lx in task %p\n",
  567. temp, addr, current);
  568. pr_debug("descriptor address is 0x%p, contents %#lx\n",
  569. __va(desc), *(unsigned long *)__va(desc));
  570. #else
  571. asm volatile ("ptestr #1,%1@,#7\n\t"
  572. "pmove %%psr,%0"
  573. : "=m" (temp) : "a" (addr));
  574. #endif
  575. mmusr = temp;
  576. if (mmusr & MMU_I)
  577. do_page_fault (&fp->ptregs, addr, 0);
  578. else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
  579. pr_err("invalid insn access at %#lx from pc %#lx\n",
  580. addr, fp->ptregs.pc);
  581. pr_debug("Unknown SIGSEGV - 2\n");
  582. die_if_kernel("Oops",&fp->ptregs,mmusr);
  583. force_sig(SIGSEGV, current);
  584. return;
  585. }
  586. create_atc_entry:
  587. /* setup an ATC entry for the access about to be retried */
  588. asm volatile ("ploadr #2,%0@" : /* no outputs */
  589. : "a" (addr));
  590. }
  591. #endif /* CPU_M68020_OR_M68030 */
  592. #endif /* !CONFIG_SUN3 */
  593. #if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
  594. #include <asm/mcfmmu.h>
  595. /*
  596. * The following table converts the FS encoding of a ColdFire
  597. * exception stack frame into the error_code value needed by
  598. * do_fault.
  599. */
  600. static const unsigned char fs_err_code[] = {
  601. 0, /* 0000 */
  602. 0, /* 0001 */
  603. 0, /* 0010 */
  604. 0, /* 0011 */
  605. 1, /* 0100 */
  606. 0, /* 0101 */
  607. 0, /* 0110 */
  608. 0, /* 0111 */
  609. 2, /* 1000 */
  610. 3, /* 1001 */
  611. 2, /* 1010 */
  612. 0, /* 1011 */
  613. 1, /* 1100 */
  614. 1, /* 1101 */
  615. 0, /* 1110 */
  616. 0 /* 1111 */
  617. };
  618. static inline void access_errorcf(unsigned int fs, struct frame *fp)
  619. {
  620. unsigned long mmusr, addr;
  621. unsigned int err_code;
  622. int need_page_fault;
  623. mmusr = mmu_read(MMUSR);
  624. addr = mmu_read(MMUAR);
  625. /*
  626. * error_code:
  627. * bit 0 == 0 means no page found, 1 means protection fault
  628. * bit 1 == 0 means read, 1 means write
  629. */
  630. switch (fs) {
  631. case 5: /* 0101 TLB opword X miss */
  632. need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 0, 0);
  633. addr = fp->ptregs.pc;
  634. break;
  635. case 6: /* 0110 TLB extension word X miss */
  636. need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 0, 1);
  637. addr = fp->ptregs.pc + sizeof(long);
  638. break;
  639. case 10: /* 1010 TLB W miss */
  640. need_page_fault = cf_tlb_miss(&fp->ptregs, 1, 1, 0);
  641. break;
  642. case 14: /* 1110 TLB R miss */
  643. need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 1, 0);
  644. break;
  645. default:
  646. /* 0000 Normal */
  647. /* 0001 Reserved */
  648. /* 0010 Interrupt during debug service routine */
  649. /* 0011 Reserved */
  650. /* 0100 X Protection */
  651. /* 0111 IFP in emulator mode */
  652. /* 1000 W Protection*/
  653. /* 1001 Write error*/
  654. /* 1011 Reserved*/
  655. /* 1100 R Protection*/
  656. /* 1101 R Protection*/
  657. /* 1111 OEP in emulator mode*/
  658. need_page_fault = 1;
  659. break;
  660. }
  661. if (need_page_fault) {
  662. err_code = fs_err_code[fs];
  663. if ((fs == 13) && (mmusr & MMUSR_WF)) /* rd-mod-wr access */
  664. err_code |= 2; /* bit1 - write, bit0 - protection */
  665. do_page_fault(&fp->ptregs, addr, err_code);
  666. }
  667. }
  668. #endif /* CONFIG_COLDFIRE CONFIG_MMU */
  669. asmlinkage void buserr_c(struct frame *fp)
  670. {
  671. /* Only set esp0 if coming from user mode */
  672. if (user_mode(&fp->ptregs))
  673. current->thread.esp0 = (unsigned long) fp;
  674. pr_debug("*** Bus Error *** Format is %x\n", fp->ptregs.format);
  675. #if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
  676. if (CPU_IS_COLDFIRE) {
  677. unsigned int fs;
  678. fs = (fp->ptregs.vector & 0x3) |
  679. ((fp->ptregs.vector & 0xc00) >> 8);
  680. switch (fs) {
  681. case 0x5:
  682. case 0x6:
  683. case 0x7:
  684. case 0x9:
  685. case 0xa:
  686. case 0xd:
  687. case 0xe:
  688. case 0xf:
  689. access_errorcf(fs, fp);
  690. return;
  691. default:
  692. break;
  693. }
  694. }
  695. #endif /* CONFIG_COLDFIRE && CONFIG_MMU */
  696. switch (fp->ptregs.format) {
  697. #if defined (CONFIG_M68060)
  698. case 4: /* 68060 access error */
  699. access_error060 (fp);
  700. break;
  701. #endif
  702. #if defined (CONFIG_M68040)
  703. case 0x7: /* 68040 access error */
  704. access_error040 (fp);
  705. break;
  706. #endif
  707. #if defined (CPU_M68020_OR_M68030)
  708. case 0xa:
  709. case 0xb:
  710. bus_error030 (fp);
  711. break;
  712. #endif
  713. default:
  714. die_if_kernel("bad frame format",&fp->ptregs,0);
  715. pr_debug("Unknown SIGSEGV - 4\n");
  716. force_sig(SIGSEGV, current);
  717. }
  718. }
  719. static int kstack_depth_to_print = 48;
  720. void show_trace(unsigned long *stack)
  721. {
  722. unsigned long *endstack;
  723. unsigned long addr;
  724. int i;
  725. pr_info("Call Trace:");
  726. addr = (unsigned long)stack + THREAD_SIZE - 1;
  727. endstack = (unsigned long *)(addr & -THREAD_SIZE);
  728. i = 0;
  729. while (stack + 1 <= endstack) {
  730. addr = *stack++;
  731. /*
  732. * If the address is either in the text segment of the
  733. * kernel, or in the region which contains vmalloc'ed
  734. * memory, it *may* be the address of a calling
  735. * routine; if so, print it so that someone tracing
  736. * down the cause of the crash will be able to figure
  737. * out the call path that was taken.
  738. */
  739. if (__kernel_text_address(addr)) {
  740. #ifndef CONFIG_KALLSYMS
  741. if (i % 5 == 0)
  742. pr_cont("\n ");
  743. #endif
  744. pr_cont(" [<%08lx>] %pS\n", addr, (void *)addr);
  745. i++;
  746. }
  747. }
  748. pr_cont("\n");
  749. }
  750. void show_registers(struct pt_regs *regs)
  751. {
  752. struct frame *fp = (struct frame *)regs;
  753. mm_segment_t old_fs = get_fs();
  754. u16 c, *cp;
  755. unsigned long addr;
  756. int i;
  757. print_modules();
  758. pr_info("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
  759. pr_info("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
  760. pr_info("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
  761. regs->d0, regs->d1, regs->d2, regs->d3);
  762. pr_info("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
  763. regs->d4, regs->d5, regs->a0, regs->a1);
  764. pr_info("Process %s (pid: %d, task=%p)\n",
  765. current->comm, task_pid_nr(current), current);
  766. addr = (unsigned long)&fp->un;
  767. pr_info("Frame format=%X ", regs->format);
  768. switch (regs->format) {
  769. case 0x2:
  770. pr_cont("instr addr=%08lx\n", fp->un.fmt2.iaddr);
  771. addr += sizeof(fp->un.fmt2);
  772. break;
  773. case 0x3:
  774. pr_cont("eff addr=%08lx\n", fp->un.fmt3.effaddr);
  775. addr += sizeof(fp->un.fmt3);
  776. break;
  777. case 0x4:
  778. if (CPU_IS_060)
  779. pr_cont("fault addr=%08lx fslw=%08lx\n",
  780. fp->un.fmt4.effaddr, fp->un.fmt4.pc);
  781. else
  782. pr_cont("eff addr=%08lx pc=%08lx\n",
  783. fp->un.fmt4.effaddr, fp->un.fmt4.pc);
  784. addr += sizeof(fp->un.fmt4);
  785. break;
  786. case 0x7:
  787. pr_cont("eff addr=%08lx ssw=%04x faddr=%08lx\n",
  788. fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
  789. pr_info("wb 1 stat/addr/data: %04x %08lx %08lx\n",
  790. fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
  791. pr_info("wb 2 stat/addr/data: %04x %08lx %08lx\n",
  792. fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
  793. pr_info("wb 3 stat/addr/data: %04x %08lx %08lx\n",
  794. fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
  795. pr_info("push data: %08lx %08lx %08lx %08lx\n",
  796. fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
  797. fp->un.fmt7.pd3);
  798. addr += sizeof(fp->un.fmt7);
  799. break;
  800. case 0x9:
  801. pr_cont("instr addr=%08lx\n", fp->un.fmt9.iaddr);
  802. addr += sizeof(fp->un.fmt9);
  803. break;
  804. case 0xa:
  805. pr_cont("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
  806. fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
  807. fp->un.fmta.daddr, fp->un.fmta.dobuf);
  808. addr += sizeof(fp->un.fmta);
  809. break;
  810. case 0xb:
  811. pr_cont("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
  812. fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
  813. fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
  814. pr_info("baddr=%08lx dibuf=%08lx ver=%x\n",
  815. fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
  816. addr += sizeof(fp->un.fmtb);
  817. break;
  818. default:
  819. pr_cont("\n");
  820. }
  821. show_stack(NULL, (unsigned long *)addr);
  822. pr_info("Code:");
  823. set_fs(KERNEL_DS);
  824. cp = (u16 *)regs->pc;
  825. for (i = -8; i < 16; i++) {
  826. if (get_user(c, cp + i) && i >= 0) {
  827. pr_cont(" Bad PC value.");
  828. break;
  829. }
  830. if (i)
  831. pr_cont(" %04x", c);
  832. else
  833. pr_cont(" <%04x>", c);
  834. }
  835. set_fs(old_fs);
  836. pr_cont("\n");
  837. }
  838. void show_stack(struct task_struct *task, unsigned long *stack)
  839. {
  840. unsigned long *p;
  841. unsigned long *endstack;
  842. int i;
  843. if (!stack) {
  844. if (task)
  845. stack = (unsigned long *)task->thread.esp0;
  846. else
  847. stack = (unsigned long *)&stack;
  848. }
  849. endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
  850. pr_info("Stack from %08lx:", (unsigned long)stack);
  851. p = stack;
  852. for (i = 0; i < kstack_depth_to_print; i++) {
  853. if (p + 1 > endstack)
  854. break;
  855. if (i % 8 == 0)
  856. pr_cont("\n ");
  857. pr_cont(" %08lx", *p++);
  858. }
  859. pr_cont("\n");
  860. show_trace(stack);
  861. }
  862. /*
  863. * The vector number returned in the frame pointer may also contain
  864. * the "fs" (Fault Status) bits on ColdFire. These are in the bottom
  865. * 2 bits, and upper 2 bits. So we need to mask out the real vector
  866. * number before using it in comparisons. You don't need to do this on
  867. * real 68k parts, but it won't hurt either.
  868. */
  869. void bad_super_trap (struct frame *fp)
  870. {
  871. int vector = (fp->ptregs.vector >> 2) & 0xff;
  872. console_verbose();
  873. if (vector < ARRAY_SIZE(vec_names))
  874. pr_err("*** %s *** FORMAT=%X\n",
  875. vec_names[vector],
  876. fp->ptregs.format);
  877. else
  878. pr_err("*** Exception %d *** FORMAT=%X\n",
  879. vector, fp->ptregs.format);
  880. if (vector == VEC_ADDRERR && CPU_IS_020_OR_030) {
  881. unsigned short ssw = fp->un.fmtb.ssw;
  882. pr_err("SSW=%#06x ", ssw);
  883. if (ssw & RC)
  884. pr_err("Pipe stage C instruction fault at %#010lx\n",
  885. (fp->ptregs.format) == 0xA ?
  886. fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2);
  887. if (ssw & RB)
  888. pr_err("Pipe stage B instruction fault at %#010lx\n",
  889. (fp->ptregs.format) == 0xA ?
  890. fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
  891. if (ssw & DF)
  892. pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
  893. ssw & RW ? "read" : "write",
  894. fp->un.fmtb.daddr, space_names[ssw & DFC],
  895. fp->ptregs.pc);
  896. }
  897. pr_err("Current process id is %d\n", task_pid_nr(current));
  898. die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
  899. }
  900. asmlinkage void trap_c(struct frame *fp)
  901. {
  902. int sig;
  903. int vector = (fp->ptregs.vector >> 2) & 0xff;
  904. siginfo_t info;
  905. if (fp->ptregs.sr & PS_S) {
  906. if (vector == VEC_TRACE) {
  907. /* traced a trapping instruction on a 68020/30,
  908. * real exception will be executed afterwards.
  909. */
  910. } else if (!handle_kernel_fault(&fp->ptregs))
  911. bad_super_trap(fp);
  912. return;
  913. }
  914. /* send the appropriate signal to the user program */
  915. switch (vector) {
  916. case VEC_ADDRERR:
  917. info.si_code = BUS_ADRALN;
  918. sig = SIGBUS;
  919. break;
  920. case VEC_ILLEGAL:
  921. case VEC_LINE10:
  922. case VEC_LINE11:
  923. info.si_code = ILL_ILLOPC;
  924. sig = SIGILL;
  925. break;
  926. case VEC_PRIV:
  927. info.si_code = ILL_PRVOPC;
  928. sig = SIGILL;
  929. break;
  930. case VEC_COPROC:
  931. info.si_code = ILL_COPROC;
  932. sig = SIGILL;
  933. break;
  934. case VEC_TRAP1:
  935. case VEC_TRAP2:
  936. case VEC_TRAP3:
  937. case VEC_TRAP4:
  938. case VEC_TRAP5:
  939. case VEC_TRAP6:
  940. case VEC_TRAP7:
  941. case VEC_TRAP8:
  942. case VEC_TRAP9:
  943. case VEC_TRAP10:
  944. case VEC_TRAP11:
  945. case VEC_TRAP12:
  946. case VEC_TRAP13:
  947. case VEC_TRAP14:
  948. info.si_code = ILL_ILLTRP;
  949. sig = SIGILL;
  950. break;
  951. case VEC_FPBRUC:
  952. case VEC_FPOE:
  953. case VEC_FPNAN:
  954. info.si_code = FPE_FLTINV;
  955. sig = SIGFPE;
  956. break;
  957. case VEC_FPIR:
  958. info.si_code = FPE_FLTRES;
  959. sig = SIGFPE;
  960. break;
  961. case VEC_FPDIVZ:
  962. info.si_code = FPE_FLTDIV;
  963. sig = SIGFPE;
  964. break;
  965. case VEC_FPUNDER:
  966. info.si_code = FPE_FLTUND;
  967. sig = SIGFPE;
  968. break;
  969. case VEC_FPOVER:
  970. info.si_code = FPE_FLTOVF;
  971. sig = SIGFPE;
  972. break;
  973. case VEC_ZERODIV:
  974. info.si_code = FPE_INTDIV;
  975. sig = SIGFPE;
  976. break;
  977. case VEC_CHK:
  978. case VEC_TRAP:
  979. info.si_code = FPE_INTOVF;
  980. sig = SIGFPE;
  981. break;
  982. case VEC_TRACE: /* ptrace single step */
  983. info.si_code = TRAP_TRACE;
  984. sig = SIGTRAP;
  985. break;
  986. case VEC_TRAP15: /* breakpoint */
  987. info.si_code = TRAP_BRKPT;
  988. sig = SIGTRAP;
  989. break;
  990. default:
  991. info.si_code = ILL_ILLOPC;
  992. sig = SIGILL;
  993. break;
  994. }
  995. info.si_signo = sig;
  996. info.si_errno = 0;
  997. switch (fp->ptregs.format) {
  998. default:
  999. info.si_addr = (void *) fp->ptregs.pc;
  1000. break;
  1001. case 2:
  1002. info.si_addr = (void *) fp->un.fmt2.iaddr;
  1003. break;
  1004. case 7:
  1005. info.si_addr = (void *) fp->un.fmt7.effaddr;
  1006. break;
  1007. case 9:
  1008. info.si_addr = (void *) fp->un.fmt9.iaddr;
  1009. break;
  1010. case 10:
  1011. info.si_addr = (void *) fp->un.fmta.daddr;
  1012. break;
  1013. case 11:
  1014. info.si_addr = (void *) fp->un.fmtb.daddr;
  1015. break;
  1016. }
  1017. force_sig_info (sig, &info, current);
  1018. }
  1019. void die_if_kernel (char *str, struct pt_regs *fp, int nr)
  1020. {
  1021. if (!(fp->sr & PS_S))
  1022. return;
  1023. console_verbose();
  1024. pr_crit("%s: %08x\n", str, nr);
  1025. show_registers(fp);
  1026. add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
  1027. do_exit(SIGSEGV);
  1028. }
  1029. asmlinkage void set_esp0(unsigned long ssp)
  1030. {
  1031. current->thread.esp0 = ssp;
  1032. }
  1033. /*
  1034. * This function is called if an error occur while accessing
  1035. * user-space from the fpsp040 code.
  1036. */
  1037. asmlinkage void fpsp040_die(void)
  1038. {
  1039. do_exit(SIGSEGV);
  1040. }
  1041. #ifdef CONFIG_M68KFPU_EMU
  1042. asmlinkage void fpemu_signal(int signal, int code, void *addr)
  1043. {
  1044. siginfo_t info;
  1045. info.si_signo = signal;
  1046. info.si_errno = 0;
  1047. info.si_code = code;
  1048. info.si_addr = addr;
  1049. force_sig_info(signal, &info, current);
  1050. }
  1051. #endif