summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2013-02-13 17:50:39 +0200
committerGleb Natapov <gleb@redhat.com>2013-02-13 18:01:00 +0200
commitf583c29b7913fa32b0b1b7f43038d6a7d9f71b6f (patch)
treeda7f1f7df5c9465bee2afff734fd3637219317bc
parent7a905b1485adf863607b5fc9e32a3fa3838bcc23 (diff)
downloadop-kernel-dev-f583c29b7913fa32b0b1b7f43038d6a7d9f71b6f.zip
op-kernel-dev-f583c29b7913fa32b0b1b7f43038d6a7d9f71b6f.tar.gz
x86 emulator: fix parity calculation for AAD instruction
Reported-by: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c13
1 files changed, 5 insertions, 8 deletions
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;
}
OpenPOWER on IntegriCloud