summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-05-12 00:28:44 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2010-07-05 11:16:13 -0700
commitda3013a2591def42c0e293b847435c0890b8010b (patch)
treeb34881eeffb08c46655f264e2587716129c37b80
parentcf050b037d8ab74a1f5a626b2ef62e35cc8288cb (diff)
downloadkernel-crypto-da3013a2591def42c0e293b847435c0890b8010b.tar.gz
kernel-crypto-da3013a2591def42c0e293b847435c0890b8010b.tar.xz
kernel-crypto-da3013a2591def42c0e293b847435c0890b8010b.zip
KVM: Don't allow lmsw to clear cr0.pe
The current lmsw implementation allows the guest to clear cr0.pe, contrary to the manual, which breaks EMM386.EXE. Fix by ORing the old cr0.pe with lmsw's operand. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> (cherry picked from commit f78e917688edbf1f14c318d2e50dc8e7dad20445)
-rw-r--r--arch/x86/kvm/x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c3d8c0c21e7..9950b87edb0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -432,7 +432,7 @@ EXPORT_SYMBOL_GPL(kvm_set_cr0);
void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw)
{
- kvm_set_cr0(vcpu, (vcpu->arch.cr0 & ~0x0ful) | (msw & 0x0f));
+ kvm_set_cr0(vcpu, (vcpu->arch.cr0 & ~0x0eul) | (msw & 0x0f));
}
EXPORT_SYMBOL_GPL(kvm_lmsw);