(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.
This commit is contained in:
Don Howard 2001-04-27 16:06:53 +00:00
parent d1a310e7f4
commit 128437e69f
2 changed files with 29 additions and 21 deletions

View File

@ -1,5 +1,11 @@
2001-04-27 Don Howard <dhoward@redhat.com> 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 * MAINTAINERS (Misc): Added myself to the write-after-approval
list. list.

View File

@ -210,17 +210,19 @@ i387_supply_fxsave (char *fxsave)
int top; int top;
fstat = *(unsigned short *) (FXSAVE_ADDR (fxsave, FSTAT_REGNUM)); fstat = *(unsigned short *) (FXSAVE_ADDR (fxsave, FSTAT_REGNUM));
top = ((fstat >> 11) & 0x111); top = ((fstat >> 11) & 0x7);
for (fpreg = 7; fpreg >= 0; fpreg--) for (fpreg = 7; fpreg >= 0; fpreg--)
{ {
int tag = 0x11; int tag;
if (val & (1 << fpreg)) if (val & (1 << fpreg))
{ {
int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM; int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM;
tag = i387_tag (FXSAVE_ADDR (fxsave, regnum)); tag = i387_tag (FXSAVE_ADDR (fxsave, regnum));
} }
else
tag = 3; /* Empty */
ftag |= tag << (2 * fpreg); ftag |= tag << (2 * fpreg);
} }
@ -275,10 +277,10 @@ i387_fill_fxsave (char *fxsave, int regnum)
for (fpreg = 7; fpreg >= 0; fpreg--) for (fpreg = 7; fpreg >= 0; fpreg--)
{ {
int tag = (ftag >> (fpreg * 2)) & 0x11; int tag = (ftag >> (fpreg * 2)) & 3;
if (tag != 0x11) if (tag != 3)
val |= (1 << fpreg); val |= (1 << (fpreg * 2));
} }
memcpy (FXSAVE_ADDR (fxsave, i), &val, 2); memcpy (FXSAVE_ADDR (fxsave, i), &val, 2);
@ -312,32 +314,32 @@ i387_tag (unsigned char *raw)
if (exponent == 0x7fff) if (exponent == 0x7fff)
{ {
/* Special. */ /* Special. */
return (0x10); return (2);
} }
else if (exponent == 0x0000) else if (exponent == 0x0000)
{
if (integer)
{
/* Valid. */
return (0x00);
}
else
{
/* Special. */
return (0x10);
}
}
else
{ {
if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer) if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer)
{ {
/* Zero. */ /* Zero. */
return (0x01); return (1);
} }
else else
{ {
/* Special. */ /* Special. */
return (0x10); return (2);
}
}
else
{
if (integer)
{
/* Valid. */
return (0);
}
else
{
/* Special. */
return (2);
} }
} }
} }