public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Bruce Rogers <brogers@suse.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86 emulator: emulate RETF imm
Date: Sun, 8 Sep 2013 16:13:49 +0300	[thread overview]
Message-ID: <20130908131349.GI17294@redhat.com> (raw)
In-Reply-To: <1378237329-18630-1-git-send-email-brogers@suse.com>

On Tue, Sep 03, 2013 at 01:42:09PM -0600, Bruce Rogers wrote:
> Opcode CA
> 
> This gets used by a DOS based NetWare guest.
> 
> Signed-off-by: Bruce Rogers <brogers@suse.com>
> ---
>  arch/x86/kvm/emulate.c |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 2bc1e81..aee238a 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2025,6 +2025,26 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
>  	return rc;
>  }
>  
> +static int em_ret_far_imm(struct x86_emulate_ctxt *ctxt)
> +{
> +        int rc;
> +        unsigned long cs;
> +
> +        rc = emulate_pop(ctxt, &ctxt->_eip, ctxt->op_bytes);
> +        if (rc != X86EMUL_CONTINUE)
> +                return rc;
> +        if (ctxt->op_bytes == 4)
> +                ctxt->_eip = (u32)ctxt->_eip;
> +        rc = emulate_pop(ctxt, &cs, ctxt->op_bytes);
> +        if (rc != X86EMUL_CONTINUE)
> +                return rc;
> +        rc = load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS);
> +        if (rc != X86EMUL_CONTINUE)
> +                return rc;
> +        rsp_increment(ctxt, ctxt->src.val);
> +        return X86EMUL_CONTINUE;
> +}
> +
Why not:

static int em_ret_far_imm(struct x86_emulate_ctxt *ctxt)
{
	int rc;
	rc = em_ret_far(struct x86_emulate_ctxt *ctxt);
	if (rc != X86EMUL_CONTINUE)
		return rc;
	rsp_increment(ctxt, ctxt->src.val);
	return X86EMUL_CONTINUE;
}

--
			Gleb.

  parent reply	other threads:[~2013-09-08 13:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 19:42 [PATCH] KVM: x86 emulator: emulate RETF imm Bruce Rogers
2013-09-04  7:50 ` Gleb Natapov
2013-09-08 13:13 ` Gleb Natapov [this message]
2013-09-09 13:09   ` Bruce Rogers
2013-09-09 13:10     ` Gleb Natapov
2013-09-09 13:12       ` Bruce Rogers

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=20130908131349.GI17294@redhat.com \
    --to=gleb@redhat.com \
    --cc=brogers@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@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