From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 2/3] KVM: x86 emulator: move string instruction completion check into separate function
Date: Tue, 24 Aug 2010 16:24:16 +0300 [thread overview]
Message-ID: <4C73C800.3050808@redhat.com> (raw)
In-Reply-To: <20100824132033.GB10499@redhat.com>
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
next prev parent reply other threads:[~2010-08-24 13:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 11:30 [PATCH 1/3] KVM: x86 emulator: Rename variable that shadows another local variable Gleb Natapov
2010-08-24 11:30 ` [PATCH 2/3] KVM: x86 emulator: move string instruction completion check into separate function Gleb Natapov
2010-08-24 13:11 ` Avi Kivity
2010-08-24 13:20 ` Gleb Natapov
2010-08-24 13:24 ` Avi Kivity [this message]
2010-08-24 11:30 ` [PATCH 3/3] KVM: x86 emulator: get rid of "restart" in emulation context Gleb Natapov
2010-08-24 13:13 ` Avi Kivity
2010-08-24 13:37 ` Gleb Natapov
2010-08-24 13:41 ` Avi Kivity
2010-08-24 13:52 ` Gleb Natapov
2010-08-24 14:01 ` Avi Kivity
2010-08-24 14:06 ` Gleb Natapov
2010-08-24 14:28 ` Avi Kivity
2010-08-24 14:46 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C73C800.3050808@redhat.com \
--to=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox