diff options
| -rw-r--r-- | drivers/lguest/x86/core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 39809035320a..4af12e1844d5 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
| @@ -203,8 +203,8 @@ void lguest_arch_run_guest(struct lg_cpu *cpu) | |||
| 203 | * we set it now, so we can trap and pass that trap to the Guest if it | 203 | * we set it now, so we can trap and pass that trap to the Guest if it |
| 204 | * uses the FPU. | 204 | * uses the FPU. |
| 205 | */ | 205 | */ |
| 206 | if (cpu->ts) | 206 | if (cpu->ts && user_has_fpu()) |
| 207 | unlazy_fpu(current); | 207 | stts(); |
| 208 | 208 | ||
| 209 | /* | 209 | /* |
| 210 | * SYSENTER is an optimized way of doing system calls. We can't allow | 210 | * 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) | |||
| 234 | if (boot_cpu_has(X86_FEATURE_SEP)) | 234 | if (boot_cpu_has(X86_FEATURE_SEP)) |
| 235 | wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); | 235 | wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); |
| 236 | 236 | ||
| 237 | /* Clear the host TS bit if it was set above. */ | ||
| 238 | if (cpu->ts && user_has_fpu()) | ||
| 239 | clts(); | ||
| 240 | |||
| 237 | /* | 241 | /* |
| 238 | * If the Guest page faulted, then the cr2 register will tell us the | 242 | * If the Guest page faulted, then the cr2 register will tell us the |
| 239 | * bad virtual address. We have to grab this now, because once we | 243 | * 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) | |||
| 249 | * a different CPU. So all the critical stuff should be done | 253 | * a different CPU. So all the critical stuff should be done |
| 250 | * before this. | 254 | * before this. |
| 251 | */ | 255 | */ |
| 252 | else if (cpu->regs->trapnum == 7) | 256 | else if (cpu->regs->trapnum == 7 && !user_has_fpu()) |
| 253 | math_state_restore(); | 257 | math_state_restore(); |
| 254 | } | 258 | } |
| 255 | 259 | ||
