Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH RFA] Fix x86 floating point vs. thread problem
@ 2001-12-06 15:48 Kevin Buettner
  2001-12-06 16:00 ` Daniel Jacobowitz
  2001-12-12 12:25 ` Mark Kettenis
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Buettner @ 2001-12-06 15:48 UTC (permalink / raw)
  To: gdb-patches

The patch below fixes the problem reported by David Relson in

    http://sources.redhat.com/ml/gdb/2001-12/msg00001.html

An impressive test matrix regarding this bug has been provided by
Emmanuel Blindauer at

    http://manu.agat.net/bug.html

Anyway, the problem is that GDB is computing the fpxregs version of
the tag value incorrectly.  The fpxregs version of the tag value is
simply a bitmask (of eight bits) which indicate which of the floating
point registers is in use.  i387_fill_fxsave() was incorrectly
shifting by twice the the number of bits that it should have.

	* i387-nat.c (i387_fill_fxsave): Change type of ``val'' from char
	to short so that we don't memcpy() beyond the end of this buffer.
	Also, change shift value used in computing val to account for the
	fact that only eight bits are used.

Index: i387-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-nat.c,v
retrieving revision 1.7
diff -u -p -r1.7 i387-nat.c
--- i387-nat.c	2001/11/12 22:27:35	1.7
+++ i387-nat.c	2001/12/06 23:19:05
@@ -270,7 +270,7 @@ i387_fill_fxsave (char *fxsave, int regn
 	      {
 		/* Converting back is much easier.  */
 
-		unsigned char val = 0;
+		unsigned short val = 0;
 		unsigned short ftag;
 		int fpreg;
 
@@ -281,7 +281,7 @@ i387_fill_fxsave (char *fxsave, int regn
 		    int tag = (ftag >> (fpreg * 2)) & 3;
 
 		    if (tag != 3)
-		      val |= (1 << (fpreg * 2));
+		      val |= (1 << fpreg);
 		  }
 
 		memcpy (FXSAVE_ADDR (fxsave, i), &val, 2);


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-12-19  0:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-06 15:48 [PATCH RFA] Fix x86 floating point vs. thread problem Kevin Buettner
2001-12-06 16:00 ` Daniel Jacobowitz
2001-12-06 16:27   ` Kevin Buettner
2001-12-12 12:25 ` Mark Kettenis
2001-12-13  9:38   ` Kevin Buettner
2001-12-13 15:48     ` Mark Kettenis
     [not found]       ` <kettenis@science.uva.nl>
2001-12-18 16:22         ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox