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>
 
        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;
                }
                                goto done;
                        }
                }
-               c->regs[VCPU_REGS_RCX]--;
+               register_address_increment(c, &c->regs[VCPU_REGS_RCX], -1);
                c->eip = kvm_rip_read(ctxt->vcpu);
        }