Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / arch / x86 / math-emu / fpu_entry.c
index 6e38d87..c7b06fe 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/uaccess.h>
 #include <asm/desc.h>
 #include <asm/user.h>
+#include <asm/i387.h>
 
 #include "fpu_system.h"
 #include "fpu_emu.h"
@@ -146,6 +147,13 @@ asmlinkage void math_emulate(long arg)
        unsigned long code_limit = 0;   /* Initialized to stop compiler warnings */
        struct desc_struct code_descriptor;
 
+       if (!used_math()) {
+               if (init_fpu(current)) {
+                       do_group_exit(SIGKILL);
+                       return;
+               }
+       }
+
 #ifdef RE_ENTRANT_CHECKING
        if (emulating) {
                printk("ERROR: wm-FPU-emu is not RE-ENTRANT!\n");
@@ -153,11 +161,6 @@ asmlinkage void math_emulate(long arg)
        RE_ENTRANT_CHECK_ON;
 #endif /* RE_ENTRANT_CHECKING */
 
-       if (!used_math()) {
-               finit();
-               set_used_math();
-       }
-
        SETUP_DATA_AREA(arg);
 
        FPU_ORIG_EIP = FPU_EIP;