aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/i387.c
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2010-09-03 21:17:09 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2010-09-09 17:16:20 -0400
commit6ac8bac2684235f4caf22a410549c582aa7327d6 (patch)
treed376c2c06ffa1461219f5370497d220cd4afefb0 /arch/x86/kernel/i387.c
parent2df7a6e9e8e67c19e5fe2eac3f2d2223b7bb4a7b (diff)
x86, fpu: Merge fpu_init()
Make fpu_init() handle 32-bit setup. Signed-off-by: Brian Gerst <brgerst@gmail.com> Acked-by: Pekka Enberg <penberg@kernel.org> Cc: Suresh Siddha <suresh.b.siddha@intel.com> LKML-Reference: <1283563039-3466-3-git-send-email-brgerst@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r--arch/x86/kernel/i387.c30
1 files changed, 14 insertions, 16 deletions
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