aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Howard <dhoward@redhat.com>2001-04-27 16:06:53 +0000
committerDon Howard <dhoward@redhat.com>2001-04-27 16:06:53 +0000
commit128437e69fb4dac3d7509b3d3cd8cbf8b2fa94b2 (patch)
tree0dc81498eb22964bc88f384e6bf0bf492c082712
parentd1a310e7f4bcca5efa7baf36f205051b1ae5bfee (diff)
downloadgdb-128437e69fb4dac3d7509b3d3cd8cbf8b2fa94b2.zip
gdb-128437e69fb4dac3d7509b3d3cd8cbf8b2fa94b2.tar.gz
gdb-128437e69fb4dac3d7509b3d3cd8cbf8b2fa94b2.tar.bz2
(Changes from Kevin Buettner, with minor update by Don Howard.)
* i387-nat.c (i387_supply_fxsave, i387_fill_fxsave, i387_tag): Fix typos in which hexadecimal constants were really intended to be binary constants. (i387_tag): Swap logic regarding zero vs non-zero exponents.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/i387-nat.c30
2 files changed, 22 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ff7eb76..a2e304e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2001-04-27 Don Howard <dhoward@redhat.com>
+ (Changes from Kevin Buettner, with minor update by Don Howard.)
+
+ * i387-nat.c (i387_supply_fxsave, i387_fill_fxsave, i387_tag): Fix
+ typos in which hexadecimal constants were really intended to be
+ binary constants.
+ (i387_tag): Swap logic regarding zero vs non-zero exponents.
* MAINTAINERS (Misc): Added myself to the write-after-approval
list.
diff --git a/gdb/i387-nat.c b/gdb/i387-nat.c
index f22b407..5cb1a04 100644
--- a/gdb/i387-nat.c
+++ b/gdb/i387-nat.c
@@ -210,17 +210,19 @@ i387_supply_fxsave (char *fxsave)
int top;
fstat = *(unsigned short *) (FXSAVE_ADDR (fxsave, FSTAT_REGNUM));
- top = ((fstat >> 11) & 0x111);
+ top = ((fstat >> 11) & 0x7);
for (fpreg = 7; fpreg >= 0; fpreg--)
{
- int tag = 0x11;
+ int tag;
if (val & (1 << fpreg))
{
int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM;
tag = i387_tag (FXSAVE_ADDR (fxsave, regnum));
}
+ else
+ tag = 3; /* Empty */
ftag |= tag << (2 * fpreg);
}
@@ -275,10 +277,10 @@ i387_fill_fxsave (char *fxsave, int regnum)
for (fpreg = 7; fpreg >= 0; fpreg--)
{
- int tag = (ftag >> (fpreg * 2)) & 0x11;
+ int tag = (ftag >> (fpreg * 2)) & 3;
- if (tag != 0x11)
- val |= (1 << fpreg);
+ if (tag != 3)
+ val |= (1 << (fpreg * 2));
}
memcpy (FXSAVE_ADDR (fxsave, i), &val, 2);
@@ -312,32 +314,32 @@ i387_tag (unsigned char *raw)
if (exponent == 0x7fff)
{
/* Special. */
- return (0x10);
+ return (2);
}
else if (exponent == 0x0000)
{
- if (integer)
+ if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer)
{
- /* Valid. */
- return (0x00);
+ /* Zero. */
+ return (1);
}
else
{
/* Special. */
- return (0x10);
+ return (2);
}
}
else
{
- if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer)
+ if (integer)
{
- /* Zero. */
- return (0x01);
+ /* Valid. */
+ return (0);
}
else
{
/* Special. */
- return (0x10);
+ return (2);
}
}
}