* [PATCH] x86 emulator: fix parity calculation for AAD instruction
@ 2013-02-13 15:50 Gleb Natapov
2013-02-13 15:57 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Gleb Natapov @ 2013-02-13 15:50 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, mtosatti
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.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86 emulator: fix parity calculation for AAD instruction
2013-02-13 15:50 [PATCH] x86 emulator: fix parity calculation for AAD instruction Gleb Natapov
@ 2013-02-13 15:57 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2013-02-13 15:57 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kvm, mtosatti
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-13 15:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 15:50 [PATCH] x86 emulator: fix parity calculation for AAD instruction Gleb Natapov
2013-02-13 15:57 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox