]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Emulation of MOV-sreg to memory uses incorrect size
authorNadav Amit <namit@cs.technion.ac.il>
Sun, 2 Nov 2014 09:54:46 +0000 (11:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Nov 2014 14:44:04 +0000 (15:44 +0100)
commitfcdfe76d106f3fb4605bd6cd986dc554d2345ca4
treea0a2290fb8abe5cf8feed46117a2876886bb4702
parent91beb262e790ef429fedba4c24154e94ec58981a
KVM: x86: Emulation of MOV-sreg to memory uses incorrect size

In x86, you can only MOV-sreg to memory with either 16-bits or 64-bits size.
In contrast, KVM may write to 32-bits memory on MOV-sreg. This patch fixes KVM
behavior, and sets the destination operand size to two, if the destination is
memory.

When destination is registers, and the operand size is 32-bits, the high
16-bits in modern CPUs is filled with zero.  This is handled correctly.

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