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 start
= tss
->ist
[k
] - EXCEPTION_STKSZ
;
129 if (stack
>= start
&& stack
< tss
->ist
[k
])
130 return (unsigned long *)tss
->ist
[k
];
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
);
355 void __die(const char * str
, struct pt_regs
* regs
, long err
)
357 static int die_counter
;
358 printk(KERN_EMERG
"%s: %04lx [%u] ", str
, err
& 0xffff,++die_counter
);
359 #ifdef CONFIG_PREEMPT
365 #ifdef CONFIG_DEBUG_PAGEALLOC
366 printk("DEBUG_PAGEALLOC");
369 notify_die(DIE_OOPS
, (char *)str
, regs
, err
, 255, SIGSEGV
);
370 show_registers(regs
);
371 /* Executive summary in case the oops scrolled away */
372 printk(KERN_ALERT
"RIP ");
373 printk_address(regs
->rip
);
374 printk(" RSP <%016lx>\n", regs
->rsp
);
377 void die(const char * str
, struct pt_regs
* regs
, long err
)
381 __die(str
, regs
, err
);
385 static inline void die_if_kernel(const char * str
, struct pt_regs
* regs
, long err
)
387 if (!(regs
->eflags
& VM_MASK
) && (regs
->cs
== __KERNEL_CS
))
391 void die_nmi(char *str
, struct pt_regs
*regs
)
395 * We are in trouble anyway, lets at least try
396 * to get a message out.
398 printk(str
, safe_smp_processor_id());
399 show_registers(regs
);
400 if (panic_on_timeout
|| panic_on_oops
)
401 panic("nmi watchdog");
402 printk("console shuts up ...\n");
407 static void do_trap(int trapnr
, int signr
, char *str
,
408 struct pt_regs
* regs
, long error_code
, siginfo_t
*info
)
410 conditional_sti(regs
);
412 #ifdef CONFIG_CHECKING
415 struct x8664_pda
*pda
= cpu_pda
+ safe_smp_processor_id();
416 rdmsrl(MSR_GS_BASE
, gs
);
417 if (gs
!= (unsigned long)pda
) {
418 wrmsrl(MSR_GS_BASE
, pda
);
419 printk("%s: wrong gs %lx expected %p rip %lx\n", str
, gs
, pda
,
425 if ((regs
->cs
& 3) != 0) {
426 struct task_struct
*tsk
= current
;
428 if (exception_trace
&& unhandled_signal(tsk
, signr
))
430 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
431 tsk
->comm
, tsk
->pid
, str
,
432 regs
->rip
,regs
->rsp
,error_code
);
434 tsk
->thread
.error_code
= error_code
;
435 tsk
->thread
.trap_no
= trapnr
;
437 force_sig_info(signr
, info
, tsk
);
439 force_sig(signr
, tsk
);
446 const struct exception_table_entry
*fixup
;
447 fixup
= search_exception_tables(regs
->rip
);
449 regs
->rip
= fixup
->fixup
;
451 die(str
, regs
, error_code
);
456 #define DO_ERROR(trapnr, signr, str, name) \
457 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
459 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
462 do_trap(trapnr, signr, str, regs, error_code, NULL); \
465 #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
466 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
469 info.si_signo = signr; \
471 info.si_code = sicode; \
472 info.si_addr = (void __user *)siaddr; \
473 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
476 do_trap(trapnr, signr, str, regs, error_code, &info); \
479 DO_ERROR_INFO( 0, SIGFPE
, "divide error", divide_error
, FPE_INTDIV
, regs
->rip
)
480 DO_ERROR( 4, SIGSEGV
, "overflow", overflow
)
481 DO_ERROR( 5, SIGSEGV
, "bounds", bounds
)
482 DO_ERROR_INFO( 6, SIGILL
, "invalid operand", invalid_op
, ILL_ILLOPN
, regs
->rip
)
483 DO_ERROR( 7, SIGSEGV
, "device not available", device_not_available
)
484 DO_ERROR( 9, SIGFPE
, "coprocessor segment overrun", coprocessor_segment_overrun
)
485 DO_ERROR(10, SIGSEGV
, "invalid TSS", invalid_TSS
)
486 DO_ERROR(11, SIGBUS
, "segment not present", segment_not_present
)
487 DO_ERROR_INFO(17, SIGBUS
, "alignment check", alignment_check
, BUS_ADRALN
, 0)
488 DO_ERROR(18, SIGSEGV
, "reserved", reserved
)
490 #define DO_ERROR_STACK(trapnr, signr, str, name) \
491 asmlinkage void *do_##name(struct pt_regs * regs, long error_code) \
493 struct pt_regs *pr = ((struct pt_regs *)(current->thread.rsp0))-1; \
494 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
497 if (regs->cs & 3) { \
498 memcpy(pr, regs, sizeof(struct pt_regs)); \
501 do_trap(trapnr, signr, str, regs, error_code, NULL); \
505 DO_ERROR_STACK(12, SIGBUS
, "stack segment", stack_segment
)
506 DO_ERROR_STACK( 8, SIGSEGV
, "double fault", double_fault
)
508 asmlinkage
void do_general_protection(struct pt_regs
* regs
, long error_code
)
510 conditional_sti(regs
);
512 #ifdef CONFIG_CHECKING
515 struct x8664_pda
*pda
= cpu_pda
+ safe_smp_processor_id();
516 rdmsrl(MSR_GS_BASE
, gs
);
517 if (gs
!= (unsigned long)pda
) {
518 wrmsrl(MSR_GS_BASE
, pda
);
520 printk("general protection handler: wrong gs %lx expected %p\n", gs
, pda
);
526 if ((regs
->cs
& 3)!=0) {
527 struct task_struct
*tsk
= current
;
529 if (exception_trace
&& unhandled_signal(tsk
, SIGSEGV
))
531 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
533 regs
->rip
,regs
->rsp
,error_code
);
535 tsk
->thread
.error_code
= error_code
;
536 tsk
->thread
.trap_no
= 13;
537 force_sig(SIGSEGV
, tsk
);
543 const struct exception_table_entry
*fixup
;
544 fixup
= search_exception_tables(regs
->rip
);
546 regs
->rip
= fixup
->fixup
;
549 if (notify_die(DIE_GPF
, "general protection fault", regs
,
550 error_code
, 13, SIGSEGV
) == NOTIFY_STOP
)
552 die("general protection fault", regs
, error_code
);
556 static void mem_parity_error(unsigned char reason
, struct pt_regs
* regs
)
558 printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
559 printk("You probably have a hardware problem with your RAM chips\n");
561 /* Clear and disable the memory parity error line. */
562 reason
= (reason
& 0xf) | 4;
566 static void io_check_error(unsigned char reason
, struct pt_regs
* regs
)
568 printk("NMI: IOCK error (debug interrupt?)\n");
569 show_registers(regs
);
571 /* Re-enable the IOCK line, wait for a few seconds */
572 reason
= (reason
& 0xf) | 8;
579 static void unknown_nmi_error(unsigned char reason
, struct pt_regs
* regs
)
580 { printk("Uhhuh. NMI received for unknown reason %02x.\n", reason
);
581 printk("Dazed and confused, but trying to continue\n");
582 printk("Do you have a strange power saving mode enabled?\n");
585 asmlinkage
void default_do_nmi(struct pt_regs
*regs
)
587 unsigned char reason
= 0;
589 /* Only the BSP gets external NMIs from the system. */
590 if (!smp_processor_id())
591 reason
= get_nmi_reason();
593 if (!(reason
& 0xc0)) {
594 if (notify_die(DIE_NMI_IPI
, "nmi_ipi", regs
, reason
, 0, SIGINT
)
597 #ifdef CONFIG_X86_LOCAL_APIC
599 * Ok, so this is none of the documented NMI sources,
600 * so it must be the NMI watchdog.
602 if (nmi_watchdog
> 0) {
603 nmi_watchdog_tick(regs
,reason
);
607 unknown_nmi_error(reason
, regs
);
610 if (notify_die(DIE_NMI
, "nmi", regs
, reason
, 0, SIGINT
) == NOTIFY_STOP
)
613 /* AK: following checks seem to be broken on modern chipsets. FIXME */
616 mem_parity_error(reason
, regs
);
618 io_check_error(reason
, regs
);
621 asmlinkage
void do_int3(struct pt_regs
* regs
, long error_code
)
623 if (notify_die(DIE_INT3
, "int3", regs
, error_code
, 3, SIGTRAP
) == NOTIFY_STOP
) {
626 do_trap(3, SIGTRAP
, "int3", regs
, error_code
, NULL
);
630 /* runs on IST stack. */
631 asmlinkage
void *do_debug(struct pt_regs
* regs
, unsigned long error_code
)
634 unsigned long condition
;
635 struct task_struct
*tsk
= current
;
638 pr
= (struct pt_regs
*)(current
->thread
.rsp0
)-1;
640 memcpy(pr
, regs
, sizeof(struct pt_regs
));
644 #ifdef CONFIG_CHECKING
646 /* RED-PEN interaction with debugger - could destroy gs */
648 struct x8664_pda
*pda
= cpu_pda
+ safe_smp_processor_id();
649 rdmsrl(MSR_GS_BASE
, gs
);
650 if (gs
!= (unsigned long)pda
) {
651 wrmsrl(MSR_GS_BASE
, pda
);
652 printk("debug handler: wrong gs %lx expected %p\n", gs
, pda
);
657 asm("movq %%db6,%0" : "=r" (condition
));
659 if (notify_die(DIE_DEBUG
, "debug", regs
, condition
, error_code
,
660 SIGTRAP
) == NOTIFY_STOP
) {
663 conditional_sti(regs
);
665 /* Mask out spurious debug traps due to lazy DR7 setting */
666 if (condition
& (DR_TRAP0
|DR_TRAP1
|DR_TRAP2
|DR_TRAP3
)) {
667 if (!tsk
->thread
.debugreg7
) {
672 tsk
->thread
.debugreg6
= condition
;
674 /* Mask out spurious TF errors due to lazy TF clearing */
675 if ((condition
& DR_STEP
) &&
676 (notify_die(DIE_DEBUGSTEP
, "debugstep", regs
, condition
,
677 1, SIGTRAP
) != NOTIFY_STOP
)) {
679 * The TF error should be masked out only if the current
680 * process is not traced and if the TRAP flag has been set
681 * previously by a tracing process (condition detected by
682 * the PT_DTRACE flag); remember that the i386 TRAP flag
683 * can be modified by the process itself in user mode,
684 * allowing programs to debug themselves without the ptrace()
687 if ((regs
->cs
& 3) == 0)
688 goto clear_TF_reenable
;
689 if ((tsk
->ptrace
& (PT_DTRACE
|PT_PTRACED
)) == PT_DTRACE
)
693 /* Ok, finally something we can handle */
694 tsk
->thread
.trap_no
= 1;
695 tsk
->thread
.error_code
= error_code
;
696 info
.si_signo
= SIGTRAP
;
698 info
.si_code
= TRAP_BRKPT
;
699 if ((regs
->cs
& 3) == 0)
702 info
.si_addr
= (void __user
*)regs
->rip
;
703 force_sig_info(SIGTRAP
, &info
, tsk
);
705 asm volatile("movq %0,%%db7"::"r"(0UL));
706 notify_die(DIE_DEBUG
, "debug", regs
, condition
, 1, SIGTRAP
);
710 set_tsk_thread_flag(tsk
, TIF_SINGLESTEP
);
713 /* RED-PEN could cause spurious errors */
714 if (notify_die(DIE_DEBUG
, "debug2", regs
, condition
, 1, SIGTRAP
)
716 regs
->eflags
&= ~TF_MASK
;
720 static int kernel_math_error(struct pt_regs
*regs
, char *str
)
722 const struct exception_table_entry
*fixup
;
723 fixup
= search_exception_tables(regs
->rip
);
725 regs
->rip
= fixup
->fixup
;
728 notify_die(DIE_GPF
, str
, regs
, 0, 16, SIGFPE
);
730 /* This should be a die, but warn only for now */
733 printk(KERN_DEBUG
"%s: %s at ", current
->comm
, str
);
734 printk_address(regs
->rip
);
741 * Note that we play around with the 'TS' bit in an attempt to get
742 * the correct behaviour even in the presence of the asynchronous
745 asmlinkage
void do_coprocessor_error(struct pt_regs
*regs
)
747 void __user
*rip
= (void __user
*)(regs
->rip
);
748 struct task_struct
* task
;
750 unsigned short cwd
, swd
;
752 conditional_sti(regs
);
753 if ((regs
->cs
& 3) == 0 &&
754 kernel_math_error(regs
, "kernel x87 math error"))
758 * Save the info for the exception handler and clear the error.
762 task
->thread
.trap_no
= 16;
763 task
->thread
.error_code
= 0;
764 info
.si_signo
= SIGFPE
;
766 info
.si_code
= __SI_FAULT
;
769 * (~cwd & swd) will mask out exceptions that are not set to unmasked
770 * status. 0x3f is the exception bits in these regs, 0x200 is the
771 * C1 reg you need in case of a stack fault, 0x040 is the stack
772 * fault bit. We should only be taking one exception at a time,
773 * so if this combination doesn't produce any single exception,
774 * then we have a bad program that isn't synchronizing its FPU usage
775 * and it will suffer the consequences since we won't be able to
776 * fully reproduce the context of the exception
778 cwd
= get_fpu_cwd(task
);
779 swd
= get_fpu_swd(task
);
780 switch (((~cwd
) & swd
& 0x3f) | (swd
& 0x240)) {
784 case 0x001: /* Invalid Op */
785 case 0x041: /* Stack Fault */
786 case 0x241: /* Stack Fault | Direction */
787 info
.si_code
= FPE_FLTINV
;
789 case 0x002: /* Denormalize */
790 case 0x010: /* Underflow */
791 info
.si_code
= FPE_FLTUND
;
793 case 0x004: /* Zero Divide */
794 info
.si_code
= FPE_FLTDIV
;
796 case 0x008: /* Overflow */
797 info
.si_code
= FPE_FLTOVF
;
799 case 0x020: /* Precision */
800 info
.si_code
= FPE_FLTRES
;
803 force_sig_info(SIGFPE
, &info
, task
);
806 asmlinkage
void bad_intr(void)
808 printk("bad interrupt");
811 asmlinkage
void do_simd_coprocessor_error(struct pt_regs
*regs
)
813 void __user
*rip
= (void __user
*)(regs
->rip
);
814 struct task_struct
* task
;
816 unsigned short mxcsr
;
818 conditional_sti(regs
);
819 if ((regs
->cs
& 3) == 0 &&
820 kernel_math_error(regs
, "simd math error"))
824 * Save the info for the exception handler and clear the error.
828 task
->thread
.trap_no
= 19;
829 task
->thread
.error_code
= 0;
830 info
.si_signo
= SIGFPE
;
832 info
.si_code
= __SI_FAULT
;
835 * The SIMD FPU exceptions are handled a little differently, as there
836 * is only a single status/control register. Thus, to determine which
837 * unmasked exception was caught we must mask the exception mask bits
838 * at 0x1f80, and then use these to mask the exception bits at 0x3f.
840 mxcsr
= get_fpu_mxcsr(task
);
841 switch (~((mxcsr
& 0x1f80) >> 7) & (mxcsr
& 0x3f)) {
845 case 0x001: /* Invalid Op */
846 info
.si_code
= FPE_FLTINV
;
848 case 0x002: /* Denormalize */
849 case 0x010: /* Underflow */
850 info
.si_code
= FPE_FLTUND
;
852 case 0x004: /* Zero Divide */
853 info
.si_code
= FPE_FLTDIV
;
855 case 0x008: /* Overflow */
856 info
.si_code
= FPE_FLTOVF
;
858 case 0x020: /* Precision */
859 info
.si_code
= FPE_FLTRES
;
862 force_sig_info(SIGFPE
, &info
, task
);
865 asmlinkage
void do_spurious_interrupt_bug(struct pt_regs
* regs
)
869 asmlinkage
void __attribute__((weak
)) smp_thermal_interrupt(void)
874 * 'math_state_restore()' saves the current math information in the
875 * old math state array, and gets the new ones from the current task
877 * Careful.. There are problems with IBM-designed IRQ13 behaviour.
878 * Don't touch unless you *really* know how it works.
880 asmlinkage
void math_state_restore(void)
882 struct task_struct
*me
= current
;
883 clts(); /* Allow maths ops (or we recurse) */
887 restore_fpu_checking(&me
->thread
.i387
.fxsave
);
888 me
->thread_info
->status
|= TS_USEDFPU
;
891 void do_call_debug(struct pt_regs
*regs
)
893 notify_die(DIE_CALL
, "debug call", regs
, 0, 255, SIGINT
);
896 void __init
trap_init(void)
898 set_intr_gate(0,÷_error
);
899 set_intr_gate_ist(1,&debug
,DEBUG_STACK
);
900 set_intr_gate_ist(2,&nmi
,NMI_STACK
);
901 set_system_gate(3,&int3
);
902 set_system_gate(4,&overflow
); /* int4-5 can be called from all */
903 set_system_gate(5,&bounds
);
904 set_intr_gate(6,&invalid_op
);
905 set_intr_gate(7,&device_not_available
);
906 set_intr_gate_ist(8,&double_fault
, DOUBLEFAULT_STACK
);
907 set_intr_gate(9,&coprocessor_segment_overrun
);
908 set_intr_gate(10,&invalid_TSS
);
909 set_intr_gate(11,&segment_not_present
);
910 set_intr_gate_ist(12,&stack_segment
,STACKFAULT_STACK
);
911 set_intr_gate(13,&general_protection
);
912 set_intr_gate(14,&page_fault
);
913 set_intr_gate(15,&spurious_interrupt_bug
);
914 set_intr_gate(16,&coprocessor_error
);
915 set_intr_gate(17,&alignment_check
);
916 #ifdef CONFIG_X86_MCE
917 set_intr_gate_ist(18,&machine_check
, MCE_STACK
);
919 set_intr_gate(19,&simd_coprocessor_error
);
921 #ifdef CONFIG_IA32_EMULATION
922 set_system_gate(IA32_SYSCALL_VECTOR
, ia32_syscall
);
925 set_intr_gate(KDB_VECTOR
, call_debug
);
928 * Should be a barrier for any external CPU state.
934 /* Actual parsing is done early in setup.c. */
935 static int __init
oops_dummy(char *s
)
940 __setup("oops=", oops_dummy
);
942 static int __init
kstack_setup(char *s
)
944 kstack_depth_to_print
= simple_strtoul(s
,NULL
,0);
947 __setup("kstack=", kstack_setup
);