aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorDor Laor <dor.laor@qumranet.com>2007-02-19 09:44:49 -0500
committerAvi Kivity <avi@qumranet.com>2007-05-03 03:52:22 -0400
commit9b22bf578332d3e326c349bc8a8789af3d952435 (patch)
tree90cd7779ad0d17764dbf3bf9ff49f42247cb95bd /drivers/kvm/kvm_main.c
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
KVM: Fix guest register corruption on paravirt hypercall
The hypercall code mixes up the ->cache_regs() and ->decache_regs() callbacks, resulting in guest register corruption. Signed-off-by: Dor Laor <dor.laor@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index dc7a8c78cbf9..ff7c836ff001 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1177,7 +1177,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
1177{ 1177{
1178 unsigned long nr, a0, a1, a2, a3, a4, a5, ret; 1178 unsigned long nr, a0, a1, a2, a3, a4, a5, ret;
1179 1179
1180 kvm_arch_ops->decache_regs(vcpu); 1180 kvm_arch_ops->cache_regs(vcpu);
1181 ret = -KVM_EINVAL; 1181 ret = -KVM_EINVAL;
1182#ifdef CONFIG_X86_64 1182#ifdef CONFIG_X86_64
1183 if (is_long_mode(vcpu)) { 1183 if (is_long_mode(vcpu)) {
@@ -1204,7 +1204,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
1204 ; 1204 ;
1205 } 1205 }
1206 vcpu->regs[VCPU_REGS_RAX] = ret; 1206 vcpu->regs[VCPU_REGS_RAX] = ret;
1207 kvm_arch_ops->cache_regs(vcpu); 1207 kvm_arch_ops->decache_regs(vcpu);
1208 return 1; 1208 return 1;
1209} 1209}
1210EXPORT_SYMBOL_GPL(kvm_hypercall); 1210EXPORT_SYMBOL_GPL(kvm_hypercall);