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>
31 #include <linux/nmi.h>
33 #include <asm/system.h>
34 #include <asm/uaccess.h>
36 #include <asm/atomic.h>
37 #include <asm/debugreg.h>
40 #include <asm/kdebug.h>
41 #include <asm/processor.h>
44 #include <asm/pgalloc.h>
46 #include <asm/proto.h>
49 #include <linux/irq.h>
52 extern struct gate_struct idt_table
[256];
54 asmlinkage
void divide_error(void);
55 asmlinkage
void debug(void);
56 asmlinkage
void nmi(void);
57 asmlinkage
void int3(void);
58 asmlinkage
void overflow(void);
59 asmlinkage
void bounds(void);
60 asmlinkage
void invalid_op(void);
61 asmlinkage
void device_not_available(void);
62 asmlinkage
void double_fault(void);
63 asmlinkage
void coprocessor_segment_overrun(void);
64 asmlinkage
void invalid_TSS(void);
65 asmlinkage
void segment_not_present(void);
66 asmlinkage
void stack_segment(void);
67 asmlinkage
void general_protection(void);
68 asmlinkage
void page_fault(void);
69 asmlinkage
void coprocessor_error(void);
70 asmlinkage
void simd_coprocessor_error(void);
71 asmlinkage
void reserved(void);
72 asmlinkage
void alignment_check(void);
73 asmlinkage
void machine_check(void);
74 asmlinkage
void spurious_interrupt_bug(void);
75 asmlinkage
void call_debug(void);
77 struct notifier_block
*die_chain
;
78 static DEFINE_SPINLOCK(die_notifier_lock
);
80 int register_die_notifier(struct notifier_block
*nb
)
84 spin_lock_irqsave(&die_notifier_lock
, flags
);
85 err
= notifier_chain_register(&die_chain
, nb
);
86 spin_unlock_irqrestore(&die_notifier_lock
, flags
);
90 static inline void conditional_sti(struct pt_regs
*regs
)
92 if (regs
->eflags
& X86_EFLAGS_IF
)
96 static int kstack_depth_to_print
= 10;
98 #ifdef CONFIG_KALLSYMS
99 #include <linux/kallsyms.h>
100 int printk_address(unsigned long address
)
102 unsigned long offset
= 0, symsize
;
108 symname
= kallsyms_lookup(address
, &symsize
, &offset
, &modname
, namebuf
);
110 return printk("[<%016lx>]", address
);
112 modname
= delim
= "";
113 return printk("<%016lx>{%s%s%s%s%+ld}",
114 address
,delim
,modname
,delim
,symname
,offset
);
117 int printk_address(unsigned long address
)
119 return printk("[<%016lx>]", address
);
123 unsigned long *in_exception_stack(int cpu
, unsigned long stack
)
126 for (k
= 0; k
< N_EXCEPTION_STACKS
; k
++) {
127 struct tss_struct
*tss
= &per_cpu(init_tss
, cpu
);
128 unsigned long start
= tss
->ist
[k
] - EXCEPTION_STKSZ
;
130 if (stack
>= start
&& stack
< tss
->ist
[k
])
131 return (unsigned long *)tss
->ist
[k
];
137 * x86-64 can have upto three kernel stacks:
140 * severe exception (double fault, nmi, stack fault) hardware stack
141 * Check and process them in order.
144 void show_trace(unsigned long *stack
)
147 unsigned long *irqstack
, *irqstack_end
, *estack_end
;
148 const int cpu
= safe_smp_processor_id();
151 printk("\nCall Trace:");
154 estack_end
= in_exception_stack(cpu
, (unsigned long)stack
);
156 while (stack
< estack_end
) {
158 if (__kernel_text_address(addr
)) {
159 i
+= printk_address(addr
);
167 i
+= printk(" <EOE> ");
169 stack
= (unsigned long *) estack_end
[-2];
172 irqstack_end
= (unsigned long *) (cpu_pda
[cpu
].irqstackptr
);
173 irqstack
= (unsigned long *) (cpu_pda
[cpu
].irqstackptr
- IRQSTACKSIZE
+ 64);
175 if (stack
>= irqstack
&& stack
< irqstack_end
) {
177 while (stack
< irqstack_end
) {
180 * If the address is either in the text segment of the
181 * kernel, or in the region which contains vmalloc'ed
182 * memory, it *may* be the address of a calling
183 * routine; if so, print it so that someone tracing
184 * down the cause of the crash will be able to figure
185 * out the call path that was taken.
187 if (__kernel_text_address(addr
)) {
188 i
+= printk_address(addr
);
196 stack
= (unsigned long *) (irqstack_end
[-1]);
201 while (((long) stack
& (THREAD_SIZE
-1)) != 0) {
203 if (__kernel_text_address(addr
)) {
204 i
+= printk_address(addr
);
215 void show_stack(struct task_struct
*tsk
, unsigned long * rsp
)
217 unsigned long *stack
;
219 const int cpu
= safe_smp_processor_id();
220 unsigned long *irqstack_end
= (unsigned long *) (cpu_pda
[cpu
].irqstackptr
);
221 unsigned long *irqstack
= (unsigned long *) (cpu_pda
[cpu
].irqstackptr
- IRQSTACKSIZE
);
223 // debugging aid: "show_stack(NULL, NULL);" prints the
224 // back trace for this cpu.
228 rsp
= (unsigned long *)tsk
->thread
.rsp
;
230 rsp
= (unsigned long *)&rsp
;
234 for(i
=0; i
< kstack_depth_to_print
; i
++) {
235 if (stack
>= irqstack
&& stack
<= irqstack_end
) {
236 if (stack
== irqstack_end
) {
237 stack
= (unsigned long *) (irqstack_end
[-1]);
241 if (((long) stack
& (THREAD_SIZE
-1)) == 0)
244 if (i
&& ((i
% 4) == 0))
246 printk("%016lx ", *stack
++);
247 touch_nmi_watchdog();
249 show_trace((unsigned long *)rsp
);
253 * The architecture-independent dump_stack generator
255 void dump_stack(void)
261 EXPORT_SYMBOL(dump_stack
);
263 void show_registers(struct pt_regs
*regs
)
266 int in_kernel
= (regs
->cs
& 3) == 0;
268 const int cpu
= safe_smp_processor_id();
269 struct task_struct
*cur
= cpu_pda
[cpu
].pcurrent
;
273 printk("CPU %d ", cpu
);
275 printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
276 cur
->comm
, cur
->pid
, cur
->thread_info
, cur
);
279 * When in-kernel, we also print out the stack and code at the
280 * time of the fault..
285 show_stack(NULL
, (unsigned long*)rsp
);
288 if(regs
->rip
< PAGE_OFFSET
)
294 if(__get_user(c
, &((unsigned char*)regs
->rip
)[i
])) {
296 printk(" Bad RIP value.");
305 void handle_BUG(struct pt_regs
*regs
)
312 if (__copy_from_user(&f
, (struct bug_frame
*) regs
->rip
,
313 sizeof(struct bug_frame
)))
315 if ((unsigned long)f
.filename
< __PAGE_OFFSET
||
316 f
.ud2
[0] != 0x0f || f
.ud2
[1] != 0x0b)
318 if (__get_user(tmp
, f
.filename
))
319 f
.filename
= "unmapped filename";
320 printk("----------- [cut here ] --------- [please bite here ] ---------\n");
321 printk(KERN_ALERT
"Kernel BUG at %.50s:%d\n", f
.filename
, f
.line
);
324 void out_of_line_bug(void)
329 static DEFINE_SPINLOCK(die_lock
);
330 static int die_owner
= -1;
332 void oops_begin(void)
334 int cpu
= safe_smp_processor_id();
335 /* racy, but better than risking deadlock. */
337 if (!spin_trylock(&die_lock
)) {
338 if (cpu
== die_owner
)
339 /* nested oops. should stop eventually */;
341 spin_lock(&die_lock
);
352 spin_unlock(&die_lock
);
357 void __die(const char * str
, struct pt_regs
* regs
, long err
)
359 static int die_counter
;
360 printk(KERN_EMERG
"%s: %04lx [%u] ", str
, err
& 0xffff,++die_counter
);
361 #ifdef CONFIG_PREEMPT
367 #ifdef CONFIG_DEBUG_PAGEALLOC
368 printk("DEBUG_PAGEALLOC");
371 notify_die(DIE_OOPS
, (char *)str
, regs
, err
, 255, SIGSEGV
);
372 show_registers(regs
);
373 /* Executive summary in case the oops scrolled away */
374 printk(KERN_ALERT
"RIP ");
375 printk_address(regs
->rip
);
376 printk(" RSP <%016lx>\n", regs
->rsp
);
379 void die(const char * str
, struct pt_regs
* regs
, long err
)
383 __die(str
, regs
, err
);
387 static inline void die_if_kernel(const char * str
, struct pt_regs
* regs
, long err
)
389 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");
409 static void do_trap(int trapnr
, int signr
, char *str
,
410 struct pt_regs
* regs
, long error_code
, siginfo_t
*info
)
412 conditional_sti(regs
);
414 #ifdef CONFIG_CHECKING
417 struct x8664_pda
*pda
= cpu_pda
+ safe_smp_processor_id();
418 rdmsrl(MSR_GS_BASE
, gs
);
419 if (gs
!= (unsigned long)pda
) {
420 wrmsrl(MSR_GS_BASE
, pda
);
421 printk("%s: wrong gs %lx expected %p rip %lx\n", str
, gs
, pda
,
427 if ((regs
->cs
& 3) != 0) {
428 struct task_struct
*tsk
= current
;
430 if (exception_trace
&& unhandled_signal(tsk
, signr
))
432 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
433 tsk
->comm
, tsk
->pid
, str
,
434 regs
->rip
,regs
->rsp
,error_code
);
436 tsk
->thread
.error_code
= error_code
;
437 tsk
->thread
.trap_no
= trapnr
;
439 force_sig_info(signr
, info
, tsk
);
441 force_sig(signr
, tsk
);
448 const struct exception_table_entry
*fixup
;
449 fixup
= search_exception_tables(regs
->rip
);
451 regs
->rip
= fixup
->fixup
;
453 die(str
, regs
, error_code
);
458 #define DO_ERROR(trapnr, signr, str, name) \
459 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
461 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
464 do_trap(trapnr, signr, str, regs, error_code, NULL); \
467 #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
468 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
471 info.si_signo = signr; \
473 info.si_code = sicode; \
474 info.si_addr = (void __user *)siaddr; \
475 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
478 do_trap(trapnr, signr, str, regs, error_code, &info); \
481 DO_ERROR_INFO( 0, SIGFPE
, "divide error", divide_error
, FPE_INTDIV
, regs
->rip
)
482 DO_ERROR( 4, SIGSEGV
, "overflow", overflow
)
483 DO_ERROR( 5, SIGSEGV
, "bounds", bounds
)
484 DO_ERROR_INFO( 6, SIGILL
, "invalid operand", invalid_op
, ILL_ILLOPN
, regs
->rip
)
485 DO_ERROR( 7, SIGSEGV
, "device not available", device_not_available
)
486 DO_ERROR( 9, SIGFPE
, "coprocessor segment overrun", coprocessor_segment_overrun
)
487 DO_ERROR(10, SIGSEGV
, "invalid TSS", invalid_TSS
)
488 DO_ERROR(11, SIGBUS
, "segment not present", segment_not_present
)
489 DO_ERROR_INFO(17, SIGBUS
, "alignment check", alignment_check
, BUS_ADRALN
, 0)
490 DO_ERROR(18, SIGSEGV
, "reserved", reserved
)
492 #define DO_ERROR_STACK(trapnr, signr, str, name) \
493 asmlinkage void *do_##name(struct pt_regs * regs, long error_code) \
495 struct pt_regs *pr = ((struct pt_regs *)(current->thread.rsp0))-1; \
496 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
499 if (regs->cs & 3) { \
500 memcpy(pr, regs, sizeof(struct pt_regs)); \
503 do_trap(trapnr, signr, str, regs, error_code, NULL); \
507 DO_ERROR_STACK(12, SIGBUS
, "stack segment", stack_segment
)
508 DO_ERROR_STACK( 8, SIGSEGV
, "double fault", double_fault
)
510 asmlinkage
void do_general_protection(struct pt_regs
* regs
, long error_code
)
512 conditional_sti(regs
);
514 #ifdef CONFIG_CHECKING
517 struct x8664_pda
*pda
= cpu_pda
+ safe_smp_processor_id();
518 rdmsrl(MSR_GS_BASE
, gs
);
519 if (gs
!= (unsigned long)pda
) {
520 wrmsrl(MSR_GS_BASE
, pda
);
522 printk("general protection handler: wrong gs %lx expected %p\n", gs
, pda
);
528 if ((regs
->cs
& 3)!=0) {
529 struct task_struct
*tsk
= current
;
531 if (exception_trace
&& unhandled_signal(tsk
, SIGSEGV
))
533 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
535 regs
->rip
,regs
->rsp
,error_code
);
537 tsk
->thread
.error_code
= error_code
;
538 tsk
->thread
.trap_no
= 13;
539 force_sig(SIGSEGV
, tsk
);
545 const struct exception_table_entry
*fixup
;
546 fixup
= search_exception_tables(regs
->rip
);
548 regs
->rip
= fixup
->fixup
;
551 if (notify_die(DIE_GPF
, "general protection fault", regs
,
552 error_code
, 13, SIGSEGV
) == NOTIFY_STOP
)
554 die("general protection fault", regs
, error_code
);
558 static void mem_parity_error(unsigned char reason
, struct pt_regs
* regs
)
560 printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
561 printk("You probably have a hardware problem with your RAM chips\n");
563 /* Clear and disable the memory parity error line. */
564 reason
= (reason
& 0xf) | 4;
568 static void io_check_error(unsigned char reason
, struct pt_regs
* regs
)
570 printk("NMI: IOCK error (debug interrupt?)\n");
571 show_registers(regs
);
573 /* Re-enable the IOCK line, wait for a few seconds */
574 reason
= (reason
& 0xf) | 8;
581 static void unknown_nmi_error(unsigned char reason
, struct pt_regs
* regs
)
582 { printk("Uhhuh. NMI received for unknown reason %02x.\n", reason
);
583 printk("Dazed and confused, but trying to continue\n");
584 printk("Do you have a strange power saving mode enabled?\n");
587 asmlinkage
void default_do_nmi(struct pt_regs
*regs
)
589 unsigned char reason
= 0;
591 /* Only the BSP gets external NMIs from the system. */
592 if (!smp_processor_id())
593 reason
= get_nmi_reason();
595 if (!(reason
& 0xc0)) {
596 if (notify_die(DIE_NMI_IPI
, "nmi_ipi", regs
, reason
, 0, SIGINT
)
599 #ifdef CONFIG_X86_LOCAL_APIC
601 * Ok, so this is none of the documented NMI sources,
602 * so it must be the NMI watchdog.
604 if (nmi_watchdog
> 0) {
605 nmi_watchdog_tick(regs
,reason
);
609 unknown_nmi_error(reason
, regs
);
612 if (notify_die(DIE_NMI
, "nmi", regs
, reason
, 0, SIGINT
) == NOTIFY_STOP
)
615 /* AK: following checks seem to be broken on modern chipsets. FIXME */
618 mem_parity_error(reason
, regs
);
620 io_check_error(reason
, regs
);
623 asmlinkage
void do_int3(struct pt_regs
* regs
, long error_code
)
625 if (notify_die(DIE_INT3
, "int3", regs
, error_code
, 3, SIGTRAP
) == NOTIFY_STOP
) {
628 do_trap(3, SIGTRAP
, "int3", regs
, error_code
, NULL
);
632 /* runs on IST stack. */
633 asmlinkage
void *do_debug(struct pt_regs
* regs
, unsigned long error_code
)
636 unsigned long condition
;
637 struct task_struct
*tsk
= current
;
640 pr
= (struct pt_regs
*)(current
->thread
.rsp0
)-1;
642 memcpy(pr
, regs
, sizeof(struct pt_regs
));
646 #ifdef CONFIG_CHECKING
648 /* RED-PEN interaction with debugger - could destroy gs */
650 struct x8664_pda
*pda
= cpu_pda
+ safe_smp_processor_id();
651 rdmsrl(MSR_GS_BASE
, gs
);
652 if (gs
!= (unsigned long)pda
) {
653 wrmsrl(MSR_GS_BASE
, pda
);
654 printk("debug handler: wrong gs %lx expected %p\n", gs
, pda
);
659 asm("movq %%db6,%0" : "=r" (condition
));
661 if (notify_die(DIE_DEBUG
, "debug", regs
, condition
, error_code
,
662 SIGTRAP
) == NOTIFY_STOP
) {
665 conditional_sti(regs
);
667 /* Mask out spurious debug traps due to lazy DR7 setting */
668 if (condition
& (DR_TRAP0
|DR_TRAP1
|DR_TRAP2
|DR_TRAP3
)) {
669 if (!tsk
->thread
.debugreg7
) {
674 tsk
->thread
.debugreg6
= condition
;
676 /* Mask out spurious TF errors due to lazy TF clearing */
677 if ((condition
& DR_STEP
) &&
678 (notify_die(DIE_DEBUGSTEP
, "debugstep", regs
, condition
,
679 1, SIGTRAP
) != NOTIFY_STOP
)) {
681 * The TF error should be masked out only if the current
682 * process is not traced and if the TRAP flag has been set
683 * previously by a tracing process (condition detected by
684 * the PT_DTRACE flag); remember that the i386 TRAP flag
685 * can be modified by the process itself in user mode,
686 * allowing programs to debug themselves without the ptrace()
689 if ((regs
->cs
& 3) == 0)
690 goto clear_TF_reenable
;
691 if ((tsk
->ptrace
& (PT_DTRACE
|PT_PTRACED
)) == PT_DTRACE
)
695 /* Ok, finally something we can handle */
696 tsk
->thread
.trap_no
= 1;
697 tsk
->thread
.error_code
= error_code
;
698 info
.si_signo
= SIGTRAP
;
700 info
.si_code
= TRAP_BRKPT
;
701 if ((regs
->cs
& 3) == 0)
704 info
.si_addr
= (void __user
*)regs
->rip
;
705 force_sig_info(SIGTRAP
, &info
, tsk
);
707 asm volatile("movq %0,%%db7"::"r"(0UL));
708 notify_die(DIE_DEBUG
, "debug", regs
, condition
, 1, SIGTRAP
);
712 set_tsk_thread_flag(tsk
, TIF_SINGLESTEP
);
715 /* RED-PEN could cause spurious errors */
716 if (notify_die(DIE_DEBUG
, "debug2", regs
, condition
, 1, SIGTRAP
)
718 regs
->eflags
&= ~TF_MASK
;
722 static int kernel_math_error(struct pt_regs
*regs
, char *str
)
724 const struct exception_table_entry
*fixup
;
725 fixup
= search_exception_tables(regs
->rip
);
727 regs
->rip
= fixup
->fixup
;
730 notify_die(DIE_GPF
, str
, regs
, 0, 16, SIGFPE
);
732 /* This should be a die, but warn only for now */
735 printk(KERN_DEBUG
"%s: %s at ", current
->comm
, str
);
736 printk_address(regs
->rip
);
743 * Note that we play around with the 'TS' bit in an attempt to get
744 * the correct behaviour even in the presence of the asynchronous
747 asmlinkage
void do_coprocessor_error(struct pt_regs
*regs
)
749 void __user
*rip
= (void __user
*)(regs
->rip
);
750 struct task_struct
* task
;
752 unsigned short cwd
, swd
;
754 conditional_sti(regs
);
755 if ((regs
->cs
& 3) == 0 &&
756 kernel_math_error(regs
, "kernel x87 math error"))
760 * Save the info for the exception handler and clear the error.
764 task
->thread
.trap_no
= 16;
765 task
->thread
.error_code
= 0;
766 info
.si_signo
= SIGFPE
;
768 info
.si_code
= __SI_FAULT
;
771 * (~cwd & swd) will mask out exceptions that are not set to unmasked
772 * status. 0x3f is the exception bits in these regs, 0x200 is the
773 * C1 reg you need in case of a stack fault, 0x040 is the stack
774 * fault bit. We should only be taking one exception at a time,
775 * so if this combination doesn't produce any single exception,
776 * then we have a bad program that isn't synchronizing its FPU usage
777 * and it will suffer the consequences since we won't be able to
778 * fully reproduce the context of the exception
780 cwd
= get_fpu_cwd(task
);
781 swd
= get_fpu_swd(task
);
782 switch (((~cwd
) & swd
& 0x3f) | (swd
& 0x240)) {
786 case 0x001: /* Invalid Op */
787 case 0x041: /* Stack Fault */
788 case 0x241: /* Stack Fault | Direction */
789 info
.si_code
= FPE_FLTINV
;
791 case 0x002: /* Denormalize */
792 case 0x010: /* Underflow */
793 info
.si_code
= FPE_FLTUND
;
795 case 0x004: /* Zero Divide */
796 info
.si_code
= FPE_FLTDIV
;
798 case 0x008: /* Overflow */
799 info
.si_code
= FPE_FLTOVF
;
801 case 0x020: /* Precision */
802 info
.si_code
= FPE_FLTRES
;
805 force_sig_info(SIGFPE
, &info
, task
);
808 asmlinkage
void bad_intr(void)
810 printk("bad interrupt");
813 asmlinkage
void do_simd_coprocessor_error(struct pt_regs
*regs
)
815 void __user
*rip
= (void __user
*)(regs
->rip
);
816 struct task_struct
* task
;
818 unsigned short mxcsr
;
820 conditional_sti(regs
);
821 if ((regs
->cs
& 3) == 0 &&
822 kernel_math_error(regs
, "simd math error"))
826 * Save the info for the exception handler and clear the error.
830 task
->thread
.trap_no
= 19;
831 task
->thread
.error_code
= 0;
832 info
.si_signo
= SIGFPE
;
834 info
.si_code
= __SI_FAULT
;
837 * The SIMD FPU exceptions are handled a little differently, as there
838 * is only a single status/control register. Thus, to determine which
839 * unmasked exception was caught we must mask the exception mask bits
840 * at 0x1f80, and then use these to mask the exception bits at 0x3f.
842 mxcsr
= get_fpu_mxcsr(task
);
843 switch (~((mxcsr
& 0x1f80) >> 7) & (mxcsr
& 0x3f)) {
847 case 0x001: /* Invalid Op */
848 info
.si_code
= FPE_FLTINV
;
850 case 0x002: /* Denormalize */
851 case 0x010: /* Underflow */
852 info
.si_code
= FPE_FLTUND
;
854 case 0x004: /* Zero Divide */
855 info
.si_code
= FPE_FLTDIV
;
857 case 0x008: /* Overflow */
858 info
.si_code
= FPE_FLTOVF
;
860 case 0x020: /* Precision */
861 info
.si_code
= FPE_FLTRES
;
864 force_sig_info(SIGFPE
, &info
, task
);
867 asmlinkage
void do_spurious_interrupt_bug(struct pt_regs
* regs
)
871 asmlinkage
void __attribute__((weak
)) smp_thermal_interrupt(void)
876 * 'math_state_restore()' saves the current math information in the
877 * old math state array, and gets the new ones from the current task
879 * Careful.. There are problems with IBM-designed IRQ13 behaviour.
880 * Don't touch unless you *really* know how it works.
882 asmlinkage
void math_state_restore(void)
884 struct task_struct
*me
= current
;
885 clts(); /* Allow maths ops (or we recurse) */
889 restore_fpu_checking(&me
->thread
.i387
.fxsave
);
890 me
->thread_info
->status
|= TS_USEDFPU
;
893 void do_call_debug(struct pt_regs
*regs
)
895 notify_die(DIE_CALL
, "debug call", regs
, 0, 255, SIGINT
);
898 void __init
trap_init(void)
900 set_intr_gate(0,÷_error
);
901 set_intr_gate_ist(1,&debug
,DEBUG_STACK
);
902 set_intr_gate_ist(2,&nmi
,NMI_STACK
);
903 set_system_gate(3,&int3
);
904 set_system_gate(4,&overflow
); /* int4-5 can be called from all */
905 set_system_gate(5,&bounds
);
906 set_intr_gate(6,&invalid_op
);
907 set_intr_gate(7,&device_not_available
);
908 set_intr_gate_ist(8,&double_fault
, DOUBLEFAULT_STACK
);
909 set_intr_gate(9,&coprocessor_segment_overrun
);
910 set_intr_gate(10,&invalid_TSS
);
911 set_intr_gate(11,&segment_not_present
);
912 set_intr_gate_ist(12,&stack_segment
,STACKFAULT_STACK
);
913 set_intr_gate(13,&general_protection
);
914 set_intr_gate(14,&page_fault
);
915 set_intr_gate(15,&spurious_interrupt_bug
);
916 set_intr_gate(16,&coprocessor_error
);
917 set_intr_gate(17,&alignment_check
);
918 #ifdef CONFIG_X86_MCE
919 set_intr_gate_ist(18,&machine_check
, MCE_STACK
);
921 set_intr_gate(19,&simd_coprocessor_error
);
923 #ifdef CONFIG_IA32_EMULATION
924 set_system_gate(IA32_SYSCALL_VECTOR
, ia32_syscall
);
927 set_intr_gate(KDB_VECTOR
, call_debug
);
930 * Should be a barrier for any external CPU state.
936 /* Actual parsing is done early in setup.c. */
937 static int __init
oops_dummy(char *s
)
942 __setup("oops=", oops_dummy
);
944 static int __init
kstack_setup(char *s
)
946 kstack_depth_to_print
= simple_strtoul(s
,NULL
,0);
949 __setup("kstack=", kstack_setup
);