qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] restoring eflags after iret on x86
Date: Mon, 8 Sep 2008 20:22:14 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0809082020470.2175@linmac.oyster.ru> (raw)
In-Reply-To: <3FFB085A6AADE34F9311B30A16D0B27EC05CDB@azsmsx422.amr.corp.intel.com>

On Sun, 7 Sep 2008, Cohn, Robert S wrote:

> I am working with 0.9.1 sources and have seen a problem with restoring
> eflags during an iret.
>
> helper_ret_protected Does this:
>    if (is_iret) {
>        /* NOTE: 'cpl' is the _old_ CPL */
>        eflags_mask = TF_MASK | AC_MASK | ID_MASK | RF_MASK | NT_MASK;
>        if (cpl == 0)
>            eflags_mask |= IOPL_MASK;
>        iopl = (env->eflags >> IOPL_SHIFT) & 3;
>        if (cpl <= iopl)
>            eflags_mask |= IF_MASK;
>        if (shift == 0)
>            eflags_mask &= 0xffff;
>        load_eflags(new_eflags, eflags_mask);
>  }
>
> My understanding is that it also needs to do:
> env->cc_op = CC_OP_EFLAGS
>
> Or else it will continue to use the old value of cc_op, which will not
> be consistent with the value that was just stored into cc_src.
>
> I looked at the trunk on svn and it appears to have the same problem. It
> is strange that iret is broken in this way and no one else is seeing the
> problem. Am I missing something?

Yes you do. Look at target-i386/translate.c after emiting the tcg
helper call to iret helper it sets s->cc_op to CC_OP_EFLAGS and
calls gen_eob which propgates this to env cc_op.

-- 
mailto:av1474@comtv.ru

      reply	other threads:[~2008-09-08 16:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-07 14:02 [Qemu-devel] restoring eflags after iret on x86 Cohn, Robert S
2008-09-08 16:22 ` malc [this message]

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=Pine.LNX.4.64.0809082020470.2175@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).