diff options
author | Michael Sturm <michael.sturm@intel.com> | 2016-02-03 17:55:20 +0100 |
---|---|---|
committer | Michael Sturm <michael.sturm@intel.com> | 2017-02-17 11:44:03 +0100 |
commit | ff6527bb52e2938b53687a42d1bcda09300e9390 (patch) | |
tree | 1a0753d22b28264928754f17f0f7ae47e6dc9e1e /gdb/gdbserver | |
parent | 1f85ef5042f0e021fb56b1364dddd92177073bf4 (diff) | |
download | gdb-ff6527bb52e2938b53687a42d1bcda09300e9390.zip gdb-ff6527bb52e2938b53687a42d1bcda09300e9390.tar.gz gdb-ff6527bb52e2938b53687a42d1bcda09300e9390.tar.bz2 |
Change xstate_bv handling to use 8 bytes of data.
The size of the state-component bitmap as specified in
Intel(R) 64 and IA-32 Architectures Software Developer's Manual,
Chapter 13.4.2 is 8 bytes.
So far, the data types used for xstate_bv_p (gdb_byte*),
clear_bv (unsigned int) and tdep->xcr0 (uint64_t) were
inconsistent. But, since the xstate components were still
fitting into a single byte, the code still worked
as expected.
However, with the addition of the PKU feature (bit 9),
using one byte for the bitmap will no longer be sufficient.
This patch changes related code to use 64 bit data types
consistently and changes read/write acces of the XSAVE
header in the xsave buffer to use the endianess-aware
functions extract_unsigned_integer and store_unsigned_integer.
This is required to make sure that eventual differences
in endianess between host and target are taken care off.
gdb/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* i387-tdep.c (i387_supply_xsave): Change type
of clear_bv to ULONGEST. Replace gdb_byte *xstate_bv_p
with ULONGEST xstate_bv and use extract_unsigned_integer
and store_unsigned_integer to read/write its value from
the xsave buffer.
(i387_collect_xsave): Replace gdb_byte *xstate_bv_p
with ULONGEST initial_xstate_bv and use
extract_unsigned_integer/store_unsigned_integer to
read/write its value from the xsave buffer.
Change type of clear_bv to ULONGEST.
gdbserver/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* i387-fp.c (i387_cache_to_xsave): Change type of clear_bv to
unsigned long long.
(i387_fxsave_to_cache): Likewise.
Change-Id: I0de254158960b4f7bcbc9fe2fb857034fa1f7ca5
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/i387-fp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c index b9d7754..8267045 100644 --- a/gdb/gdbserver/i387-fp.c +++ b/gdb/gdbserver/i387-fp.c @@ -273,14 +273,14 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) struct i387_xsave *fp = (struct i387_xsave *) buf; int i; unsigned long val, val2; - unsigned int clear_bv; unsigned long long xstate_bv = 0; + unsigned long long clear_bv = 0; char raw[64]; char *p; /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; - /* The supported bits in `xstat_bv' are 1 byte. Clear part in + /* The supported bits in `xstat_bv' are 8 bytes. Clear part in vector registers if its bit in xstat_bv is zero. */ clear_bv = (~fp->xstate_bv) & x86_xcr0; @@ -643,12 +643,12 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) struct i387_fxsave *fxp = (struct i387_fxsave *) buf; int i, top; unsigned long val; - unsigned int clear_bv; + unsigned long long clear_bv; gdb_byte *p; /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; - /* The supported bits in `xstat_bv' are 1 byte. Clear part in + /* The supported bits in `xstat_bv' are 8 bytes. Clear part in vector registers if its bit in xstat_bv is zero. */ clear_bv = (~fp->xstate_bv) & x86_xcr0; |