summaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-09-29 22:48:52 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:40 -0500
commitcdc0c58fa9d86559f6811426eee16b0464dfcd93 (patch)
tree18a3e42ac28bb8718c74af682d6a2a587c48bf65 /target-i386
parent67b8f419575b9e4521f0fa59b7a0faee401502ca (diff)
x86: add fptag_vmstate to the state
It is needed to store fptags Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.h1
-rw-r--r--target-i386/machine.c18
2 files changed, 10 insertions, 9 deletions
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 685b828297..8d858d14c0 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -595,6 +595,7 @@ typedef struct CPUX86State {
unsigned int fpstt; /* top of stack index */
uint16_t fpus;
uint16_t fpus_vmstate;
+ uint16_t fptag_vmstate;
uint16_t fpuc;
uint8_t fptags[8]; /* 0 = valid, 1 = empty */
union {
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 4584de90f6..635807b04c 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -26,7 +26,7 @@ static void cpu_get_seg(QEMUFile *f, SegmentCache *dt)
void cpu_save(QEMUFile *f, void *opaque)
{
CPUState *env = opaque;
- uint16_t fptag, fpregs_format;
+ uint16_t fpregs_format;
int32_t pending_irq;
int i, bit;
@@ -40,14 +40,14 @@ void cpu_save(QEMUFile *f, void *opaque)
/* FPU */
env->fpus_vmstate = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
- fptag = 0;
+ env->fptag_vmstate = 0;
for(i = 0; i < 8; i++) {
- fptag |= ((!env->fptags[i]) << i);
+ env->fptag_vmstate |= ((!env->fptags[i]) << i);
}
qemu_put_be16s(f, &env->fpuc);
qemu_put_be16s(f, &env->fpus_vmstate);
- qemu_put_be16s(f, &fptag);
+ qemu_put_be16s(f, &env->fptag_vmstate);
#ifdef USE_X86LDOUBLE
fpregs_format = 0;
@@ -197,7 +197,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
{
CPUState *env = opaque;
int i, guess_mmx;
- uint16_t fptag, fpregs_format;
+ uint16_t fpregs_format;
int32_t pending_irq;
cpu_synchronize_state(env);
@@ -211,13 +211,13 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_be16s(f, &env->fpuc);
qemu_get_be16s(f, &env->fpus_vmstate);
- qemu_get_be16s(f, &fptag);
+ qemu_get_be16s(f, &env->fptag_vmstate);
qemu_get_be16s(f, &fpregs_format);
/* NOTE: we cannot always restore the FPU state if the image come
from a host with a different 'USE_X86LDOUBLE' define. We guess
if we are in an MMX state to restore correctly in that case. */
- guess_mmx = ((fptag == 0xff) && (env->fpus_vmstate & 0x3800) == 0);
+ guess_mmx = ((env->fptag_vmstate == 0xff) && (env->fpus_vmstate & 0x3800) == 0);
for(i = 0; i < 8; i++) {
uint64_t mant;
uint16_t exp;
@@ -262,9 +262,9 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
/* XXX: restore FPU round state */
env->fpstt = (env->fpus_vmstate >> 11) & 7;
env->fpus = env->fpus_vmstate & ~0x3800;
- fptag ^= 0xff;
+ env->fptag_vmstate ^= 0xff;
for(i = 0; i < 8; i++) {
- env->fptags[i] = (fptag >> i) & 1;
+ env->fptags[i] = (env->fptag_vmstate >> i) & 1;
}
for(i = 0; i < 6; i++)