]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-x86/i387.h
x86: fix broken math-emu with lazy allocation of fpu area
[linux-2.6-omap-h63xx.git] / include / asm-x86 / i387.h
index da2adb45f6e3949476ac0a4d2c1aa1cbb2024986..37672f79dcc8f3c879e7899f31868d7d06c2e0ae 100644 (file)
@@ -175,7 +175,15 @@ static inline int save_i387(struct _fpstate __user *buf)
  */
 static inline int restore_i387(struct _fpstate __user *buf)
 {
-       set_used_math();
+       struct task_struct *tsk = current;
+       int err;
+
+       if (!used_math()) {
+               err = init_fpu(tsk);
+               if (err)
+                       return err;
+       }
+
        if (!(task_thread_info(current)->status & TS_USEDFPU)) {
                clts();
                task_thread_info(current)->status |= TS_USEDFPU;
@@ -185,6 +193,8 @@ static inline int restore_i387(struct _fpstate __user *buf)
 
 #else  /* CONFIG_X86_32 */
 
+extern void finit(void);
+
 static inline void tolerant_fwait(void)
 {
        asm volatile("fnclex ; fwait");