2 * linux/arch/x86-64/traps.c
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
7 * Pentium III FXSR, SSE support
8 * Gareth Hughes <gareth@valinux.com>, May 2000
10 * $Id: traps.c,v 1.36 2002/03/24 11:09:10 ak Exp $
14 * 'Traps.c' handles hardware traps and faults after we have saved some
17 #include <linux/config.h>
18 #include <linux/sched.h>
19 #include <linux/kernel.h>
20 #include <linux/string.h>
21 #include <linux/errno.h>
22 #include <linux/ptrace.h>
23 #include <linux/timer.h>
25 #include <linux/init.h>
26 #include <linux/delay.h>
27 #include <linux/spinlock.h>
28 #include <linux/interrupt.h>
29 #include <linux/module.h>
30 #include <linux/moduleparam.h>
32 #include <asm/system.h>
33 #include <asm/uaccess.h>
35 #include <asm/atomic.h>
36 #include <asm/debugreg.h>
39 #include <asm/kdebug.h>
40 #include <asm/processor.h>
43 #include <asm/pgalloc.h>
45 #include <asm/proto.h>
48 #include <linux/irq.h>
51 extern struct gate_struct idt_table[256];
53 asmlinkage void divide_error(void);
54 asmlinkage void debug(void);
55 asmlinkage void nmi(void);
56 asmlinkage void int3(void);
57 asmlinkage void overflow(void);
58 asmlinkage void bounds(void);
59 asmlinkage void invalid_op(void);
60 asmlinkage void device_not_available(void);
61 asmlinkage void double_fault(void);
62 asmlinkage void coprocessor_segment_overrun(void);
63 asmlinkage void invalid_TSS(void);
64 asmlinkage void segment_not_present(void);
65 asmlinkage void stack_segment(void);
66 asmlinkage void general_protection(void);
67 asmlinkage void page_fault(void);
68 asmlinkage void coprocessor_error(void);
69 asmlinkage void simd_coprocessor_error(void);
70 asmlinkage void reserved(void);
71 asmlinkage void alignment_check(void);
72 asmlinkage void machine_check(void);
73 asmlinkage void spurious_interrupt_bug(void);
74 asmlinkage void call_debug(void);
76 struct notifier_block *die_chain;
77 static DEFINE_SPINLOCK(die_notifier_lock);
79 int register_die_notifier(struct notifier_block *nb)
83 spin_lock_irqsave(&die_notifier_lock, flags);
84 err = notifier_chain_register(&die_chain, nb);
85 spin_unlock_irqrestore(&die_notifier_lock, flags);
89 static inline void conditional_sti(struct pt_regs *regs)
91 if (regs->eflags & X86_EFLAGS_IF)
95 static int kstack_depth_to_print = 10;
97 #ifdef CONFIG_KALLSYMS
98 #include <linux/kallsyms.h>
99 int printk_address(unsigned long address)
101 unsigned long offset = 0, symsize;
107 symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
109 return printk("[<%016lx>]", address);
111 modname = delim = "";
112 return printk("<%016lx>{%s%s%s%s%+ld}",
113 address,delim,modname,delim,symname,offset);
116 int printk_address(unsigned long address)
118 return printk("[<%016lx>]", address);
122 unsigned long *in_exception_stack(int cpu, unsigned long stack)
125 for (k = 0; k < N_EXCEPTION_STACKS; k++) {
126 struct tss_struct *tss = &per_cpu(init_tss, cpu);
127 unsigned long end = tss->ist[k] + EXCEPTION_STKSZ;
129 if (stack >= tss->ist[k] && stack <= end)
130 return (unsigned long *)end;
136 * x86-64 can have upto three kernel stacks:
139 * severe exception (double fault, nmi, stack fault) hardware stack
140 * Check and process them in order.
143 void show_trace(unsigned long *stack)
146 unsigned long *irqstack, *irqstack_end, *estack_end;
147 const int cpu = safe_smp_processor_id();
150 printk("\nCall Trace:");
153 estack_end = in_exception_stack(cpu, (unsigned long)stack);
155 while (stack < estack_end) {
157 if (__kernel_text_address(addr)) {
158 i += printk_address(addr);
166 i += printk(" <EOE> ");
168 stack = (unsigned long *) estack_end[-2];
171 irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr);
172 irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE + 64);
174 if (stack >= irqstack && stack < irqstack_end) {
176 while (stack < irqstack_end) {
179 * If the address is either in the text segment of the
180 * kernel, or in the region which contains vmalloc'ed
181 * memory, it *may* be the address of a calling
182 * routine; if so, print it so that someone tracing
183 * down the cause of the crash will be able to figure
184 * out the call path that was taken.
186 if (__kernel_text_address(addr)) {
187 i += printk_address(addr);
195 stack = (unsigned long *) (irqstack_end[-1]);
200 while (((long) stack & (THREAD_SIZE-1)) != 0) {
202 if (__kernel_text_address(addr)) {
203 i += printk_address(addr);
214 void show_stack(struct task_struct *tsk, unsigned long * rsp)
216 unsigned long *stack;
218 const int cpu = safe_smp_processor_id();
219 unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr);
220 unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE);
222 // debugging aid: "show_stack(NULL, NULL);" prints the
223 // back trace for this cpu.
227 rsp = (unsigned long *)tsk->thread.rsp;
229 rsp = (unsigned long *)&rsp;
233 for(i=0; i < kstack_depth_to_print; i++) {
234 if (stack >= irqstack && stack <= irqstack_end) {
235 if (stack == irqstack_end) {
236 stack = (unsigned long *) (irqstack_end[-1]);
240 if (((long) stack & (THREAD_SIZE-1)) == 0)
243 if (i && ((i % 4) == 0))
245 printk("%016lx ", *stack++);
247 show_trace((unsigned long *)rsp);
251 * The architecture-independent dump_stack generator
253 void dump_stack(void)
259 EXPORT_SYMBOL(dump_stack);
261 void show_registers(struct pt_regs *regs)
264 int in_kernel = (regs->cs & 3) == 0;
266 const int cpu = safe_smp_processor_id();
267 struct task_struct *cur = cpu_pda[cpu].pcurrent;
271 printk("CPU %d ", cpu);
273 printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
274 cur->comm, cur->pid, cur->thread_info, cur);
277 * When in-kernel, we also print out the stack and code at the
278 * time of the fault..
283 show_stack(NULL, (unsigned long*)rsp);
286 if(regs->rip < PAGE_OFFSET)
292 if(__get_user(c, &((unsigned char*)regs->rip)[i])) {
294 printk(" Bad RIP value.");
303 void handle_BUG(struct pt_regs *regs)
310 if (__copy_from_user(&f, (struct bug_frame *) regs->rip,
311 sizeof(struct bug_frame)))
313 if ((unsigned long)f.filename < __PAGE_OFFSET ||
314 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b)
316 if (__get_user(tmp, f.filename))
317 f.filename = "unmapped filename";
318 printk("----------- [cut here ] --------- [please bite here ] ---------\n");
319 printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line);
322 void out_of_line_bug(void)
327 static DEFINE_SPINLOCK(die_lock);
328 static int die_owner = -1;
330 void oops_begin(void)
332 int cpu = safe_smp_processor_id();
333 /* racy, but better than risking deadlock. */
335 if (!spin_trylock(&die_lock)) {
336 if (cpu == die_owner)
337 /* nested oops. should stop eventually */;
339 spin_lock(&die_lock);
350 spin_unlock(&die_lock);
351 local_irq_enable(); /* make sure back scroll still works */
356 void __die(const char * str, struct pt_regs * regs, long err)
358 static int die_counter;
359 printk(KERN_EMERG "%s: %04lx [%u] ", str, err & 0xffff,++die_counter);
360 #ifdef CONFIG_PREEMPT
366 #ifdef CONFIG_DEBUG_PAGEALLOC
367 printk("DEBUG_PAGEALLOC");
370 notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
371 show_registers(regs);
372 /* Executive summary in case the oops scrolled away */
373 printk(KERN_ALERT "RIP ");
374 printk_address(regs->rip);
375 printk(" RSP <%016lx>\n", regs->rsp);
378 void die(const char * str, struct pt_regs * regs, long err)
382 __die(str, regs, err);
386 static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
388 if (!(regs->eflags & VM_MASK) && (regs->cs == __KERNEL_CS))
393 void die_nmi(char *str, struct pt_regs *regs)
397 * We are in trouble anyway, lets at least try
398 * to get a message out.
400 printk(str, safe_smp_processor_id());
401 show_registers(regs);
402 if (panic_on_timeout || panic_on_oops)
403 panic("nmi watchdog");
404 printk("console shuts up ...\n");
410 static void do_trap(int trapnr, int signr, char *str,
411 struct pt_regs * regs, long error_code, siginfo_t *info)
413 conditional_sti(regs);
415 #ifdef CONFIG_CHECKING
418 struct x8664_pda *pda = cpu_pda + safe_smp_processor_id();
419 rdmsrl(MSR_GS_BASE, gs);
420 if (gs != (unsigned long)pda) {
421 wrmsrl(MSR_GS_BASE, pda);
422 printk("%s: wrong gs %lx expected %p rip %lx\n", str, gs, pda,
428 if ((regs->cs & 3) != 0) {
429 struct task_struct *tsk = current;
431 if (exception_trace && unhandled_signal(tsk, signr))
433 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
434 tsk->comm, tsk->pid, str,
435 regs->rip,regs->rsp,error_code);
437 tsk->thread.error_code = error_code;
438 tsk->thread.trap_no = trapnr;
440 force_sig_info(signr, info, tsk);
442 force_sig(signr, tsk);
449 const struct exception_table_entry *fixup;
450 fixup = search_exception_tables(regs->rip);
452 regs->rip = fixup->fixup;
454 die(str, regs, error_code);
459 #define DO_ERROR(trapnr, signr, str, name) \
460 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
462 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
465 do_trap(trapnr, signr, str, regs, error_code, NULL); \
468 #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
469 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
472 info.si_signo = signr; \
474 info.si_code = sicode; \
475 info.si_addr = (void __user *)siaddr; \
476 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
479 do_trap(trapnr, signr, str, regs, error_code, &info); \
482 DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->rip)
483 DO_ERROR( 4, SIGSEGV, "overflow", overflow)
484 DO_ERROR( 5, SIGSEGV, "bounds", bounds)
485 DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->rip)
486 DO_ERROR( 7, SIGSEGV, "device not available", device_not_available)
487 DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
488 DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
489 DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
490 DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
491 DO_ERROR(18, SIGSEGV, "reserved", reserved)
493 #define DO_ERROR_STACK(trapnr, signr, str, name) \
494 asmlinkage void *do_##name(struct pt_regs * regs, long error_code) \
496 struct pt_regs *pr = ((struct pt_regs *)(current->thread.rsp0))-1; \
497 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
500 if (regs->cs & 3) { \
501 memcpy(pr, regs, sizeof(struct pt_regs)); \
504 do_trap(trapnr, signr, str, regs, error_code, NULL); \
508 DO_ERROR_STACK(12, SIGBUS, "stack segment", stack_segment)
509 DO_ERROR_STACK( 8, SIGSEGV, "double fault", double_fault)
511 asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
513 conditional_sti(regs);
515 #ifdef CONFIG_CHECKING
518 struct x8664_pda *pda = cpu_pda + safe_smp_processor_id();
519 rdmsrl(MSR_GS_BASE, gs);
520 if (gs != (unsigned long)pda) {
521 wrmsrl(MSR_GS_BASE, pda);
523 printk("general protection handler: wrong gs %lx expected %p\n", gs, pda);
529 if ((regs->cs & 3)!=0) {
530 struct task_struct *tsk = current;
532 if (exception_trace && unhandled_signal(tsk, SIGSEGV))
534 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
536 regs->rip,regs->rsp,error_code);
538 tsk->thread.error_code = error_code;
539 tsk->thread.trap_no = 13;
540 force_sig(SIGSEGV, tsk);
546 const struct exception_table_entry *fixup;
547 fixup = search_exception_tables(regs->rip);
549 regs->rip = fixup->fixup;
552 if (notify_die(DIE_GPF, "general protection fault", regs,
553 error_code, 13, SIGSEGV) == NOTIFY_STOP)
555 die("general protection fault", regs, error_code);
560 static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
562 printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
563 printk("You probably have a hardware problem with your RAM chips\n");
565 /* Clear and disable the memory parity error line. */
566 reason = (reason & 0xf) | 4;
570 static void io_check_error(unsigned char reason, struct pt_regs * regs)
572 printk("NMI: IOCK error (debug interrupt?)\n");
573 show_registers(regs);
575 /* Re-enable the IOCK line, wait for a few seconds */
576 reason = (reason & 0xf) | 8;
583 static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
584 { printk("Uhhuh. NMI received for unknown reason %02x.\n", reason);
585 printk("Dazed and confused, but trying to continue\n");
586 printk("Do you have a strange power saving mode enabled?\n");
589 asmlinkage void default_do_nmi(struct pt_regs *regs)
591 unsigned char reason = 0;
593 /* Only the BSP gets external NMIs from the system. */
594 if (!smp_processor_id())
595 reason = get_nmi_reason();
597 if (!(reason & 0xc0)) {
598 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT)
601 #ifdef CONFIG_X86_LOCAL_APIC
603 * Ok, so this is none of the documented NMI sources,
604 * so it must be the NMI watchdog.
606 if (nmi_watchdog > 0) {
607 nmi_watchdog_tick(regs,reason);
611 unknown_nmi_error(reason, regs);
614 if (notify_die(DIE_NMI, "nmi", regs, reason, 0, SIGINT) == NOTIFY_STOP)
617 /* AK: following checks seem to be broken on modern chipsets. FIXME */
620 mem_parity_error(reason, regs);
622 io_check_error(reason, regs);
625 * Reassert NMI in case it became active meanwhile
626 * as it's edge-triggered.
629 inb(0x71); /* dummy */
631 inb(0x71); /* dummy */
635 asmlinkage void do_int3(struct pt_regs * regs, long error_code)
637 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
640 do_trap(3, SIGTRAP, "int3", regs, error_code, NULL);
644 /* runs on IST stack. */
645 asmlinkage void *do_debug(struct pt_regs * regs, unsigned long error_code)
648 unsigned long condition;
649 struct task_struct *tsk = current;
652 pr = (struct pt_regs *)(current->thread.rsp0)-1;
654 memcpy(pr, regs, sizeof(struct pt_regs));
658 #ifdef CONFIG_CHECKING
660 /* RED-PEN interaction with debugger - could destroy gs */
662 struct x8664_pda *pda = cpu_pda + safe_smp_processor_id();
663 rdmsrl(MSR_GS_BASE, gs);
664 if (gs != (unsigned long)pda) {
665 wrmsrl(MSR_GS_BASE, pda);
666 printk("debug handler: wrong gs %lx expected %p\n", gs, pda);
671 asm("movq %%db6,%0" : "=r" (condition));
673 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
674 SIGTRAP) == NOTIFY_STOP) {
677 conditional_sti(regs);
679 /* Mask out spurious debug traps due to lazy DR7 setting */
680 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
681 if (!tsk->thread.debugreg7) {
686 tsk->thread.debugreg6 = condition;
688 /* Mask out spurious TF errors due to lazy TF clearing */
689 if ((condition & DR_STEP) &&
690 (notify_die(DIE_DEBUGSTEP, "debugstep", regs, condition,
691 1, SIGTRAP) != NOTIFY_STOP)) {
693 * The TF error should be masked out only if the current
694 * process is not traced and if the TRAP flag has been set
695 * previously by a tracing process (condition detected by
696 * the PT_DTRACE flag); remember that the i386 TRAP flag
697 * can be modified by the process itself in user mode,
698 * allowing programs to debug themselves without the ptrace()
701 if ((regs->cs & 3) == 0)
702 goto clear_TF_reenable;
703 if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE)
707 /* Ok, finally something we can handle */
708 tsk->thread.trap_no = 1;
709 tsk->thread.error_code = error_code;
710 info.si_signo = SIGTRAP;
712 info.si_code = TRAP_BRKPT;
713 if ((regs->cs & 3) == 0)
716 info.si_addr = (void __user *)regs->rip;
717 force_sig_info(SIGTRAP, &info, tsk);
719 asm volatile("movq %0,%%db7"::"r"(0UL));
720 notify_die(DIE_DEBUG, "debug", regs, condition, 1, SIGTRAP);
724 set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
727 /* RED-PEN could cause spurious errors */
728 if (notify_die(DIE_DEBUG, "debug2", regs, condition, 1, SIGTRAP)
730 regs->eflags &= ~TF_MASK;
734 static int kernel_math_error(struct pt_regs *regs, char *str)
736 const struct exception_table_entry *fixup;
737 fixup = search_exception_tables(regs->rip);
739 regs->rip = fixup->fixup;
742 notify_die(DIE_GPF, str, regs, 0, 16, SIGFPE);
744 /* This should be a die, but warn only for now */
747 printk(KERN_DEBUG "%s: %s at ", current->comm, str);
748 printk_address(regs->rip);
755 * Note that we play around with the 'TS' bit in an attempt to get
756 * the correct behaviour even in the presence of the asynchronous
759 asmlinkage void do_coprocessor_error(struct pt_regs *regs)
761 void __user *rip = (void __user *)(regs->rip);
762 struct task_struct * task;
764 unsigned short cwd, swd;
766 conditional_sti(regs);
767 if ((regs->cs & 3) == 0 &&
768 kernel_math_error(regs, "kernel x87 math error"))
772 * Save the info for the exception handler and clear the error.
776 task->thread.trap_no = 16;
777 task->thread.error_code = 0;
778 info.si_signo = SIGFPE;
780 info.si_code = __SI_FAULT;
783 * (~cwd & swd) will mask out exceptions that are not set to unmasked
784 * status. 0x3f is the exception bits in these regs, 0x200 is the
785 * C1 reg you need in case of a stack fault, 0x040 is the stack
786 * fault bit. We should only be taking one exception at a time,
787 * so if this combination doesn't produce any single exception,
788 * then we have a bad program that isn't synchronizing its FPU usage
789 * and it will suffer the consequences since we won't be able to
790 * fully reproduce the context of the exception
792 cwd = get_fpu_cwd(task);
793 swd = get_fpu_swd(task);
794 switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) {
798 case 0x001: /* Invalid Op */
799 case 0x041: /* Stack Fault */
800 case 0x241: /* Stack Fault | Direction */
801 info.si_code = FPE_FLTINV;
803 case 0x002: /* Denormalize */
804 case 0x010: /* Underflow */
805 info.si_code = FPE_FLTUND;
807 case 0x004: /* Zero Divide */
808 info.si_code = FPE_FLTDIV;
810 case 0x008: /* Overflow */
811 info.si_code = FPE_FLTOVF;
813 case 0x020: /* Precision */
814 info.si_code = FPE_FLTRES;
817 force_sig_info(SIGFPE, &info, task);
820 asmlinkage void bad_intr(void)
822 printk("bad interrupt");
825 asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
827 void __user *rip = (void __user *)(regs->rip);
828 struct task_struct * task;
830 unsigned short mxcsr;
832 conditional_sti(regs);
833 if ((regs->cs & 3) == 0 &&
834 kernel_math_error(regs, "simd math error"))
838 * Save the info for the exception handler and clear the error.
842 task->thread.trap_no = 19;
843 task->thread.error_code = 0;
844 info.si_signo = SIGFPE;
846 info.si_code = __SI_FAULT;
849 * The SIMD FPU exceptions are handled a little differently, as there
850 * is only a single status/control register. Thus, to determine which
851 * unmasked exception was caught we must mask the exception mask bits
852 * at 0x1f80, and then use these to mask the exception bits at 0x3f.
854 mxcsr = get_fpu_mxcsr(task);
855 switch (~((mxcsr & 0x1f80) >> 7) & (mxcsr & 0x3f)) {
859 case 0x001: /* Invalid Op */
860 info.si_code = FPE_FLTINV;
862 case 0x002: /* Denormalize */
863 case 0x010: /* Underflow */
864 info.si_code = FPE_FLTUND;
866 case 0x004: /* Zero Divide */
867 info.si_code = FPE_FLTDIV;
869 case 0x008: /* Overflow */
870 info.si_code = FPE_FLTOVF;
872 case 0x020: /* Precision */
873 info.si_code = FPE_FLTRES;
876 force_sig_info(SIGFPE, &info, task);
879 asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs)
884 asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void)
890 * 'math_state_restore()' saves the current math information in the
891 * old math state array, and gets the new ones from the current task
893 * Careful.. There are problems with IBM-designed IRQ13 behaviour.
894 * Don't touch unless you *really* know how it works.
896 asmlinkage void math_state_restore(void)
898 struct task_struct *me = current;
900 /* clts(); */ /* 'clts' is done for us by Xen during virtual trap. */
904 restore_fpu_checking(&me->thread.i387.fxsave);
905 me->thread_info->status |= TS_USEDFPU;
908 void do_call_debug(struct pt_regs *regs)
910 notify_die(DIE_CALL, "debug call", regs, 0, 255, SIGINT);
914 static trap_info_t trap_table[] = {
915 { 0, 0, (__KERNEL_CS|0x3), 0, (unsigned long)divide_error },
916 { 1, 0, (__KERNEL_CS|0x3), 0, (unsigned long)debug },
917 { 3, 3, (__KERNEL_CS|0x3), 0, (unsigned long)int3 },
918 { 4, 3, (__KERNEL_CS|0x3), 0, (unsigned long)overflow },
919 { 5, 3, (__KERNEL_CS|0x3), 0, (unsigned long)bounds },
920 { 6, 0, (__KERNEL_CS|0x3), 0, (unsigned long)invalid_op },
921 { 7, 0, (__KERNEL_CS|0x3), 0, (unsigned long)device_not_available },
922 { 9, 0, (__KERNEL_CS|0x3), 0, (unsigned long)coprocessor_segment_overrun},
923 { 10, 0, (__KERNEL_CS|0x3), 0, (unsigned long)invalid_TSS },
924 { 11, 0, (__KERNEL_CS|0x3), 0, (unsigned long)segment_not_present },
925 { 12, 0, (__KERNEL_CS|0x3), 0, (unsigned long)stack_segment },
926 { 13, 0, (__KERNEL_CS|0x3), 0, (unsigned long)general_protection },
927 { 14, 0, (__KERNEL_CS|0x3), 0, (unsigned long)page_fault },
928 { 15, 0, (__KERNEL_CS|0x3), 0, (unsigned long)spurious_interrupt_bug },
929 { 16, 0, (__KERNEL_CS|0x3), 0, (unsigned long)coprocessor_error },
930 { 17, 0, (__KERNEL_CS|0x3), 0, (unsigned long)alignment_check },
931 #ifdef CONFIG_X86_MCE
932 { 18, 0, (__KERNEL_CS|0x3), 0, (unsigned long)machine_check },
934 { 19, 0, (__KERNEL_CS|0x3), 0, (unsigned long)simd_coprocessor_error },
935 { SYSCALL_VECTOR, 3, (__KERNEL_CS|0x3), 0, (unsigned long)system_call },
939 void __init trap_init(void)
943 ret = HYPERVISOR_set_trap_table(trap_table);
946 printk("HYPERVISOR_set_trap_table faild: error %d\n",
949 #ifdef CONFIG_IA32_EMULATION
950 set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
954 * Should be a barrier for any external CPU state.
960 /* Actual parsing is done early in setup.c. */
961 static int __init oops_dummy(char *s)
966 __setup("oops=", oops_dummy);
968 static int __init kstack_setup(char *s)
970 kstack_depth_to_print = simple_strtoul(s,NULL,0);
973 __setup("kstack=", kstack_setup);