diff options
author | Gleb Natapov <gleb@redhat.com> | 2013-02-13 10:50:39 -0500 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-02-13 11:01:00 -0500 |
commit | f583c29b7913fa32b0b1b7f43038d6a7d9f71b6f (patch) | |
tree | da7f1f7df5c9465bee2afff734fd3637219317bc /arch/x86/kvm/emulate.c | |
parent | 7a905b1485adf863607b5fc9e32a3fa3838bcc23 (diff) |
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>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2b11318151a4..a335cc6cde72 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) | |||
2995 | 2995 | ||
2996 | ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al; | 2996 | ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al; |
2997 | 2997 | ||
2998 | ctxt->eflags &= ~(X86_EFLAGS_PF | X86_EFLAGS_SF | X86_EFLAGS_ZF); | 2998 | /* Set PF, ZF, SF */ |
2999 | 2999 | ctxt->src.type = OP_IMM; | |
3000 | if (!al) | 3000 | ctxt->src.val = 0; |
3001 | ctxt->eflags |= X86_EFLAGS_ZF; | 3001 | ctxt->src.bytes = 1; |
3002 | if (!(al & 1)) | 3002 | fastop(ctxt, em_or); |
3003 | ctxt->eflags |= X86_EFLAGS_PF; | ||
3004 | if (al & 0x80) | ||
3005 | ctxt->eflags |= X86_EFLAGS_SF; | ||
3006 | 3003 | ||
3007 | return X86EMUL_CONTINUE; | 3004 | return X86EMUL_CONTINUE; |
3008 | } | 3005 | } |