Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c73e197b authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity
Browse files

KVM: x86 emulator: fix RCX access during rep emulation



During rep emulation access length to RCX depends on current address
mode.

Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent d6d367d6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1852,7 +1852,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)

	if (c->rep_prefix && (c->d & String)) {
		/* All REP prefixes have the same first termination condition */
		if (c->regs[VCPU_REGS_RCX] == 0) {
		if (address_mask(c, c->regs[VCPU_REGS_RCX]) == 0) {
			kvm_rip_write(ctxt->vcpu, c->eip);
			goto done;
		}
@@ -1876,7 +1876,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
				goto done;
			}
		}
		c->regs[VCPU_REGS_RCX]--;
		register_address_increment(c, &c->regs[VCPU_REGS_RCX], -1);
		c->eip = kvm_rip_read(ctxt->vcpu);
	}