kvm: x86: Save/restore FPU OP, IP and DP
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 15 Jun 2011 13:17:26 +0000 (15:17 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 19 Jun 2011 12:57:56 +0000 (15:57 +0300)
commit42cc8fa620cbc73e349e96d84cf46469e828ec34
treee17f4c3bd50bed2edb0791b6b8fc4faa18658f9c
parenteb47d7c5d96060040931c42773ee07e61e547af9
kvm: x86: Save/restore FPU OP, IP and DP

These FPU states are properly maintained by KVM but not yet by TCG. So
far we unconditionally set them to 0 in the guest which may cause
state corruptions, though not with modern guests.

To avoid breaking backward migration, use a conditional subsection that
is only written if any of the three fields is non-zero. The guest's
FNINIT clears them frequently, and cleared IA32_MISC_ENABLE MSR[2]
reduces the probability of non-zero values further so that this
subsection is not expected to restrict migration in any common scenario.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
target-i386/cpu.h
target-i386/kvm.c
target-i386/machine.c