diff options
author | Daniel Jacobowitz <drow@false.org> | 2007-03-30 17:13:02 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2007-03-30 17:13:02 +0000 |
commit | 0c2ead7e1669088ac2092baa43524f1c9f9b5215 (patch) | |
tree | be5ef511f5d95859fef900e0acca345164e9f1e5 | |
parent | f6bee0627d14be4711ad86eb82ab644766c7ef31 (diff) | |
download | gdb-0c2ead7e1669088ac2092baa43524f1c9f9b5215.zip gdb-0c2ead7e1669088ac2092baa43524f1c9f9b5215.tar.gz gdb-0c2ead7e1669088ac2092baa43524f1c9f9b5215.tar.bz2 |
* 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.
-rw-r--r-- | gdb/gdbserver/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/gdbserver/i387-fp.c | 45 |
2 files changed, 32 insertions, 21 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 602dae0..d629cb3 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,13 @@ 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. (i387_fxsave_to_cache): Check fp->ftag while building ftag value. diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c index e0b460f..3abed34 100644 --- a/gdb/gdbserver/i387-fp.c +++ b/gdb/gdbserver/i387-fp.c @@ -32,14 +32,18 @@ int num_xmm_registers = 8; 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]; @@ -53,13 +57,14 @@ struct i387_fxsave { 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]; @@ -88,23 +93,23 @@ i387_cache_to_fsave (void *buf) /* 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 @@ -137,6 +142,7 @@ i387_fsave_to_cache (const void *buf) 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); } @@ -165,11 +171,10 @@ i387_cache_to_fxsave (void *buf) /* 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); @@ -182,15 +187,13 @@ i387_cache_to_fxsave (void *buf) 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 |