]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Wrong emulation on 'xadd X, X'
authorNadav Amit <namit@cs.technion.ac.il>
Sun, 15 Jun 2014 13:12:58 +0000 (16:12 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 19 Jun 2014 10:52:09 +0000 (12:52 +0200)
commit6ea1f784ed320628189a1646c8123704a8ff396a
tree693f75789abbef0339db3cf7a114b963cadae5a0
parent0f581eb746c3dc8f8d0dd48e3c53860d88742417
KVM: x86: Wrong emulation on 'xadd X, X'

The emulator does not emulate the xadd instruction correctly if the two
operands are the same.  In this (unlikely) situation the result should be the
sum of X and X (2X) when it is currently X.  The solution is to first perform
writeback to the source, before writing to the destination.  The only
instruction which should be affected is xadd, as the other instructions that
perform writeback to the source use the extended accumlator (e.g., RAX:RDX).

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c