qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "poletaev" <Dmitry.Poletaev@ispras.ru>
To: 'Paolo Bonzini' <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: Pavel.Dovgaluk@ispras.ru
Subject: Re: [Qemu-devel] [PATCH] target-i386: fix iret emulation correctness
Date: Tue, 7 Jun 2016 15:07:38 +0300	[thread overview]
Message-ID: <002001d1c0b5$2f5e2e50$8e1a8af0$@Poletaev@ispras.ru> (raw)
In-Reply-To: <85433aee-e2f1-1b29-ca7e-d2056da39a0d@redhat.com>

> Second, an IRET with HF_NMI_MASK set can be translated to _only_ the 
> reset of NMI mask followed by end of basic block.  An IRET without 
> HF_NMI_MASK instead can be translated the same way as now.

I want to make it like this, but it seems to me it can lead to zero tb size
and introduce bad side effect. What I do wrong?

case 0xcf: /* iret */
    gen_svm_check_intercept(s, pc_start, SVM_EXIT_IRET);
    if (!s->pe) {
        /* real mode */
        gen_helper_iret_real(cpu_env, tcg_const_i32(dflag - 1));
        set_cc_op(s, CC_OP_EFLAGS);
    } else if (s->vm86) {
        if (s->iopl != 3) {
            if (s->flags & HF_NMI_MASK) {
                gen_reset_hflag(s, HF_NMI_MASK);
                s->pc = pc_start;
                gen_jmp_im(pc_start - s->cs_base);
            } else {
                gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
            }
        } else {
            gen_helper_iret_real(cpu_env, tcg_const_i32(dflag - 1));
            set_cc_op(s, CC_OP_EFLAGS);
        }
    } else {
        gen_helper_iret_protected(cpu_env, tcg_const_i32(dflag - 1),
                                  tcg_const_i32(s->pc - s->cs_base));
        set_cc_op(s, CC_OP_EFLAGS);
    }
    gen_eob(s);
    break;

Best regards, 
Dmitry Poletaev.

  reply	other threads:[~2016-06-07 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <875.280801165168$1465286930@news.gmane.org>
2016-06-07  8:19 ` [Qemu-devel] [PATCH] target-i386: fix iret emulation correctness Paolo Bonzini
2016-06-07 12:07   ` poletaev [this message]
2016-06-07 12:43     ` Paolo Bonzini
2016-06-07  8:07 poletaev

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='002001d1c0b5$2f5e2e50$8e1a8af0$@Poletaev@ispras.ru' \
    --to=dmitry.poletaev@ispras.ru \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --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).