X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-mips%2Ffpu.h;h=e59d4c039661278a469df9caa5e2a74f6cee1a50;hb=13c48c490208d9e70d8d66d56f96c5054db69af7;hp=4e12d1f9534f9d99d43123c0cb517887946b5443;hpb=604119a4b22b95e30dea6af3b3bfdc2f07fa4afd;p=linux-2.6 diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h index 4e12d1f953..e59d4c0396 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h @@ -12,11 +12,12 @@ #include #include +#include #include #include #include -#include +#include #include #include @@ -38,38 +39,18 @@ 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 __fpu_enabled() (read_c0_status() & ST0_CU1) - #define enable_fpu() \ do { \ if (cpu_has_fpu) \ @@ -102,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(); } @@ -162,18 +148,4 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) return tsk->thread.fpu.fpr; } -static inline void enable_fp_in_kernel(void) -{ - set_thread_flag(TIF_ALLOW_FP_IN_KERNEL); - /* make sure CU1 and FPU ownership are consistent */ - if (!__is_fpu_owner() && __fpu_enabled()) - __disable_fpu(); -} - -static inline void disable_fp_in_kernel(void) -{ - BUG_ON(!__is_fpu_owner() && __fpu_enabled()); - clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL); -} - #endif /* _ASM_FPU_H */