/* Using "rex64; fxsave %0" is broken because, if the memory operand
uses any extended registers for addressing, a second REX prefix
will be generated (to the assembler, rex64 followed by semicolon
- is a separate instruction), and hence the 64-bitness is lost.
- Using "fxsaveq %0" would be the ideal choice, but is only supported
- starting with gas 2.16.
- asm volatile("fxsaveq %0"
- : "=m" (fpu->state->fxsave));
- Using, as a workaround, the properly prefixed form below isn't
+ is a separate instruction), and hence the 64-bitness is lost. */
++
+#ifdef CONFIG_AS_FXSAVEQ
+ /* Using "fxsaveq %0" would be the ideal choice, but is only supported
+ starting with gas 2.16. */
+ __asm__ __volatile__("fxsaveq %0"
+ : "=m" (fpu->state->fxsave));
- #elif 0
++#else
+ /* Using, as a workaround, the properly prefixed form below isn't
accepted by any binutils version so far released, complaining that
the same type of prefix is used twice if an extended register is
- needed for addressing (fix submitted to mainline 2005-11-21). */
- __asm__ __volatile__("rex64/fxsave %0"
- : "=m" (fpu->state->fxsave));
- #else
- /* This, however, we can work around by forcing the compiler to select
+ needed for addressing (fix submitted to mainline 2005-11-21).
+ asm volatile("rex64/fxsave %0"
+ : "=m" (fpu->state->fxsave));
+ This, however, we can work around by forcing the compiler to select
an addressing mode that doesn't require extended registers. */
- __asm__ __volatile__("rex64/fxsave (%1)"
- : "=m" (fpu->state->fxsave)
- : "cdaSDb" (&fpu->state->fxsave));
+ asm volatile("rex64/fxsave (%[fx])"
+ : "=m" (fpu->state->fxsave)
+ : [fx] "R" (&fpu->state->fxsave));
+#endif
}
- static inline void fpu_save_init(struct fpu *fpu)
- {
- if (use_xsave())
- fpu_xsave(fpu);
- else
- fpu_fxsave(fpu);
-
- fpu_clear(fpu);
- }
-
- static inline void __save_init_fpu(struct task_struct *tsk)
- {
- fpu_save_init(&tsk->thread.fpu);
- task_thread_info(tsk)->status &= ~TS_USEDFPU;
- }
-
#else /* CONFIG_X86_32 */
- #ifdef CONFIG_MATH_EMULATION
- extern void finit_soft_fpu(struct i387_soft_struct *soft);
- #else
- static inline void finit_soft_fpu(struct i387_soft_struct *soft) {}
- #endif
-
- static inline void tolerant_fwait(void)
- {
- asm volatile("fnclex ; fwait");
- }
-
/* perform fxrstor iff the processor has extended states, otherwise frstor */
static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
{