]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86 emulator: use stack size attribute to mask rsp in stack ops
authorAvi Kivity <avi@redhat.com>
Sun, 19 Aug 2012 11:34:31 +0000 (14:34 +0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 22 Aug 2012 21:54:26 +0000 (18:54 -0300)
commit7d1a2d402c4d5d096b9565f0fc6e2372f2494392
tree4cae79db5826d07b07ed815c5d763fa095cae3f2
parent5505ad2a21eb71f75a538bef1154ad6c5603b1ef
KVM: x86 emulator: use stack size attribute to mask rsp in stack ops

The sub-register used to access the stack (sp, esp, or rsp) is not
determined by the address size attribute like other memory references,
but by the stack segment's B bit (if not in x86_64 mode).

Fix by using the existing stack_mask() to figure out the correct mask.

This long-existing bug was exposed by a combination of 656f43f35f4e2ea
(emulate invalid guest state by default), which causes many more
instructions to be emulated, and a seabios change (possibly a bug) which
causes the high 16 bits of esp to become polluted across calls to real
mode software interrupts.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/emulate.c