Skip to content

Commit

Permalink
KVM: Fix kvm_arch_vcpu_ioctl_set_sregs so that set_cr0 works properly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Knowles authored and Avi Kivity committed Mar 3, 2008
1 parent 6b390b6 commit d730616
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d730616

Please sign in to comment.