aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/i387.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@evo.osdl.org>2005-07-22 18:19:20 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-07-22 18:19:20 -0400
commit2847e3478c3d8119eedc3e0cb85a308b21f681dd (patch)
tree40e24b6a405331ae5fc9ed38b0d4872c84069891 /include/asm-i386/i387.h
parent38afd6adf6bccd7176e88c07cac104d3639aa30d (diff)
x86: use alternative instructions for fnsave/fxsave too
This one ends up using an inline asm format that claims to read memory and then clobber it (rather than just write it directly), which made it easier to use the existing "alternative_input()" infrastructure support. Now the fxsave code matches the fxrstor.
Diffstat (limited to 'include/asm-i386/i387.h')
-rw-r--r--include/asm-i386/i387.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index e678609bb57e..6747006743f9 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -33,7 +33,7 @@ extern void init_fpu(struct task_struct *);
33 "nop ; frstor %1", \ 33 "nop ; frstor %1", \
34 "fxrstor %1", \ 34 "fxrstor %1", \
35 X86_FEATURE_FXSR, \ 35 X86_FEATURE_FXSR, \
36 "m" ((tsk)->thread.i387.fsave)) 36 "m" ((tsk)->thread.i387.fxsave))
37 37
38extern void kernel_fpu_begin(void); 38extern void kernel_fpu_begin(void);
39#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0) 39#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0)
@@ -43,13 +43,12 @@ extern void kernel_fpu_begin(void);
43 */ 43 */
44static inline void __save_init_fpu( struct task_struct *tsk ) 44static inline void __save_init_fpu( struct task_struct *tsk )
45{ 45{
46 if ( cpu_has_fxsr ) { 46 alternative_input(
47 asm volatile( "fxsave %0 ; fnclex" 47 "fnsave %1 ; fwait ;" GENERIC_NOP2,
48 : "=m" (tsk->thread.i387.fxsave) ); 48 "fxsave %1 ; fnclex",
49 } else { 49 X86_FEATURE_FXSR,
50 asm volatile( "fnsave %0 ; fwait" 50 "m" (tsk->thread.i387.fxsave)
51 : "=m" (tsk->thread.i387.fsave) ); 51 :"memory");
52 }
53 tsk->thread_info->status &= ~TS_USEDFPU; 52 tsk->thread_info->status &= ~TS_USEDFPU;
54} 53}
55 54