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