traps.c 18 KB

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