]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Wrong flags on CMPS and SCAS emulation
authorNadav Amit <namit@cs.technion.ac.il>
Sun, 2 Nov 2014 09:54:50 +0000 (11:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Nov 2014 14:44:06 +0000 (15:44 +0100)
commit07d8369f28752cb2f77498bdbdf41f9d53b95699
tree439fc7f187b0133df39de4daa73ecb4ff2f68858
parent231cb91f896785318d88bbc35aa43b135be95b88
KVM: x86: Wrong flags on CMPS and SCAS emulation

CMPS and SCAS instructions are evaluated in the wrong order.  For reference (of
CMPS), see http://www.fermimn.gov.it/linux/quarta/x86/cmps.htm : "Note that the
direction of subtraction for CMPS is [SI] - [DI] or [ESI] - [EDI]. The left
operand (SI or ESI) is the source and the right operand (DI or EDI) is the
destination. This is the reverse of the usual Intel convention in which the
left operand is the destination and the right operand is the source."

Introducing em_cmp_r for this matter that performs comparison in reverse order
using fastop infrastructure to avoid a wrapper function.

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