Re: [PATCH 2/3] KVM: x86 emulator: move string instruction completion check into separate function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 On 08/24/2010 04:20 PM, Gleb Natapov wrote:

+{
+	struct decode_cache *c =&ctxt->decode;
+
+	/* All REP prefixes have the same first termination condition */
+	if (address_mask(c, c->regs[VCPU_REGS_RCX]) == 0)
+		return true;
This is checked during the beginning of the instruction, not after
completion.  Why is it here?  it will just be duplicated.

SDM describes REP instruction algorithm this way:

WHILE CountReg ≠ 0
   DO
        Service pending interrupts (if any);
        Execute associated string instruction;
        CountReg ← (CountReg – 1);
        IF CountReg = 0
             THEN exit WHILE loop; FI;
        IF (Repeat prefix is REPZ or REPE) and (ZF = 0)
        or (Repeat prefix is REPNZ or REPNE) and (ZF = 1)
             THEN exit WHILE loop; FI;
   OD;

So CountReg is checked at the beginning and after each iteration.

The second check is meaningless (and ZF checks should be qualified with the actual instruction).

Practically it will save us one return to a guest and exit back
to emulator at the end of rep instruction (not a big deal).

Not even that - if we reenter to the beginning of the rep instruction the cpu will skip over it without exiting (unless in big real mode with eigs=1).

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux