Revision 8636b5d8 vl.c

b/vl.c
2113 2113
    qemu_put_be16s(f, &fpregs_format);
2114 2114
    
2115 2115
    for(i = 0; i < 8; i++) {
2116
        uint64_t mant;
2117
        uint16_t exp;
2118 2116
#ifdef USE_X86LDOUBLE
2119
        /* we save the real CPU data (in case of MMX usage only 'mant'
2120
           contains the MMX register */
2121
        cpu_get_fp80(&mant, &exp, env->fpregs[i].d);
2122
        qemu_put_be64(f, mant);
2123
        qemu_put_be16(f, exp);
2117
        {
2118
            uint64_t mant;
2119
            uint16_t exp;
2120
            /* we save the real CPU data (in case of MMX usage only 'mant'
2121
               contains the MMX register */
2122
            cpu_get_fp80(&mant, &exp, env->fpregs[i].d);
2123
            qemu_put_be64(f, mant);
2124
            qemu_put_be16(f, exp);
2125
        }
2124 2126
#else
2125 2127
        /* if we use doubles for float emulation, we save the doubles to
2126 2128
           avoid losing information in case of MMX usage. It can give
2127 2129
           problems if the image is restored on a CPU where long
2128 2130
           doubles are used instead. */
2129
        qemu_put_be64(f, env->fpregs[i].xmm.MMX_Q(0));
2131
        qemu_put_be64(f, env->fpregs[i].mmx.MMX_Q(0));
2130 2132
#endif
2131 2133
    }
2132 2134

  
......
2169 2171
#endif
2170 2172
}
2171 2173

  
2174
#ifdef USE_X86LDOUBLE
2172 2175
/* XXX: add that in a FPU generic layer */
2173 2176
union x86_longdouble {
2174 2177
    uint64_t mant;
......
2190 2193
    e |= SIGND1(temp) >> 16;
2191 2194
    p->exp = e;
2192 2195
}
2196
#endif
2193 2197

  
2194 2198
int cpu_load(QEMUFile *f, void *opaque, int version_id)
2195 2199
{
......
2218 2222
    for(i = 0; i < 8; i++) {
2219 2223
        uint64_t mant;
2220 2224
        uint16_t exp;
2221
        union x86_longdouble *p;
2222 2225
        
2223 2226
        switch(fpregs_format) {
2224 2227
        case 0:
......
2229 2232
#else
2230 2233
            /* difficult case */
2231 2234
            if (guess_mmx)
2232
                env->fpregs[i].xmm.MMX_Q(0) = mant;
2235
                env->fpregs[i].mmx.MMX_Q(0) = mant;
2233 2236
            else
2234 2237
                env->fpregs[i].d = cpu_set_fp80(mant, exp);
2235 2238
#endif
......
2237 2240
        case 1:
2238 2241
            mant = qemu_get_be64(f);
2239 2242
#ifdef USE_X86LDOUBLE
2240
            /* difficult case */
2241
            p = (void *)&env->fpregs[i];
2242
            if (guess_mmx) {
2243
                p->mant = mant;
2244
                p->exp = 0xffff;
2245
            } else {
2246
                fp64_to_fp80(p, mant);
2243
            {
2244
                union x86_longdouble *p;
2245
                /* difficult case */
2246
                p = (void *)&env->fpregs[i];
2247
                if (guess_mmx) {
2248
                    p->mant = mant;
2249
                    p->exp = 0xffff;
2250
                } else {
2251
                    fp64_to_fp80(p, mant);
2252
                }
2247 2253
            }
2248 2254
#else
2249
            env->fpregs[i].xmm.MMX_Q(0) = mant;
2255
            env->fpregs[i].mmx.MMX_Q(0) = mant;
2250 2256
#endif            
2251 2257
            break;
2252 2258
        default:

Also available in: Unified diff