]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: Don't allow lmsw to clear cr0.pe
authorAvi Kivity <avi@redhat.com>
Tue, 11 May 2010 21:28:44 +0000 (00:28 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:23:01 +0000 (11:23 -0700)
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)

arch/x86/kvm/x86.c

index 7635a38fe84d03d206576c5932f40974b84437da..d9680b3c40ef30845db636489f7d23539a7a89ec 100644 (file)
@@ -484,7 +484,7 @@ EXPORT_SYMBOL_GPL(kvm_set_cr0);
 
 void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw)
 {
-       kvm_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~0x0ful) | (msw & 0x0f));
+       kvm_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~0x0eul) | (msw & 0x0f));
 }
 EXPORT_SYMBOL_GPL(kvm_lmsw);