kern/80617: floating point registers seem not to be saved after thread preemption.

Marc Olzheim marcolz at ilse.net
Wed May 4 16:07:59 PDT 2005


The following reply was made to PR kern/80617; it has been noted by GNATS.

From: Marc Olzheim <marcolz at ilse.net>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/80617: floating point registers seem not to be saved after thread preemption.
Date: Thu, 5 May 2005 00:58:25 +0200

 The following probably fixes it (thanks to the hint das@ provided).
 For FreeBSD 5.4, just ignore the truncf() part, since that file hasn't
 been MFC'd yet.
 
 --- lib/msun/i387/s_ceilf.S	Thu Jan 13 19:58:25 2005
 +++ lib/msun/i387/s_ceilf.S	Thu May  5 00:54:18 2005
 @@ -13,17 +13,17 @@
  	movl	%esp,%ebp
  	subl	$8,%esp
  
 -	fstcw	-12(%ebp)		/* store fpu control word */
 -	movw	-12(%ebp),%dx
 +	fstcw	-4(%ebp)		/* store fpu control word */
 +	movw	-4(%ebp),%dx
  	orw	$0x0800,%dx		/* round towards +oo */
  	andw	$0xfbff,%dx
 -	movw	%dx,-16(%ebp)
 -	fldcw	-16(%ebp)		/* load modfied control word */
 +	movw	%dx,-8(%ebp)
 +	fldcw	-8(%ebp)		/* load modfied control word */
  
  	flds	8(%ebp);		/* round */
  	frndint
  
 -	fldcw	-12(%ebp)		/* restore original control word */
 +	fldcw	-4(%ebp)		/* restore original control word */
  
  	leave
  	ret
 --- lib/msun/i387/s_floorf.S	Thu Jan 13 19:58:25 2005
 +++ lib/msun/i387/s_floorf.S	Thu May  5 00:54:29 2005
 @@ -13,17 +13,17 @@
  	movl	%esp,%ebp
  	subl	$8,%esp
  
 -	fstcw	-12(%ebp)		/* store fpu control word */
 -	movw	-12(%ebp),%dx
 +	fstcw	-4(%ebp)		/* store fpu control word */
 +	movw	-4(%ebp),%dx
  	orw	$0x0400,%dx		/* round towards -oo */
  	andw	$0xf7ff,%dx
 -	movw	%dx,-16(%ebp)
 -	fldcw	-16(%ebp)		/* load modfied control word */
 +	movw	%dx,-8(%ebp)
 +	fldcw	-8(%ebp)		/* load modfied control word */
  
  	flds	8(%ebp);		/* round */
  	frndint
  
 -	fldcw	-12(%ebp)		/* restore original control word */
 +	fldcw	-4(%ebp)		/* restore original control word */
  
  	leave
  	ret
 --- lib/msun/i387/s_truncf.S	Sat Apr 16 23:12:55 2005
 +++ lib/msun/i387/s_truncf.S	Thu May  5 00:54:35 2005
 @@ -11,16 +11,16 @@
  	movl	%esp,%ebp
  	subl	$8,%esp
  
 -	fstcw	-12(%ebp)		/* store fpu control word */
 -	movw	-12(%ebp),%dx
 +	fstcw	-4(%ebp)		/* store fpu control word */
 +	movw	-4(%ebp),%dx
  	orw	$0x0c00,%dx		/* round towards -oo */
 -	movw	%dx,-16(%ebp)
 -	fldcw	-16(%ebp)		/* load modfied control word */
 +	movw	%dx,-8(%ebp)
 +	fldcw	-8(%ebp)		/* load modfied control word */
  
  	flds	8(%ebp)			/* round */
  	frndint
  
 -	fldcw	-12(%ebp)		/* restore original control word */
 +	fldcw	-4(%ebp)		/* restore original control word */
  
  	leave
  	ret


More information about the freebsd-bugs mailing list