]> err.no Git - linux-2.6/commitdiff
KVM: Fix kvm_arch_vcpu_ioctl_set_sregs so that set_cr0 works properly
authorPaul Knowles <paul@transitive.com>
Wed, 6 Feb 2008 11:02:35 +0000 (11:02 +0000)
committerAvi Kivity <avi@qumranet.com>
Mon, 3 Mar 2008 09:22:14 +0000 (11:22 +0200)
Whilst working on getting a VM to initialize in to IA32e mode I found
this issue. set_cr0 relies on comparing the old cr0 to the new one to
work correctly.  Move the assignment below so the compare can work.

Signed-off-by: Paul Knowles <paul@transitive.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/x86.c

index cf530814868957a9de8058849538405ca493dcc5..ec60409299a3d6c115f04f81569cd84406ad33c1 100644 (file)
@@ -2861,8 +2861,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
        kvm_x86_ops->decache_cr4_guest_bits(vcpu);
 
        mmu_reset_needed |= vcpu->arch.cr0 != sregs->cr0;
-       vcpu->arch.cr0 = sregs->cr0;
        kvm_x86_ops->set_cr0(vcpu, sregs->cr0);
+       vcpu->arch.cr0 = sregs->cr0;
 
        mmu_reset_needed |= vcpu->arch.cr4 != sregs->cr4;
        kvm_x86_ops->set_cr4(vcpu, sregs->cr4);