traps.c 18 KB

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