public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCH] x86 emulator: fix parity calculation for AAD instruction
Date: Wed, 13 Feb 2013 16:57:51 +0100	[thread overview]
Message-ID: <511BB7FF.8020307@redhat.com> (raw)
In-Reply-To: <20130213155039.GG9817@redhat.com>

Il 13/02/2013 16:50, Gleb Natapov ha scritto:
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 2b11318..a335cc6 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2995,14 +2995,11 @@ static int em_aad(struct x86_emulate_ctxt *ctxt)
>  
>  	ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al;
>  
> -	ctxt->eflags &= ~(X86_EFLAGS_PF | X86_EFLAGS_SF | X86_EFLAGS_ZF);
> -
> -	if (!al)
> -		ctxt->eflags |= X86_EFLAGS_ZF;
> -	if (!(al & 1))
> -		ctxt->eflags |= X86_EFLAGS_PF;
> -	if (al & 0x80)
> -		ctxt->eflags |= X86_EFLAGS_SF;
> +	/* Set PF, ZF, SF */
> +	ctxt->src.type = OP_IMM;
> +	ctxt->src.val = 0;
> +	ctxt->src.bytes = 1;
> +	fastop(ctxt, em_or);
>  
>  	return X86EMUL_CONTINUE;
>  }
> --
> 			Gleb.
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

      reply	other threads:[~2013-02-13 15:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 15:50 [PATCH] x86 emulator: fix parity calculation for AAD instruction Gleb Natapov
2013-02-13 15:57 ` Paolo Bonzini [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=511BB7FF.8020307@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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