]> err.no Git - linux-2.6/blobdiff - include/asm-mips/fpu.h
[MIPS] Remove mips_machtype from EMMA2RH machines
[linux-2.6] / include / asm-mips / fpu.h
index 71436f90203fece8abe35aa6f5962eee567b7a36..e59d4c039661278a469df9caa5e2a74f6cee1a50 100644 (file)
 
 #include <linux/sched.h>
 #include <linux/thread_info.h>
+#include <linux/bitops.h>
 
 #include <asm/mipsregs.h>
 #include <asm/cpu.h>
 #include <asm/cpu-features.h>
-#include <asm/bitops.h>
+#include <asm/hazards.h>
 #include <asm/processor.h>
 #include <asm/current.h>
 
@@ -38,34 +39,16 @@ extern void _init_fpu(void);
 extern void _save_fp(struct task_struct *);
 extern void _restore_fp(struct task_struct *);
 
-#if defined(CONFIG_CPU_SB1)
-#define __enable_fpu_hazard()                                          \
-do {                                                                   \
-       asm(".set       push            \n\t"                           \
-           ".set       mips64          \n\t"                           \
-           ".set       noreorder       \n\t"                           \
-           "ssnop                      \n\t"                           \
-           "bnezl      $0, .+4         \n\t"                           \
-           "ssnop                      \n\t"                           \
-           ".set pop");                                                \
-} while (0)
-#else
-#define __enable_fpu_hazard()                                          \
-do {                                                                   \
-       asm("nop;nop;nop;nop");         /* max. hazard */               \
-} while (0)
-#endif
-
 #define __enable_fpu()                                                 \
 do {                                                                   \
         set_c0_status(ST0_CU1);                                                \
-        __enable_fpu_hazard();                                         \
+        enable_fpu_hazard();                                           \
 } while (0)
 
 #define __disable_fpu()                                                        \
 do {                                                                   \
        clear_c0_status(ST0_CU1);                                       \
-       /* We don't care about the c0 hazard here  */                   \
+        disable_fpu_hazard();                                          \
 } while (0)
 
 #define enable_fpu()                                                   \
@@ -100,14 +83,19 @@ static inline void __own_fpu(void)
        set_thread_flag(TIF_USEDFPU);
 }
 
-static inline void own_fpu(int restore)
+static inline void own_fpu_inatomic(int restore)
 {
-       preempt_disable();
        if (cpu_has_fpu && !__is_fpu_owner()) {
                __own_fpu();
                if (restore)
                        _restore_fp(current);
        }
+}
+
+static inline void own_fpu(int restore)
+{
+       preempt_disable();
+       own_fpu_inatomic(restore);
        preempt_enable();
 }