extern void fpu__cpu_init(void);
extern void eager_fpu_init(void);
-DECLARE_PER_CPU(struct task_struct *, fpu_owner_task);
+DECLARE_PER_CPU(struct fpu *, fpu_fpregs_owner_ctx);
extern void convert_from_fxsr(struct user_i387_ia32_struct *env,
struct task_struct *tsk);
#endif
/*
- * Must be run with preemption disabled: this clears the fpu_owner_task,
+ * Must be run with preemption disabled: this clears the fpu_fpregs_owner_ctx,
* on this CPU.
*
* This will disable any lazy FPU state restore of the current FPU state,
*/
static inline void __cpu_disable_lazy_restore(unsigned int cpu)
{
- per_cpu(fpu_owner_task, cpu) = NULL;
+ per_cpu(fpu_fpregs_owner_ctx, cpu) = NULL;
}
/*
static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
{
- return new == this_cpu_read_stable(fpu_owner_task) &&
+ return &new->thread.fpu == this_cpu_read_stable(fpu_fpregs_owner_ctx) &&
cpu == new->thread.fpu.last_cpu;
}
static inline void __thread_clear_has_fpu(struct fpu *fpu)
{
fpu->has_fpu = 0;
- this_cpu_write(fpu_owner_task, NULL);
+ this_cpu_write(fpu_fpregs_owner_ctx, NULL);
}
/* Must be paired with a 'clts' before! */
static inline void __thread_set_has_fpu(struct task_struct *tsk)
{
tsk->thread.fpu.has_fpu = 1;
- this_cpu_write(fpu_owner_task, tsk);
+ this_cpu_write(fpu_fpregs_owner_ctx, &tsk->thread.fpu);
}
/*
else
old->thread.fpu.last_cpu = cpu;
- /* But leave fpu_owner_task! */
+ /* But leave fpu_fpregs_owner_ctx! */
old->thread.fpu.has_fpu = 0;
/* Don't change CR0.TS if we just switch! */
static DEFINE_PER_CPU(bool, in_kernel_fpu);
/*
- * Track which task is using the FPU on the CPU:
+ * Track which context is using the FPU on the CPU:
*/
-DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
+DEFINE_PER_CPU(struct fpu *, fpu_fpregs_owner_ctx);
static void kernel_fpu_disable(void)
{
void __kernel_fpu_begin(void)
{
- struct task_struct *me = current;
- struct fpu *fpu = &me->thread.fpu;
+ struct fpu *fpu = ¤t->thread.fpu;
kernel_fpu_disable();
if (fpu->has_fpu) {
fpu_save_init(fpu);
} else {
- this_cpu_write(fpu_owner_task, NULL);
+ this_cpu_write(fpu_fpregs_owner_ctx, NULL);
if (!use_eager_fpu())
clts();
}