diff mbox

hppa: fix __O_SYNC to match the kernel

Message ID BLU437-SMTP89A288FA36C212A076A4A1971D0@phx.gbl
State Committed
Headers show

Commit Message

John David Anglin March 7, 2015, 5:13 p.m. UTC
On 2015-02-27, at 1:53 AM, Mike Frysinger wrote:

> On 24 Feb 2015 09:48, John David Anglin wrote:
>> Mike, thanks for sending this change.  Reminds me I should go through 
>> the Debian glibc
>> patches and see what else needs sending.
> 
> this should be an easy one:
> https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1c1d3f4f11b4a911a3b6ffab0aac61d5f8e02873
> 
> if you could provide context, i could shepherd it through.
> -mike


Attached is an updated patch.  It fixes the saving and updating of the floating-point environment
in feholdexcept and fesetenv.  The glibc test "test-fenv" passes with this change.

The patch has been tested with Debian glibc 2.19-15+b1 with no observed regressions.

Regards,
Dave
--
John David Anglin	dave.anglin@bell.net
2015-03-07  John David Anglin  <danglin@gcc.gnu.org>

	* ports/sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Don't modify
	bufptr in asms.
	* ports/sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise.

Comments

Carlos O'Donell March 8, 2015, 7:53 p.m. UTC | #1
On 03/07/2015 12:13 PM, John David Anglin wrote:
> On 2015-02-27, at 1:53 AM, Mike Frysinger wrote:
> 
>> > On 24 Feb 2015 09:48, John David Anglin wrote:
>>> >> Mike, thanks for sending this change.  Reminds me I should go through 
>>> >> the Debian glibc
>>> >> patches and see what else needs sending.
>> > 
>> > this should be an easy one:
>> > https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1c1d3f4f11b4a911a3b6ffab0aac61d5f8e02873
>> > 
>> > if you could provide context, i could shepherd it through.
>> > -mike
> 
> Attached is an updated patch.  It fixes the saving and updating of the floating-point environment
> in feholdexcept and fesetenv.  The glibc test "test-fenv" passes with this change.
> 
> The patch has been tested with Debian glibc 2.19-15+b1 with no observed regressions.

Testing right now.

Will commit if it looks good.

c.
Carlos O'Donell March 11, 2015, 6:29 a.m. UTC | #2
On 03/07/2015 12:13 PM, John David Anglin wrote:
> On 2015-02-27, at 1:53 AM, Mike Frysinger wrote:
> 
>> On 24 Feb 2015 09:48, John David Anglin wrote:
>>> Mike, thanks for sending this change.  Reminds me I should go through 
>>> the Debian glibc
>>> patches and see what else needs sending.
>>
>> this should be an easy one:
>> https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1c1d3f4f11b4a911a3b6ffab0aac61d5f8e02873
>>
>> if you could provide context, i could shepherd it through.
>> -mike
> 
> 
> Attached is an updated patch.  It fixes the saving and updating of the floating-point environment
> in feholdexcept and fesetenv.  The glibc test "test-fenv" passes with this change.
> 
> The patch has been tested with Debian glibc 2.19-15+b1 with no observed regressions.

Applied.

commit fae1aa8d226ce860124efd67ede03004b19b89e2
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Tue Mar 10 23:43:50 2015 -0400

    hppa: Fix feholdexcpt and fesetenv (Bug 18110).
    
    The constraints in the inline assembly in feholdexcept and fesetenv
    are incorrect. The assembly modifies the buffer pointer, but doesn't
    express that in the constraints. The simple fix is to remove the
    modification of the buffer pointer which is no longer required by
    the existing code, and adjust the one constraint that did express
    the modification of bufptr.
    
    The change fixes test-fenv when glibc is compiled with recent gcc.

Cheers,
Carlos.
diff mbox

Patch

Index: glibc-2.19/ports/sysdeps/hppa/fpu/feholdexcpt.c
===================================================================
--- glibc-2.19.orig/ports/sysdeps/hppa/fpu/feholdexcpt.c
+++ glibc-2.19/ports/sysdeps/hppa/fpu/feholdexcpt.c
@@ -29,8 +29,8 @@  feholdexcept (fenv_t *envp)
   /* Store the environment.  */
   bufptr = clear.buf;
   __asm__ (
-	   "fstd,ma %%fr0,8(%1)\n"
-	   : "=m" (clear), "+r" (bufptr) : : "%r0");
+	   "fstd %%fr0,0(%1)\n"
+	   : "=m" (clear) : "r" (bufptr) : "%r0");
   memcpy (envp, &clear.env, sizeof (fenv_t));
 
   /* Clear exception queues */
@@ -40,11 +40,9 @@  feholdexcept (fenv_t *envp)
   /* Now clear all flags  */
   clear.env.__status_word &= ~(FE_ALL_EXCEPT << 27);
 
-  /* Load the new environment. Note: fr0 must load last to enable T-bit
-     Thus we start bufptr at the end and work backwards */
-  bufptr = (unsigned long long *)((unsigned int)(clear.buf) + sizeof(unsigned int)*4);
+  /* Load the new environment. Note: fr0 must load last to enable T-bit.  */
   __asm__ (
-	   "fldd,mb -8(%0),%%fr0\n"
+	   "fldd 0(%0),%%fr0\n"
 	   : : "r" (bufptr), "m" (clear) : "%r0");
 
   return 0;
Index: glibc-2.19/ports/sysdeps/hppa/fpu/fesetenv.c
===================================================================
--- glibc-2.19.orig/ports/sysdeps/hppa/fpu/fesetenv.c
+++ glibc-2.19/ports/sysdeps/hppa/fpu/fesetenv.c
@@ -33,7 +33,7 @@  fesetenv (const fenv_t *envp)
      we want to use from the environment specified by the parameter.  */
   bufptr = temp.buf;
   __asm__ (
-	   "fstd,ma %%fr0,8(%1)\n"
+	   "fstd %%fr0,0(%1)\n"
 	   : "=m" (temp) : "r" (bufptr) : "%r0");
 
   temp.env.__status_word &= ~(FE_ALL_EXCEPT
@@ -54,7 +54,7 @@  fesetenv (const fenv_t *envp)
      we take advantage of that to load in reverse order so fr0
      is loaded last and T-Bit is enabled. */
   __asm__ (
-	   "fldd,mb -8(%1),%%fr0\n"
+	   "fldd 0(%1),%%fr0\n"
 	   : : "m" (temp), "r" (bufptr) : "%r0" );
 
   /* Success.  */