aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-09-05 11:20:38 -0400
committerAvi Kivity <avi@qumranet.com>2007-10-13 04:18:27 -0400
commit81f50e3bfdf864103ef890ca156e7a9c922c7089 (patch)
treec05329c755cdda57966e3c6777bdee5f28d75c1e
parentb85b9ee9259917f248ee1507d7d1f575f4fc27dd (diff)
KVM: Keep control regs in sync
We don't update the vcpu control registers in various places. We should do so. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--drivers/kvm/kvm_main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index d3e534dcf585..7341c0949340 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -543,6 +543,7 @@ void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
543 return; 543 return;
544 } 544 }
545 kvm_arch_ops->set_cr4(vcpu, cr4); 545 kvm_arch_ops->set_cr4(vcpu, cr4);
546 vcpu->cr4 = cr4;
546 mutex_lock(&vcpu->kvm->lock); 547 mutex_lock(&vcpu->kvm->lock);
547 kvm_mmu_reset_context(vcpu); 548 kvm_mmu_reset_context(vcpu);
548 mutex_unlock(&vcpu->kvm->lock); 549 mutex_unlock(&vcpu->kvm->lock);
@@ -1238,10 +1239,8 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
1238 1239
1239int emulate_clts(struct kvm_vcpu *vcpu) 1240int emulate_clts(struct kvm_vcpu *vcpu)
1240{ 1241{
1241 unsigned long cr0; 1242 vcpu->cr0 &= ~X86_CR0_TS;
1242 1243 kvm_arch_ops->set_cr0(vcpu, vcpu->cr0);
1243 cr0 = vcpu->cr0 & ~X86_CR0_TS;
1244 kvm_arch_ops->set_cr0(vcpu, cr0);
1245 return X86EMUL_CONTINUE; 1244 return X86EMUL_CONTINUE;
1246} 1245}
1247 1246
@@ -2226,6 +2225,7 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
2226 kvm_arch_ops->decache_cr4_guest_bits(vcpu); 2225 kvm_arch_ops->decache_cr4_guest_bits(vcpu);
2227 2226
2228 mmu_reset_needed |= vcpu->cr0 != sregs->cr0; 2227 mmu_reset_needed |= vcpu->cr0 != sregs->cr0;
2228 vcpu->cr0 = sregs->cr0;
2229 kvm_arch_ops->set_cr0(vcpu, sregs->cr0); 2229 kvm_arch_ops->set_cr0(vcpu, sregs->cr0);
2230 2230
2231 mmu_reset_needed |= vcpu->cr4 != sregs->cr4; 2231 mmu_reset_needed |= vcpu->cr4 != sregs->cr4;