traps.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. /*
  2. * Architecture-specific trap handling.
  3. *
  4. * Copyright (C) 1998-2003 Hewlett-Packard Co
  5. * David Mosberger-Tang <davidm@hpl.hp.com>
  6. *
  7. * 05/12/00 grao <goutham.rao@intel.com> : added isr in siginfo for SIGFPE
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/init.h>
  11. #include <linux/sched.h>
  12. #include <linux/tty.h>
  13. #include <linux/vt_kern.h> /* For unblank_screen() */
  14. #include <linux/module.h> /* for EXPORT_SYMBOL */
  15. #include <linux/hardirq.h>
  16. #include <linux/kprobes.h>
  17. #include <linux/delay.h> /* for ssleep() */
  18. #include <linux/kdebug.h>
  19. #include <asm/fpswa.h>
  20. #include <asm/intrinsics.h>
  21. #include <asm/processor.h>
  22. #include <asm/uaccess.h>
  23. #include <asm/setup.h>
  24. fpswa_interface_t *fpswa_interface;
  25. EXPORT_SYMBOL(fpswa_interface);
  26. void __init
  27. trap_init (void)
  28. {
  29. if (ia64_boot_param->fpswa)
  30. /* FPSWA fixup: make the interface pointer a kernel virtual address: */
  31. fpswa_interface = __va(ia64_boot_param->fpswa);
  32. }
  33. int
  34. die (const char *str, struct pt_regs *regs, long err)
  35. {
  36. static struct {
  37. spinlock_t lock;
  38. u32 lock_owner;
  39. int lock_owner_depth;
  40. } die = {
  41. .lock = __SPIN_LOCK_UNLOCKED(die.lock),
  42. .lock_owner = -1,
  43. .lock_owner_depth = 0
  44. };
  45. static int die_counter;
  46. int cpu = get_cpu();
  47. if (die.lock_owner != cpu) {
  48. console_verbose();
  49. spin_lock_irq(&die.lock);
  50. die.lock_owner = cpu;
  51. die.lock_owner_depth = 0;
  52. bust_spinlocks(1);
  53. }
  54. put_cpu();
  55. if (++die.lock_owner_depth < 3) {
  56. printk("%s[%d]: %s %ld [%d]\n",
  57. current->comm, task_pid_nr(current), str, err, ++die_counter);
  58. if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV)
  59. != NOTIFY_STOP)
  60. show_regs(regs);
  61. else
  62. regs = NULL;
  63. } else
  64. printk(KERN_ERR "Recursive die() failure, output suppressed\n");
  65. bust_spinlocks(0);
  66. die.lock_owner = -1;
  67. add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
  68. spin_unlock_irq(&die.lock);
  69. if (!regs)
  70. return 1;
  71. if (panic_on_oops)
  72. panic("Fatal exception");
  73. do_exit(SIGSEGV);
  74. return 0;
  75. }
  76. int
  77. die_if_kernel (char *str, struct pt_regs *regs, long err)
  78. {
  79. if (!user_mode(regs))
  80. return die(str, regs, err);
  81. return 0;
  82. }
  83. void
  84. __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
  85. {
  86. siginfo_t siginfo;
  87. int sig, code;
  88. /* SIGILL, SIGFPE, SIGSEGV, and SIGBUS want these field initialized: */
  89. siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
  90. siginfo.si_imm = break_num;
  91. siginfo.si_flags = 0; /* clear __ISR_VALID */
  92. siginfo.si_isr = 0;
  93. switch (break_num) {
  94. case 0: /* unknown error (used by GCC for __builtin_abort()) */
  95. if (notify_die(DIE_BREAK, "break 0", regs, break_num, TRAP_BRKPT, SIGTRAP)
  96. == NOTIFY_STOP)
  97. return;
  98. if (die_if_kernel("bugcheck!", regs, break_num))
  99. return;
  100. sig = SIGILL; code = ILL_ILLOPC;
  101. break;
  102. case 1: /* integer divide by zero */
  103. sig = SIGFPE; code = FPE_INTDIV;
  104. break;
  105. case 2: /* integer overflow */
  106. sig = SIGFPE; code = FPE_INTOVF;
  107. break;
  108. case 3: /* range check/bounds check */
  109. sig = SIGFPE; code = FPE_FLTSUB;
  110. break;
  111. case 4: /* null pointer dereference */
  112. sig = SIGSEGV; code = SEGV_MAPERR;
  113. break;
  114. case 5: /* misaligned data */
  115. sig = SIGSEGV; code = BUS_ADRALN;
  116. break;
  117. case 6: /* decimal overflow */
  118. sig = SIGFPE; code = __FPE_DECOVF;
  119. break;
  120. case 7: /* decimal divide by zero */
  121. sig = SIGFPE; code = __FPE_DECDIV;
  122. break;
  123. case 8: /* packed decimal error */
  124. sig = SIGFPE; code = __FPE_DECERR;
  125. break;
  126. case 9: /* invalid ASCII digit */
  127. sig = SIGFPE; code = __FPE_INVASC;
  128. break;
  129. case 10: /* invalid decimal digit */
  130. sig = SIGFPE; code = __FPE_INVDEC;
  131. break;
  132. case 11: /* paragraph stack overflow */
  133. sig = SIGSEGV; code = __SEGV_PSTKOVF;
  134. break;
  135. case 0x3f000 ... 0x3ffff: /* bundle-update in progress */
  136. sig = SIGILL; code = __ILL_BNDMOD;
  137. break;
  138. default:
  139. if ((break_num < 0x40000 || break_num > 0x100000)
  140. && die_if_kernel("Bad break", regs, break_num))
  141. return;
  142. if (break_num < 0x80000) {
  143. sig = SIGILL; code = __ILL_BREAK;
  144. } else {
  145. if (notify_die(DIE_BREAK, "bad break", regs, break_num, TRAP_BRKPT, SIGTRAP)
  146. == NOTIFY_STOP)
  147. return;
  148. sig = SIGTRAP; code = TRAP_BRKPT;
  149. }
  150. }
  151. siginfo.si_signo = sig;
  152. siginfo.si_errno = 0;
  153. siginfo.si_code = code;
  154. force_sig_info(sig, &siginfo, current);
  155. }
  156. /*
  157. * disabled_fph_fault() is called when a user-level process attempts to access f32..f127
  158. * and it doesn't own the fp-high register partition. When this happens, we save the
  159. * current fph partition in the task_struct of the fpu-owner (if necessary) and then load
  160. * the fp-high partition of the current task (if necessary). Note that the kernel has
  161. * access to fph by the time we get here, as the IVT's "Disabled FP-Register" handler takes
  162. * care of clearing psr.dfh.
  163. */
  164. static inline void
  165. disabled_fph_fault (struct pt_regs *regs)
  166. {
  167. struct ia64_psr *psr = ia64_psr(regs);
  168. /* first, grant user-level access to fph partition: */
  169. psr->dfh = 0;
  170. /*
  171. * Make sure that no other task gets in on this processor
  172. * while we're claiming the FPU
  173. */
  174. preempt_disable();
  175. #ifndef CONFIG_SMP
  176. {
  177. struct task_struct *fpu_owner
  178. = (struct task_struct *)ia64_get_kr(IA64_KR_FPU_OWNER);
  179. if (ia64_is_local_fpu_owner(current)) {
  180. preempt_enable_no_resched();
  181. return;
  182. }
  183. if (fpu_owner)
  184. ia64_flush_fph(fpu_owner);
  185. }
  186. #endif /* !CONFIG_SMP */
  187. ia64_set_local_fpu_owner(current);
  188. if ((current->thread.flags & IA64_THREAD_FPH_VALID) != 0) {
  189. __ia64_load_fpu(current->thread.fph);
  190. psr->mfh = 0;
  191. } else {
  192. __ia64_init_fpu();
  193. /*
  194. * Set mfh because the state in thread.fph does not match the state in
  195. * the fph partition.
  196. */
  197. psr->mfh = 1;
  198. }
  199. preempt_enable_no_resched();
  200. }
  201. static inline int
  202. fp_emulate (int fp_fault, void *bundle, long *ipsr, long *fpsr, long *isr, long *pr, long *ifs,
  203. struct pt_regs *regs)
  204. {
  205. fp_state_t fp_state;
  206. fpswa_ret_t ret;
  207. if (!fpswa_interface)
  208. return -1;
  209. memset(&fp_state, 0, sizeof(fp_state_t));
  210. /*
  211. * compute fp_state. only FP registers f6 - f11 are used by the
  212. * kernel, so set those bits in the mask and set the low volatile
  213. * pointer to point to these registers.
  214. */
  215. fp_state.bitmask_low64 = 0xfc0; /* bit6..bit11 */
  216. fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) &regs->f6;
  217. /*
  218. * unsigned long (*EFI_FPSWA) (
  219. * unsigned long trap_type,
  220. * void *Bundle,
  221. * unsigned long *pipsr,
  222. * unsigned long *pfsr,
  223. * unsigned long *pisr,
  224. * unsigned long *ppreds,
  225. * unsigned long *pifs,
  226. * void *fp_state);
  227. */
  228. ret = (*fpswa_interface->fpswa)((unsigned long) fp_fault, bundle,
  229. (unsigned long *) ipsr, (unsigned long *) fpsr,
  230. (unsigned long *) isr, (unsigned long *) pr,
  231. (unsigned long *) ifs, &fp_state);
  232. return ret.status;
  233. }
  234. struct fpu_swa_msg {
  235. unsigned long count;
  236. unsigned long time;
  237. };
  238. static DEFINE_PER_CPU(struct fpu_swa_msg, cpulast);
  239. DECLARE_PER_CPU(struct fpu_swa_msg, cpulast);
  240. static struct fpu_swa_msg last __cacheline_aligned;
  241. /*
  242. * Handle floating-point assist faults and traps.
  243. */
  244. static int
  245. handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
  246. {
  247. long exception, bundle[2];
  248. unsigned long fault_ip;
  249. struct siginfo siginfo;
  250. fault_ip = regs->cr_iip;
  251. if (!fp_fault && (ia64_psr(regs)->ri == 0))
  252. fault_ip -= 16;
  253. if (copy_from_user(bundle, (void __user *) fault_ip, sizeof(bundle)))
  254. return -1;
  255. if (!(current->thread.flags & IA64_THREAD_FPEMU_NOPRINT)) {
  256. unsigned long count, current_jiffies = jiffies;
  257. struct fpu_swa_msg *cp = this_cpu_ptr(&cpulast);
  258. if (unlikely(current_jiffies > cp->time))
  259. cp->count = 0;
  260. if (unlikely(cp->count < 5)) {
  261. cp->count++;
  262. cp->time = current_jiffies + 5 * HZ;
  263. /* minimize races by grabbing a copy of count BEFORE checking last.time. */
  264. count = last.count;
  265. barrier();
  266. /*
  267. * Lower 4 bits are used as a count. Upper bits are a sequence
  268. * number that is updated when count is reset. The cmpxchg will
  269. * fail is seqno has changed. This minimizes mutiple cpus
  270. * resetting the count.
  271. */
  272. if (current_jiffies > last.time)
  273. (void) cmpxchg_acq(&last.count, count, 16 + (count & ~15));
  274. /* used fetchadd to atomically update the count */
  275. if ((last.count & 15) < 5 && (ia64_fetchadd(1, &last.count, acq) & 15) < 5) {
  276. last.time = current_jiffies + 5 * HZ;
  277. printk(KERN_WARNING
  278. "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
  279. current->comm, task_pid_nr(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
  280. }
  281. }
  282. }
  283. exception = fp_emulate(fp_fault, bundle, &regs->cr_ipsr, &regs->ar_fpsr, &isr, &regs->pr,
  284. &regs->cr_ifs, regs);
  285. if (fp_fault) {
  286. if (exception == 0) {
  287. /* emulation was successful */
  288. ia64_increment_ip(regs);
  289. } else if (exception == -1) {
  290. printk(KERN_ERR "handle_fpu_swa: fp_emulate() returned -1\n");
  291. return -1;
  292. } else {
  293. /* is next instruction a trap? */
  294. if (exception & 2) {
  295. ia64_increment_ip(regs);
  296. }
  297. siginfo.si_signo = SIGFPE;
  298. siginfo.si_errno = 0;
  299. siginfo.si_code = __SI_FAULT; /* default code */
  300. siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
  301. if (isr & 0x11) {
  302. siginfo.si_code = FPE_FLTINV;
  303. } else if (isr & 0x22) {
  304. /* denormal operand gets the same si_code as underflow
  305. * see arch/i386/kernel/traps.c:math_error() */
  306. siginfo.si_code = FPE_FLTUND;
  307. } else if (isr & 0x44) {
  308. siginfo.si_code = FPE_FLTDIV;
  309. }
  310. siginfo.si_isr = isr;
  311. siginfo.si_flags = __ISR_VALID;
  312. siginfo.si_imm = 0;
  313. force_sig_info(SIGFPE, &siginfo, current);
  314. }
  315. } else {
  316. if (exception == -1) {
  317. printk(KERN_ERR "handle_fpu_swa: fp_emulate() returned -1\n");
  318. return -1;
  319. } else if (exception != 0) {
  320. /* raise exception */
  321. siginfo.si_signo = SIGFPE;
  322. siginfo.si_errno = 0;
  323. siginfo.si_code = __SI_FAULT; /* default code */
  324. siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
  325. if (isr & 0x880) {
  326. siginfo.si_code = FPE_FLTOVF;
  327. } else if (isr & 0x1100) {
  328. siginfo.si_code = FPE_FLTUND;
  329. } else if (isr & 0x2200) {
  330. siginfo.si_code = FPE_FLTRES;
  331. }
  332. siginfo.si_isr = isr;
  333. siginfo.si_flags = __ISR_VALID;
  334. siginfo.si_imm = 0;
  335. force_sig_info(SIGFPE, &siginfo, current);
  336. }
  337. }
  338. return 0;
  339. }
  340. struct illegal_op_return {
  341. unsigned long fkt, arg1, arg2, arg3;
  342. };
  343. struct illegal_op_return
  344. ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3,
  345. long arg4, long arg5, long arg6, long arg7,
  346. struct pt_regs regs)
  347. {
  348. struct illegal_op_return rv;
  349. struct siginfo si;
  350. char buf[128];
  351. #ifdef CONFIG_IA64_BRL_EMU
  352. {
  353. extern struct illegal_op_return ia64_emulate_brl (struct pt_regs *, unsigned long);
  354. rv = ia64_emulate_brl(&regs, ec);
  355. if (rv.fkt != (unsigned long) -1)
  356. return rv;
  357. }
  358. #endif
  359. sprintf(buf, "IA-64 Illegal operation fault");
  360. rv.fkt = 0;
  361. if (die_if_kernel(buf, &regs, 0))
  362. return rv;
  363. memset(&si, 0, sizeof(si));
  364. si.si_signo = SIGILL;
  365. si.si_code = ILL_ILLOPC;
  366. si.si_addr = (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri);
  367. force_sig_info(SIGILL, &si, current);
  368. return rv;
  369. }
  370. void __kprobes
  371. ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
  372. unsigned long iim, unsigned long itir, long arg5, long arg6,
  373. long arg7, struct pt_regs regs)
  374. {
  375. unsigned long code, error = isr, iip;
  376. struct siginfo siginfo;
  377. char buf[128];
  378. int result, sig;
  379. static const char *reason[] = {
  380. "IA-64 Illegal Operation fault",
  381. "IA-64 Privileged Operation fault",
  382. "IA-64 Privileged Register fault",
  383. "IA-64 Reserved Register/Field fault",
  384. "Disabled Instruction Set Transition fault",
  385. "Unknown fault 5", "Unknown fault 6", "Unknown fault 7", "Illegal Hazard fault",
  386. "Unknown fault 9", "Unknown fault 10", "Unknown fault 11", "Unknown fault 12",
  387. "Unknown fault 13", "Unknown fault 14", "Unknown fault 15"
  388. };
  389. if ((isr & IA64_ISR_NA) && ((isr & IA64_ISR_CODE_MASK) == IA64_ISR_CODE_LFETCH)) {
  390. /*
  391. * This fault was due to lfetch.fault, set "ed" bit in the psr to cancel
  392. * the lfetch.
  393. */
  394. ia64_psr(&regs)->ed = 1;
  395. return;
  396. }
  397. iip = regs.cr_iip + ia64_psr(&regs)->ri;
  398. switch (vector) {
  399. case 24: /* General Exception */
  400. code = (isr >> 4) & 0xf;
  401. sprintf(buf, "General Exception: %s%s", reason[code],
  402. (code == 3) ? ((isr & (1UL << 37))
  403. ? " (RSE access)" : " (data access)") : "");
  404. if (code == 8) {
  405. # ifdef CONFIG_IA64_PRINT_HAZARDS
  406. printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n",
  407. current->comm, task_pid_nr(current),
  408. regs.cr_iip + ia64_psr(&regs)->ri, regs.pr);
  409. # endif
  410. return;
  411. }
  412. break;
  413. case 25: /* Disabled FP-Register */
  414. if (isr & 2) {
  415. disabled_fph_fault(&regs);
  416. return;
  417. }
  418. sprintf(buf, "Disabled FPL fault---not supposed to happen!");
  419. break;
  420. case 26: /* NaT Consumption */
  421. if (user_mode(&regs)) {
  422. void __user *addr;
  423. if (((isr >> 4) & 0xf) == 2) {
  424. /* NaT page consumption */
  425. sig = SIGSEGV;
  426. code = SEGV_ACCERR;
  427. addr = (void __user *) ifa;
  428. } else {
  429. /* register NaT consumption */
  430. sig = SIGILL;
  431. code = ILL_ILLOPN;
  432. addr = (void __user *) (regs.cr_iip
  433. + ia64_psr(&regs)->ri);
  434. }
  435. siginfo.si_signo = sig;
  436. siginfo.si_code = code;
  437. siginfo.si_errno = 0;
  438. siginfo.si_addr = addr;
  439. siginfo.si_imm = vector;
  440. siginfo.si_flags = __ISR_VALID;
  441. siginfo.si_isr = isr;
  442. force_sig_info(sig, &siginfo, current);
  443. return;
  444. } else if (ia64_done_with_exception(&regs))
  445. return;
  446. sprintf(buf, "NaT consumption");
  447. break;
  448. case 31: /* Unsupported Data Reference */
  449. if (user_mode(&regs)) {
  450. siginfo.si_signo = SIGILL;
  451. siginfo.si_code = ILL_ILLOPN;
  452. siginfo.si_errno = 0;
  453. siginfo.si_addr = (void __user *) iip;
  454. siginfo.si_imm = vector;
  455. siginfo.si_flags = __ISR_VALID;
  456. siginfo.si_isr = isr;
  457. force_sig_info(SIGILL, &siginfo, current);
  458. return;
  459. }
  460. sprintf(buf, "Unsupported data reference");
  461. break;
  462. case 29: /* Debug */
  463. case 35: /* Taken Branch Trap */
  464. case 36: /* Single Step Trap */
  465. if (fsys_mode(current, &regs)) {
  466. extern char __kernel_syscall_via_break[];
  467. /*
  468. * Got a trap in fsys-mode: Taken Branch Trap
  469. * and Single Step trap need special handling;
  470. * Debug trap is ignored (we disable it here
  471. * and re-enable it in the lower-privilege trap).
  472. */
  473. if (unlikely(vector == 29)) {
  474. set_thread_flag(TIF_DB_DISABLED);
  475. ia64_psr(&regs)->db = 0;
  476. ia64_psr(&regs)->lp = 1;
  477. return;
  478. }
  479. /* re-do the system call via break 0x100000: */
  480. regs.cr_iip = (unsigned long) __kernel_syscall_via_break;
  481. ia64_psr(&regs)->ri = 0;
  482. ia64_psr(&regs)->cpl = 3;
  483. return;
  484. }
  485. switch (vector) {
  486. case 29:
  487. siginfo.si_code = TRAP_HWBKPT;
  488. #ifdef CONFIG_ITANIUM
  489. /*
  490. * Erratum 10 (IFA may contain incorrect address) now has
  491. * "NoFix" status. There are no plans for fixing this.
  492. */
  493. if (ia64_psr(&regs)->is == 0)
  494. ifa = regs.cr_iip;
  495. #endif
  496. break;
  497. case 35: siginfo.si_code = TRAP_BRANCH; ifa = 0; break;
  498. case 36: siginfo.si_code = TRAP_TRACE; ifa = 0; break;
  499. }
  500. if (notify_die(DIE_FAULT, "ia64_fault", &regs, vector, siginfo.si_code, SIGTRAP)
  501. == NOTIFY_STOP)
  502. return;
  503. siginfo.si_signo = SIGTRAP;
  504. siginfo.si_errno = 0;
  505. siginfo.si_addr = (void __user *) ifa;
  506. siginfo.si_imm = 0;
  507. siginfo.si_flags = __ISR_VALID;
  508. siginfo.si_isr = isr;
  509. force_sig_info(SIGTRAP, &siginfo, current);
  510. return;
  511. case 32: /* fp fault */
  512. case 33: /* fp trap */
  513. result = handle_fpu_swa((vector == 32) ? 1 : 0, &regs, isr);
  514. if ((result < 0) || (current->thread.flags & IA64_THREAD_FPEMU_SIGFPE)) {
  515. siginfo.si_signo = SIGFPE;
  516. siginfo.si_errno = 0;
  517. siginfo.si_code = FPE_FLTINV;
  518. siginfo.si_addr = (void __user *) iip;
  519. siginfo.si_flags = __ISR_VALID;
  520. siginfo.si_isr = isr;
  521. siginfo.si_imm = 0;
  522. force_sig_info(SIGFPE, &siginfo, current);
  523. }
  524. return;
  525. case 34:
  526. if (isr & 0x2) {
  527. /* Lower-Privilege Transfer Trap */
  528. /* If we disabled debug traps during an fsyscall,
  529. * re-enable them here.
  530. */
  531. if (test_thread_flag(TIF_DB_DISABLED)) {
  532. clear_thread_flag(TIF_DB_DISABLED);
  533. ia64_psr(&regs)->db = 1;
  534. }
  535. /*
  536. * Just clear PSR.lp and then return immediately:
  537. * all the interesting work (e.g., signal delivery)
  538. * is done in the kernel exit path.
  539. */
  540. ia64_psr(&regs)->lp = 0;
  541. return;
  542. } else {
  543. /* Unimplemented Instr. Address Trap */
  544. if (user_mode(&regs)) {
  545. siginfo.si_signo = SIGILL;
  546. siginfo.si_code = ILL_BADIADDR;
  547. siginfo.si_errno = 0;
  548. siginfo.si_flags = 0;
  549. siginfo.si_isr = 0;
  550. siginfo.si_imm = 0;
  551. siginfo.si_addr = (void __user *) iip;
  552. force_sig_info(SIGILL, &siginfo, current);
  553. return;
  554. }
  555. sprintf(buf, "Unimplemented Instruction Address fault");
  556. }
  557. break;
  558. case 45:
  559. printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n");
  560. printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
  561. iip, ifa, isr);
  562. force_sig(SIGSEGV, current);
  563. return;
  564. case 46:
  565. printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
  566. printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim - 0x%lx\n",
  567. iip, ifa, isr, iim);
  568. force_sig(SIGSEGV, current);
  569. return;
  570. case 47:
  571. sprintf(buf, "IA-32 Interruption Fault (int 0x%lx)", isr >> 16);
  572. break;
  573. default:
  574. sprintf(buf, "Fault %lu", vector);
  575. break;
  576. }
  577. if (!die_if_kernel(buf, &regs, error))
  578. force_sig(SIGILL, current);
  579. }