x86: fix broken math-emu with lazy allocation of fpu area

Fix the math emulation that got broken with the recent lazy allocation of FPU
area. init_fpu() need to be added for the math-emulation path aswell
for the FPU area allocation.

math emulation enabled kernel booted fine with this, in the presence
of "no387 nofxsr" boot param.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: hpa@zytor.com
Cc: mingo@elte.hu
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Suresh Siddha
2008-05-23 16:26:37 -07:00
committed by Thomas Gleixner
parent 5c1ea08215
commit e8a496ac8c
3 changed files with 39 additions and 20 deletions

View File

@ -30,6 +30,7 @@
#include <asm/uaccess.h>
#include <asm/desc.h>
#include <asm/user.h>
#include <asm/i387.h>
#include "fpu_system.h"
#include "fpu_emu.h"
@ -146,6 +147,13 @@ asmlinkage void math_emulate(long arg)
unsigned long code_limit = 0; /* Initialized to stop compiler warnings */
struct desc_struct code_descriptor;
if (!used_math()) {
if (init_fpu(current)) {
do_group_exit(SIGKILL);
return;
}
}
#ifdef RE_ENTRANT_CHECKING
if (emulating) {
printk("ERROR: wm-FPU-emu is not RE-ENTRANT!\n");
@ -153,11 +161,6 @@ asmlinkage void math_emulate(long arg)
RE_ENTRANT_CHECK_ON;
#endif /* RE_ENTRANT_CHECKING */
if (!used_math()) {
finit();
set_used_math();
}
SETUP_DATA_AREA(arg);
FPU_ORIG_EIP = FPU_EIP;