+2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * i387-fp.c (struct i387_fsave, struct i387_fxsave): Make 16-bit
+ fields short instead of int. Add explicit padding.
+ (i387_cache_to_fsave): Remove unnecessary casts.
+ (i387_fsave_to_cache): Doc fix.
+ (i387_cache_to_fxsave): Remove unnecessary casts and masking.
+
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
* i387-fp.c (i387_cache_to_fxsave): Reinitialize val2 before use.
struct i387_fsave {
/* All these are only sixteen bits, plus padding, except for fop (which
is only eleven bits), and fooff / fioff (which are 32 bits each). */
- unsigned int fctrl;
- unsigned int fstat;
- unsigned int ftag;
+ unsigned short fctrl;
+ unsigned short pad1;
+ unsigned short fstat;
+ unsigned short pad2;
+ unsigned short ftag;
+ unsigned short pad3;
unsigned int fioff;
unsigned short fiseg;
unsigned short fop;
unsigned int fooff;
- unsigned int foseg;
+ unsigned short foseg;
+ unsigned short pad4;
/* Space for eight 80-bit FP values. */
unsigned char st_space[80];
unsigned short ftag;
unsigned short fop;
unsigned int fioff;
- unsigned int fiseg;
+ unsigned short fiseg;
+ unsigned short pad1;
unsigned int fooff;
- unsigned int foseg;
+ unsigned short foseg;
+ unsigned short pad12;
unsigned int mxcsr;
-
- unsigned int _pad1;
+ unsigned int pad3;
/* Space for eight 80-bit FP values in 128-bit spaces. */
unsigned char st_space[128];
/* Some registers are 16-bit. */
collect_register_by_name ("fctrl", &val);
- *(unsigned short *) &fp->fctrl = val;
+ fp->fctrl = val;
collect_register_by_name ("fstat", &val);
val &= 0xFFFF;
- *(unsigned short *) &fp->fstat = val;
+ fp->fstat = val;
collect_register_by_name ("ftag", &val);
val &= 0xFFFF;
- *(unsigned short *) &fp->ftag = val;
+ fp->ftag = val;
collect_register_by_name ("fiseg", &val);
val &= 0xFFFF;
- *(unsigned short *) &fp->fiseg = val;
+ fp->fiseg = val;
collect_register_by_name ("foseg", &val);
val &= 0xFFFF;
- *(unsigned short *) &fp->foseg = val;
+ fp->foseg = val;
}
void
val = fp->foseg & 0xFFFF;
supply_register_by_name ("foseg", &val);
+ /* fop has only 11 valid bits. */
val = (fp->fop) & 0x7FF;
supply_register_by_name ("fop", &val);
}
/* Some registers are 16-bit. */
collect_register_by_name ("fctrl", &val);
- *(unsigned short *) &fp->fctrl = val;
+ fp->fctrl = val;
collect_register_by_name ("fstat", &val);
- val &= 0xFFFF;
- *(unsigned short *) &fp->fstat = val;
+ fp->fstat = val;
/* Convert to the simplifed tag form stored in fxsave data. */
collect_register_by_name ("ftag", &val);
if (tag != 3)
val2 |= (1 << i);
}
- *(unsigned short *) &fp->ftag = val2;
+ fp->ftag = val2;
collect_register_by_name ("fiseg", &val);
- val &= 0xFFFF;
- *(unsigned short *) &fp->fiseg = val;
+ fp->fiseg = val;
collect_register_by_name ("foseg", &val);
- val &= 0xFFFF;
- *(unsigned short *) &fp->foseg = val;
+ fp->foseg = val;
}
static int