extern void fpu__activate_curr(struct fpu *fpu);
extern void fpstate_init(struct fpu *fpu);
-extern void fpu__clear(struct task_struct *tsk);
extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
+
+/*
+ * High level FPU state handling functions:
+ */
+extern void fpu__save(struct fpu *fpu);
extern void fpu__restore(void);
+extern void fpu__drop(struct fpu *fpu);
+extern int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu);
+extern void fpu__reset(struct fpu *fpu);
+extern void fpu__clear(struct task_struct *tsk);
+
extern void fpu__init_check_bugs(void);
extern void fpu__resume_cpu(void);
return 0;
}
-extern void fpu__save(struct fpu *fpu);
-
static inline int __copy_fpstate_to_fpregs(struct fpu *fpu)
{
if (use_xsave())
__fpregs_deactivate_hw();
}
-/*
- * Drops current FPU state: deactivates the fpregs and
- * the fpstate. NOTE: it still leaves previous contents
- * in the fpregs in the eager-FPU case.
- *
- * This function can be used in cases where we know that
- * a state-restore is coming: either an explicit one,
- * or a reschedule.
- */
-static inline void fpu__drop(struct fpu *fpu)
-{
- preempt_disable();
- fpu->counter = 0;
-
- if (fpu->fpregs_active) {
- /* Ignore delayed exceptions from user space */
- asm volatile("1: fwait\n"
- "2:\n"
- _ASM_EXTABLE(1b, 2b));
- fpregs_deactivate(fpu);
- }
-
- fpu->fpstate_active = 0;
-
- preempt_enable();
-}
-
static inline void restore_init_xstate(void)
{
if (use_xsave())
fxrstor_checking(&init_xstate_ctx.i387);
}
-/*
- * Reset the FPU state back to init state.
- */
-static inline void fpu__reset(struct fpu *fpu)
-{
- if (!use_eager_fpu())
- fpu__drop(fpu);
- else
- restore_init_xstate();
-}
-
/*
* Definitions for the eXtended Control Register instructions
*/
}
}
-extern int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu);
-
static inline unsigned long
alloc_mathframe(unsigned long sp, int ia32_frame, unsigned long *buf_fx,
unsigned long *size)
}
EXPORT_SYMBOL_GPL(fpu__restore);
+/*
+ * Drops current FPU state: deactivates the fpregs and
+ * the fpstate. NOTE: it still leaves previous contents
+ * in the fpregs in the eager-FPU case.
+ *
+ * This function can be used in cases where we know that
+ * a state-restore is coming: either an explicit one,
+ * or a reschedule.
+ */
+void fpu__drop(struct fpu *fpu)
+{
+ preempt_disable();
+ fpu->counter = 0;
+
+ if (fpu->fpregs_active) {
+ /* Ignore delayed exceptions from user space */
+ asm volatile("1: fwait\n"
+ "2:\n"
+ _ASM_EXTABLE(1b, 2b));
+ fpregs_deactivate(fpu);
+ }
+
+ fpu->fpstate_active = 0;
+
+ preempt_enable();
+}
+
+/*
+ * Reset the FPU state back to init state:
+ */
+void fpu__reset(struct fpu *fpu)
+{
+ if (!use_eager_fpu())
+ fpu__drop(fpu);
+ else
+ restore_init_xstate();
+}
+
/*
* Called by sys_execve() to clear the FPU fpregs, so that FPU state
* of the previous binary does not leak over into the exec()ed binary: