From patchwork Sat Mar 7 17:13:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 5519 Received: (qmail 65346 invoked by alias); 7 Mar 2015 17:13:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 65318 invoked by uid 89); 7 Mar 2015 17:13:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: BLU004-OMC1S2.hotmail.com X-TMN: [Zpvpc3v3FUYuJ3n0xUm0yNX+/3ta6XJo] Message-ID: Subject: Re: [PATCH] hppa: fix __O_SYNC to match the kernel MIME-Version: 1.0 (Apple Message framework v1085) From: John David Anglin In-Reply-To: <20150227065339.GO29461@vapier> Date: Sat, 7 Mar 2015 12:13:08 -0500 CC: libc-alpha@sourceware.org, carlos@systemhalted.org References: <1424755185-27627-1-git-send-email-vapier@gentoo.org> <20150227065339.GO29461@vapier> To: Mike Frysinger 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 * ports/sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Don't modify bufptr in asms. * ports/sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise. 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. */