diff options
Diffstat (limited to 'arch/x86/kernel/traps.c')
-rw-r--r-- | arch/x86/kernel/traps.c | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 5204332f475d..7dc0de9d1ed9 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <asm/mach_traps.h> | 59 | #include <asm/mach_traps.h> |
60 | 60 | ||
61 | #ifdef CONFIG_X86_64 | 61 | #ifdef CONFIG_X86_64 |
62 | #include <asm/x86_init.h> | ||
62 | #include <asm/pgalloc.h> | 63 | #include <asm/pgalloc.h> |
63 | #include <asm/proto.h> | 64 | #include <asm/proto.h> |
64 | #else | 65 | #else |
@@ -76,7 +77,7 @@ char ignore_fpu_irq; | |||
76 | * F0 0F bug workaround.. We have a special link segment | 77 | * F0 0F bug workaround.. We have a special link segment |
77 | * for this. | 78 | * for this. |
78 | */ | 79 | */ |
79 | gate_desc idt_table[256] | 80 | gate_desc idt_table[NR_VECTORS] |
80 | __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; | 81 | __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; |
81 | #endif | 82 | #endif |
82 | 83 | ||
@@ -786,33 +787,34 @@ do_spurious_interrupt_bug(struct pt_regs *regs, long error_code) | |||
786 | #endif | 787 | #endif |
787 | } | 788 | } |
788 | 789 | ||
789 | #ifdef CONFIG_X86_32 | 790 | asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void) |
790 | unsigned long patch_espfix_desc(unsigned long uesp, unsigned long kesp) | ||
791 | { | 791 | { |
792 | struct desc_struct *gdt = get_cpu_gdt_table(smp_processor_id()); | ||
793 | unsigned long base = (kesp - uesp) & -THREAD_SIZE; | ||
794 | unsigned long new_kesp = kesp - base; | ||
795 | unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT; | ||
796 | __u64 desc = *(__u64 *)&gdt[GDT_ENTRY_ESPFIX_SS]; | ||
797 | |||
798 | /* Set up base for espfix segment */ | ||
799 | desc &= 0x00f0ff0000000000ULL; | ||
800 | desc |= ((((__u64)base) << 16) & 0x000000ffffff0000ULL) | | ||
801 | ((((__u64)base) << 32) & 0xff00000000000000ULL) | | ||
802 | ((((__u64)lim_pages) << 32) & 0x000f000000000000ULL) | | ||
803 | (lim_pages & 0xffff); | ||
804 | *(__u64 *)&gdt[GDT_ENTRY_ESPFIX_SS] = desc; | ||
805 | |||
806 | return new_kesp; | ||
807 | } | 792 | } |
808 | #endif | ||
809 | 793 | ||
810 | asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void) | 794 | asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) |
811 | { | 795 | { |
812 | } | 796 | } |
813 | 797 | ||
814 | asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) | 798 | /* |
799 | * __math_state_restore assumes that cr0.TS is already clear and the | ||
800 | * fpu state is all ready for use. Used during context switch. | ||
801 | */ | ||
802 | void __math_state_restore(void) | ||
815 | { | 803 | { |
804 | struct thread_info *thread = current_thread_info(); | ||
805 | struct task_struct *tsk = thread->task; | ||
806 | |||
807 | /* | ||
808 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
809 | */ | ||
810 | if (unlikely(restore_fpu_checking(tsk))) { | ||
811 | stts(); | ||
812 | force_sig(SIGSEGV, tsk); | ||
813 | return; | ||
814 | } | ||
815 | |||
816 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | ||
817 | tsk->fpu_counter++; | ||
816 | } | 818 | } |
817 | 819 | ||
818 | /* | 820 | /* |
@@ -846,17 +848,8 @@ asmlinkage void math_state_restore(void) | |||
846 | } | 848 | } |
847 | 849 | ||
848 | clts(); /* Allow maths ops (or we recurse) */ | 850 | clts(); /* Allow maths ops (or we recurse) */ |
849 | /* | ||
850 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
851 | */ | ||
852 | if (unlikely(restore_fpu_checking(tsk))) { | ||
853 | stts(); | ||
854 | force_sig(SIGSEGV, tsk); | ||
855 | return; | ||
856 | } | ||
857 | 851 | ||
858 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | 852 | __math_state_restore(); |
859 | tsk->fpu_counter++; | ||
860 | } | 853 | } |
861 | EXPORT_SYMBOL_GPL(math_state_restore); | 854 | EXPORT_SYMBOL_GPL(math_state_restore); |
862 | 855 | ||
@@ -980,7 +973,5 @@ void __init trap_init(void) | |||
980 | */ | 973 | */ |
981 | cpu_init(); | 974 | cpu_init(); |
982 | 975 | ||
983 | #ifdef CONFIG_X86_32 | 976 | x86_init.irqs.trap_init(); |
984 | x86_quirk_trap_init(); | ||
985 | #endif | ||
986 | } | 977 | } |