Skip to content

Commit

Permalink
x86/fpu: Move restore_init_xstate() out of fpu/internal.h
Browse files Browse the repository at this point in the history
Move restore_init_xstate() next to its sole caller.

Also rename it to copy_init_fpstate_to_fpregs() and add
some comments about what it does.

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed May 19, 2015
1 parent 6f57502 commit 8154188
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 0 additions & 8 deletions arch/x86/include/asm/fpu/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,6 @@ static inline void fpregs_deactivate(struct fpu *fpu)
__fpregs_deactivate_hw();
}

static inline void restore_init_xstate(void)
{
if (use_xsave())
xrstor_state(&init_fpstate.xsave, -1);
else
fxrstor_checking(&init_fpstate.fxsave);
}

/*
* Definitions for the eXtended Control Register instructions
*/
Expand Down
14 changes: 13 additions & 1 deletion arch/x86/kernel/fpu/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,18 @@ void fpu__drop(struct fpu *fpu)
preempt_enable();
}

/*
* Clear FPU registers by setting them up from
* the init fpstate:
*/
static inline void copy_init_fpstate_to_fpregs(void)
{
if (use_xsave())
xrstor_state(&init_fpstate.xsave, -1);
else
fxrstor_checking(&init_fpstate.fxsave);
}

/*
* Clear the FPU state back to init state.
*
Expand All @@ -409,7 +421,7 @@ void fpu__clear(struct fpu *fpu)
fpu__activate_curr(fpu);
user_fpu_begin();
}
restore_init_xstate();
copy_init_fpstate_to_fpregs();
}
}

Expand Down

0 comments on commit 8154188

Please sign in to comment.