aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-03-15 10:38:29 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:15:47 -0400
commitc73e197bc525e67b71578126b679446f5b88b508 (patch)
treefc0eac94860b101a552228504f3c080110bde32e /arch/x86/kvm/emulate.c
parentd6d367d6783e38634377bc66b62bff3ffd717e5f (diff)
KVM: x86 emulator: fix RCX access during rep emulation
During rep emulation access length to RCX depends on current address mode. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 0b70a364f0f4..4dce80560d26 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1852,7 +1852,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
1852 1852
1853 if (c->rep_prefix && (c->d & String)) { 1853 if (c->rep_prefix && (c->d & String)) {
1854 /* All REP prefixes have the same first termination condition */ 1854 /* All REP prefixes have the same first termination condition */
1855 if (c->regs[VCPU_REGS_RCX] == 0) { 1855 if (address_mask(c, c->regs[VCPU_REGS_RCX]) == 0) {
1856 kvm_rip_write(ctxt->vcpu, c->eip); 1856 kvm_rip_write(ctxt->vcpu, c->eip);
1857 goto done; 1857 goto done;
1858 } 1858 }
@@ -1876,7 +1876,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
1876 goto done; 1876 goto done;
1877 } 1877 }
1878 } 1878 }
1879 c->regs[VCPU_REGS_RCX]--; 1879 register_address_increment(c, &c->regs[VCPU_REGS_RCX], -1);
1880 c->eip = kvm_rip_read(ctxt->vcpu); 1880 c->eip = kvm_rip_read(ctxt->vcpu);
1881 } 1881 }
1882 1882