aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-01-28 12:58:00 +0000
committerPedro Alves <palves@redhat.com>2011-01-28 12:58:00 +0000
commit85724a0e6091239d4c901a03659d5b7e8946c5c6 (patch)
treea30b8d6156b02199073b6bc5ae52273b170ab90f
parent0fda7d1689464292c8f137d6a2cb23a190582634 (diff)
downloadgdb-85724a0e6091239d4c901a03659d5b7e8946c5c6.zip
gdb-85724a0e6091239d4c901a03659d5b7e8946c5c6.tar.gz
gdb-85724a0e6091239d4c901a03659d5b7e8946c5c6.tar.bz2
2011-01-28 Pedro Alves <pedro@codesourcery.com>
* i387-fp.c (i387_xsave_to_cache): Make passing NULL as register buffer explicit.
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/i387-fp.c54
2 files changed, 32 insertions, 27 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 9ebf150..39eb4e7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-28 Pedro Alves <pedro@codesourcery.com>
+
+ * i387-fp.c (i387_xsave_to_cache): Make passing NULL as register
+ buffer explicit.
+
2011-01-25 Pedro Alves <pedro@codesourcery.com>
* server.h (decode_xfer_write): Change prototype.
diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c
index 75531d0..3dfe06b 100644
--- a/gdb/gdbserver/i387-fp.c
+++ b/gdb/gdbserver/i387-fp.c
@@ -468,61 +468,61 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int i, top;
unsigned long val;
unsigned int clear_bv;
- char *p;
+ gdb_byte *p;
/* The supported bits in `xstat_bv' are 1 byte. Clear part in
vector registers if its bit in xstat_bv is zero. */
clear_bv = (~fp->xstate_bv) & x86_xcr0;
/* Check if any x87 registers are changed. */
- if ((x86_xcr0 & I386_XSTATE_X87))
+ if ((x86_xcr0 & I386_XSTATE_X87) != 0)
{
int st0_regnum = find_regno ("st0");
- if ((clear_bv & I386_XSTATE_X87))
- p = NULL;
+ if ((clear_bv & I386_XSTATE_X87) != 0)
+ {
+ for (i = 0; i < 8; i++)
+ supply_register (regcache, i + st0_regnum, NULL);
+ }
else
- p = (char *) buf;
-
- for (i = 0; i < 8; i++)
{
- if (p)
- p = ((char *) &fp->st_space[0]) + i * 16;
- supply_register (regcache, i + st0_regnum, p);
+ p = (gdb_byte *) &fp->st_space[0];
+ for (i = 0; i < 8; i++)
+ supply_register (regcache, i + st0_regnum, p + i * 16);
}
}
- if ((x86_xcr0 & I386_XSTATE_SSE))
+ if ((x86_xcr0 & I386_XSTATE_SSE) != 0)
{
int xmm0_regnum = find_regno ("xmm0");
if ((clear_bv & I386_XSTATE_SSE))
- p = NULL;
+ {
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register (regcache, i + xmm0_regnum, NULL);
+ }
else
- p = (char *) buf;
-
- for (i = 0; i < num_xmm_registers; i++)
{
- if (p)
- p = ((char *) &fp->xmm_space[0]) + i * 16;
- supply_register (regcache, i + xmm0_regnum, p);
+ p = (gdb_byte *) &fp->xmm_space[0];
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register (regcache, i + xmm0_regnum, p + i * 16);
}
}
- if ((x86_xcr0 & I386_XSTATE_AVX))
+ if ((x86_xcr0 & I386_XSTATE_AVX) != 0)
{
int ymm0h_regnum = find_regno ("ymm0h");
- if ((clear_bv & I386_XSTATE_AVX))
- p = NULL;
+ if ((clear_bv & I386_XSTATE_AVX) != 0)
+ {
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register (regcache, i + ymm0h_regnum, NULL);
+ }
else
- p = (char *) buf;
-
- for (i = 0; i < num_xmm_registers; i++)
{
- if (p)
- p = ((char *) &fp->ymmh_space[0]) + i * 16;
- supply_register (regcache, i + ymm0h_regnum, p);
+ p = (gdb_byte *) &fp->ymmh_space[0];
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register (regcache, i + ymm0h_regnum, p + i * 16);
}
}