aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/common.c7
-rw-r--r--arch/x86/kernel/i387.c30
-rw-r--r--arch/x86/kernel/traps.c12
3 files changed, 14 insertions, 35 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 490dac63c2d..f9e23e8639e 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1264,13 +1264,6 @@ void __cpuinit cpu_init(void)
1264 clear_all_debug_regs(); 1264 clear_all_debug_regs();
1265 dbg_restore_debug_regs(); 1265 dbg_restore_debug_regs();
1266 1266
1267 /*
1268 * Force FPU initialization:
1269 */
1270 current_thread_info()->status = 0;
1271 clear_used_math();
1272 mxcsr_feature_mask_init();
1273
1274 fpu_init(); 1267 fpu_init();
1275 xsave_init(); 1268 xsave_init();
1276} 1269}
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 2605c50b11d..82166519497 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -85,7 +85,6 @@ static void __cpuinit init_thread_xstate(void)
85#endif 85#endif
86} 86}
87 87
88#ifdef CONFIG_X86_64
89/* 88/*
90 * Called at bootup to set up the initial FPU state that is later cloned 89 * Called at bootup to set up the initial FPU state that is later cloned
91 * into all processes. 90 * into all processes.
@@ -93,12 +92,21 @@ static void __cpuinit init_thread_xstate(void)
93 92
94void __cpuinit fpu_init(void) 93void __cpuinit fpu_init(void)
95{ 94{
96 unsigned long oldcr0 = read_cr0(); 95 unsigned long cr0;
97 96 unsigned long cr4_mask = 0;
98 set_in_cr4(X86_CR4_OSFXSR);
99 set_in_cr4(X86_CR4_OSXMMEXCPT);
100 97
101 write_cr0(oldcr0 & ~(X86_CR0_TS|X86_CR0_EM)); /* clear TS and EM */ 98 if (cpu_has_fxsr)
99 cr4_mask |= X86_CR4_OSFXSR;
100 if (cpu_has_xmm)
101 cr4_mask |= X86_CR4_OSXMMEXCPT;
102 if (cr4_mask)
103 set_in_cr4(cr4_mask);
104
105 cr0 = read_cr0();
106 cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */
107 if (!HAVE_HWFP)
108 cr0 |= X86_CR0_EM;
109 write_cr0(cr0);
102 110
103 if (!smp_processor_id()) 111 if (!smp_processor_id())
104 init_thread_xstate(); 112 init_thread_xstate();
@@ -109,16 +117,6 @@ void __cpuinit fpu_init(void)
109 clear_used_math(); 117 clear_used_math();
110} 118}
111 119
112#else /* CONFIG_X86_64 */
113
114void __cpuinit fpu_init(void)
115{
116 if (!smp_processor_id())
117 init_thread_xstate();
118}
119
120#endif /* CONFIG_X86_32 */
121
122void fpu_finit(struct fpu *fpu) 120void fpu_finit(struct fpu *fpu)
123{ 121{
124#ifdef CONFIG_X86_32 122#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 60788dee0f8..d0029eb5858 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -881,18 +881,6 @@ void __init trap_init(void)
881#endif 881#endif
882 882
883#ifdef CONFIG_X86_32 883#ifdef CONFIG_X86_32
884 if (cpu_has_fxsr) {
885 printk(KERN_INFO "Enabling fast FPU save and restore... ");
886 set_in_cr4(X86_CR4_OSFXSR);
887 printk("done.\n");
888 }
889 if (cpu_has_xmm) {
890 printk(KERN_INFO
891 "Enabling unmasked SIMD FPU exception support... ");
892 set_in_cr4(X86_CR4_OSXMMEXCPT);
893 printk("done.\n");
894 }
895
896 set_system_trap_gate(SYSCALL_VECTOR, &system_call); 884 set_system_trap_gate(SYSCALL_VECTOR, &system_call);
897 set_bit(SYSCALL_VECTOR, used_vectors); 885 set_bit(SYSCALL_VECTOR, used_vectors);
898#endif 886#endif