summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@evo.osdl.org>2005-07-22 16:06:16 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-07-22 16:06:16 -0400
commit8ed1383fb7b6685968588141d5934e0e6715e954 (patch)
tree7ee8476ec114dbab907e3acf4e8a9d0342bf6751 /include
parentb339a18b81a1f6ca1455559594f5df872b9e59f4 (diff)
downloadop-kernel-dev-8ed1383fb7b6685968588141d5934e0e6715e954.zip
op-kernel-dev-8ed1383fb7b6685968588141d5934e0e6715e954.tar.gz
x86: make restore_fpu() use alternative assembler instructions
It's really just a single instruction, conditional on whether the CPU supports FXSR or not, so implement it as such instead of making it a function that queries FXSR dynamically. This means that the instruction just gets automatically rewritten to the correct one at boot-time.
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/i387.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index f6feb98..e678609 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -19,10 +19,21 @@
extern void mxcsr_feature_mask_init(void);
extern void init_fpu(struct task_struct *);
+
/*
* FPU lazy state save handling...
*/
-extern void restore_fpu( struct task_struct *tsk );
+
+/*
+ * The "nop" is needed to make the instructions the same
+ * length.
+ */
+#define restore_fpu(tsk) \
+ alternative_input( \
+ "nop ; frstor %1", \
+ "fxrstor %1", \
+ X86_FEATURE_FXSR, \
+ "m" ((tsk)->thread.i387.fsave))
extern void kernel_fpu_begin(void);
#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0)
OpenPOWER on IntegriCloud