public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Mohammed Gamal <m.gamal005@gmail.com>,
	avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] x86 emulator: Add IRET instruction
Date: Wed, 28 Jul 2010 15:49:00 +0200	[thread overview]
Message-ID: <4C50354C.3020407@redhat.com> (raw)
In-Reply-To: <4C5030E2.8050202@redhat.com>

On 07/28/2010 03:30 PM, Paolo Bonzini wrote:
> On 07/28/2010 11:38 AM, Mohammed Gamal wrote:
>> + unsigned long mask = EFLG_CF | EFLG_PF | EFLG_AF | EFLG_ZF | EFLG_SF
>> | EFLG_TF |
>> + EFLG_IF | EFLG_DF | EFLG_OF | EFLG_IOPL | EFLG_NT | EFLG_RF |
>> + EFLG_AC | EFLG_ID | (1 << 1); /* Last one is the reserved bit */
>> + unsigned long vm86_mask = EFLG_VM | EFLG_VIF | EFLG_VIP;
>> ...
>> + if (c->op_bytes == 4)
>> + ctxt->eflags = ((temp_eflags & mask) | (ctxt->eflags & vm86_mask));
>> + else if (c->op_bytes == 2) {
>> + ctxt->eflags &= ~0xffff;
>> + ctxt->eflags |= temp_eflags;
>> + }
>
> I think that's still not it. You can set reserved bits for c->op_bytes
> == 2, and you can clear bit 1 for both 16- and 32-bit IRET.
>
> IOW you need something like this:
>
> mask = ...; /* without (1 << 1); */
> ctxt_mask = (1 << 1) | EFLG_VM | EFLG_VIF | EFLG_VIP;
>
> if (c->op_bytes == 2) {
> mask &= 0xffff;
> ctxt_mask |= ~0xffff;
> }
>
> ctxt->eflags = (temp_eflags & mask) | (ctxt->eflags & ctxt_mask);

Sorry, I replied to v3 of the patch while reviewing v2.

Looks good indeed.

Thanks!

Paolo

  reply	other threads:[~2010-07-28 13:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28  9:38 [PATCH] x86 emulator: Add IRET instruction Mohammed Gamal
2010-07-28 10:30 ` Avi Kivity
2010-07-28 13:30 ` Paolo Bonzini
2010-07-28 13:49   ` Paolo Bonzini [this message]
2010-07-28 17:15 ` Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2010-07-27 23:06 Mohammed Gamal
2010-07-28  4:20 ` Avi Kivity
2010-07-25 19:20 Mohammed Gamal
2010-07-25 23:59 ` Paolo Bonzini
2010-07-26  0:07   ` Mohammed Gamal
2010-07-26  3:09     ` Wei Yongjun
2010-07-26  8:47     ` Paolo Bonzini
2010-07-26  9:00       ` Avi Kivity
2010-07-26  9:31         ` Paolo Bonzini
2010-07-26  9:32         ` Paolo Bonzini
2010-07-26 11:38 ` Avi Kivity
2010-07-25 19:18 Mohammed Gamal

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=4C50354C.3020407@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=m.gamal005@gmail.com \
    --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