From 897b1d1db99ff3269a9eb6d2822d6c573063a258 Mon Sep 17 00:00:00 2001 From: Suresh Siddha Date: Fri, 24 Aug 2012 14:13:01 -0700 Subject: [PATCH] --- yaml --- r: 323999 b: refs/heads/master c: 9c6ff8bbb69a4e7b47ac40bfa44509296e89c5c0 h: refs/heads/master i: 323997: 8e07788a40ef80e3b0d562b2808e067fa38aa186 323995: 1aab341a41132a24a29553bb6e0a9165d72df9e3 323991: a1a62789a2bb4097f265d77c6806ada4405ab4d0 323983: ebde109fb5d0e028d7910b519399ded8b7417d18 323967: 7438258a8fcb87e6e4d2f0254055510c5a09938c v: v3 --- [refs] | 2 +- trunk/drivers/lguest/x86/core.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index e4c2c279a74b..4c6508e64cd7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 841e3604d35aa70d399146abdc526d8c89a2c2f5 +refs/heads/master: 9c6ff8bbb69a4e7b47ac40bfa44509296e89c5c0 diff --git a/trunk/drivers/lguest/x86/core.c b/trunk/drivers/lguest/x86/core.c index 39809035320a..4af12e1844d5 100644 --- a/trunk/drivers/lguest/x86/core.c +++ b/trunk/drivers/lguest/x86/core.c @@ -203,8 +203,8 @@ void lguest_arch_run_guest(struct lg_cpu *cpu) * we set it now, so we can trap and pass that trap to the Guest if it * uses the FPU. */ - if (cpu->ts) - unlazy_fpu(current); + if (cpu->ts && user_has_fpu()) + stts(); /* * SYSENTER is an optimized way of doing system calls. We can't allow @@ -234,6 +234,10 @@ void lguest_arch_run_guest(struct lg_cpu *cpu) if (boot_cpu_has(X86_FEATURE_SEP)) wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); + /* Clear the host TS bit if it was set above. */ + if (cpu->ts && user_has_fpu()) + clts(); + /* * If the Guest page faulted, then the cr2 register will tell us the * bad virtual address. We have to grab this now, because once we @@ -249,7 +253,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu) * a different CPU. So all the critical stuff should be done * before this. */ - else if (cpu->regs->trapnum == 7) + else if (cpu->regs->trapnum == 7 && !user_has_fpu()) math_state_restore(); }