All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Wei Yongjun <yjwei@cn.fujitsu.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCHv2] KVM: x86 emulator: fix pusha instruction emulation
Date: Tue, 15 Jun 2010 14:00:20 +0300	[thread overview]
Message-ID: <4C175D44.9090104@redhat.com> (raw)
In-Reply-To: <4C16D165.8020406@cn.fujitsu.com>

On 06/15/2010 04:03 AM, Wei Yongjun wrote:
> emulate pusha instruction only writeback the last
> EDI register, but the other registers which need
> to be writeback is ignored. This patch fixed it.
>
>   

Ouch.

>  
> -static void emulate_pusha(struct x86_emulate_ctxt *ctxt,
> +static int emulate_pusha(struct x86_emulate_ctxt *ctxt,
>  			  struct x86_emulate_ops *ops)
>  {
>  	struct decode_cache *c = &ctxt->decode;
>  	unsigned long old_esp = c->regs[VCPU_REGS_RSP];
> +	int rc = X86EMUL_CONTINUE;
>  	int reg = VCPU_REGS_RAX;
>  
>  	while (reg <= VCPU_REGS_RDI) {
> @@ -1663,8 +1722,18 @@ static void emulate_pusha(struct x86_emulate_ctxt *ctxt,
>  		(c->src.val = old_esp) : (c->src.val = c->regs[reg]);
>  
>  		emulate_push(ctxt, ops);
> +
> +		rc = writeback(ctxt, ops);
> +		if (rc != X86EMUL_CONTINUE)
> +			return rc;
> +
>   

We might have partial completion if we fault on the one the second or
later register. Still, it's an improvement over what we have now.

>  		++reg;
>  	}
> +
> +	/* Disable writeback. */
> +	c->dst.type = OP_NONE;
> +
> +	return rc;
>  }
>  
>   

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2010-06-15 11:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  1:00 [PATCH] KVM: x86 emulator: fix pusha instruction emulation Wei Yongjun
2010-06-15  1:03 ` [PATCHv2] " Wei Yongjun
2010-06-15  2:10   ` [PATCH] test: add test for pusha and popa instructions Wei Yongjun
2010-06-20  8:29     ` Avi Kivity
2010-06-21  2:48       ` Wei Yongjun
2010-06-21 13:15         ` Avi Kivity
2010-06-15 11:00   ` Avi Kivity [this message]
2010-06-16 14:09 ` [PATCH] KVM: x86 emulator: fix pusha instruction emulation Marcelo Tosatti
2010-06-17  9:33   ` [PATCH] KVM: x86 emulator: fix group3 instruction decoding Wei Yongjun
2010-06-17 12:00     ` Avi Kivity
2010-06-18  0:51       ` Wei Yongjun
2010-06-20  8:24         ` Avi Kivity

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=4C175D44.9090104@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=yjwei@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.