From: Kevin Hao Date: Sun, 14 Jul 2013 08:40:06 +0000 (+0800) Subject: powerpc/math-emu: Move the flush FPU state function into do_mathemu X-Git-Tag: firefly_0821_release~176^2~5411^2~71 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6761ee3d7e139ec8728e1515bfc5fdcaf3be317e;p=firefly-linux-kernel-4.4.55.git powerpc/math-emu: Move the flush FPU state function into do_mathemu By doing this we can make sure that the FPU state is only flushed to the thread struct when it is really needed. Signed-off-by: Kevin Hao Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index f58eaf23e8f1..82df498069bc 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -1134,15 +1134,6 @@ void __kprobes program_check_exception(struct pt_regs *regs) * instruction or only on FP instructions, whether there is a * pattern to occurrences etc. -dgibson 31/Mar/2003 */ - - /* - * If we support a HW FPU, we need to ensure the FP state - * if flushed into the thread_struct before attempting - * emulation - */ -#ifdef CONFIG_PPC_FPU - flush_fp_to_thread(current); -#endif switch (do_mathemu(regs)) { case 0: emulate_single_step(regs); diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c index 3fe8e35287a1..f9ef34746f16 100644 --- a/arch/powerpc/math-emu/math.c +++ b/arch/powerpc/math-emu/math.c @@ -420,6 +420,15 @@ do_mathemu(struct pt_regs *regs) goto illegal; } + /* + * If we support a HW FPU, we need to ensure the FP state + * is flushed into the thread_struct before attempting + * emulation + */ +#ifdef CONFIG_PPC_FPU + flush_fp_to_thread(current); +#endif + eflag = func(op0, op1, op2, op3); if (insn & 1) {