Commit e102f30f authored by Ingo Molnar's avatar Ingo Molnar

x86/fpu: Move fpu_copy() to fpu/core.c

Move fpu_copy() where its only user is.

Beyond readability this also speeds up compilation, as fpu-internal.h
is included in over a dozen .c files.
Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
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: default avatarIngo Molnar <mingo@kernel.org>
parent 6522d783
...@@ -565,20 +565,6 @@ extern int fpstate_alloc(struct fpu *fpu); ...@@ -565,20 +565,6 @@ extern int fpstate_alloc(struct fpu *fpu);
extern void fpstate_free(struct fpu *fpu); extern void fpstate_free(struct fpu *fpu);
extern int fpu__copy(struct task_struct *dst, struct task_struct *src); extern int fpu__copy(struct task_struct *dst, struct task_struct *src);
static inline void fpu_copy(struct task_struct *dst, struct task_struct *src)
{
if (use_eager_fpu()) {
memset(&dst->thread.fpu.state->xsave, 0, xstate_size);
__save_fpu(dst);
} else {
struct fpu *dfpu = &dst->thread.fpu;
struct fpu *sfpu = &src->thread.fpu;
fpu__save(src);
memcpy(dfpu->state, sfpu->state, xstate_size);
}
}
static inline unsigned long static inline unsigned long
alloc_mathframe(unsigned long sp, int ia32_frame, unsigned long *buf_fx, alloc_mathframe(unsigned long sp, int ia32_frame, unsigned long *buf_fx,
unsigned long *size) unsigned long *size)
......
...@@ -203,6 +203,20 @@ void fpstate_free(struct fpu *fpu) ...@@ -203,6 +203,20 @@ void fpstate_free(struct fpu *fpu)
} }
EXPORT_SYMBOL_GPL(fpstate_free); EXPORT_SYMBOL_GPL(fpstate_free);
static void fpu_copy(struct task_struct *dst, struct task_struct *src)
{
if (use_eager_fpu()) {
memset(&dst->thread.fpu.state->xsave, 0, xstate_size);
__save_fpu(dst);
} else {
struct fpu *dfpu = &dst->thread.fpu;
struct fpu *sfpu = &src->thread.fpu;
fpu__save(src);
memcpy(dfpu->state, sfpu->state, xstate_size);
}
}
int fpu__copy(struct task_struct *dst, struct task_struct *src) int fpu__copy(struct task_struct *dst, struct task_struct *src)
{ {
dst->thread.fpu.counter = 0; dst->thread.fpu.counter = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment