i387: Split up <asm/i387.h> into exported and internal interfaces
[pandora-kernel.git] / arch / x86 / kernel / traps.c
index 4d42300..ec61d4c 100644 (file)
@@ -54,6 +54,7 @@
 #include <asm/traps.h>
 #include <asm/desc.h>
 #include <asm/i387.h>
+#include <asm/fpu-internal.h>
 #include <asm/mce.h>
 
 #include <asm/mach_traps.h>
@@ -582,12 +583,7 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void)
  */
 void math_state_restore(void)
 {
-       struct thread_info *thread = current_thread_info();
-       struct task_struct *tsk = thread->task;
-
-       /* We need a safe address that is cheap to find and that is already
-          in L1. We just brought in "thread->task", so use that */
-#define safe_address (thread->task)
+       struct task_struct *tsk = current;
 
        if (!tsk_used_math(tsk)) {
                local_irq_enable();
@@ -604,23 +600,12 @@ void math_state_restore(void)
                local_irq_disable();
        }
 
-       __thread_fpu_begin(thread);
-
-       /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
-          is pending.  Clear the x87 state here by setting it to fixed
-          values. safe_address is a random variable that should be in L1 */
-       alternative_input(
-               ASM_NOP8 ASM_NOP2,
-               "emms\n\t"              /* clear stack tags */
-               "fildl %P[addr]",       /* set F?P to defined value */
-               X86_FEATURE_FXSAVE_LEAK,
-               [addr] "m" (safe_address));
-
+       __thread_fpu_begin(tsk);
        /*
         * Paranoid restore. send a SIGSEGV if we fail to restore the state.
         */
        if (unlikely(restore_fpu_checking(tsk))) {
-               __thread_fpu_end(thread);
+               __thread_fpu_end(tsk);
                force_sig(SIGSEGV, tsk);
                return;
        }