From patchwork Mon Feb 15 18:41:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jose E. Marchesi" X-Patchwork-Id: 10869 Received: (qmail 121840 invoked by alias); 15 Feb 2016 18:33:49 -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 121830 invoked by uid 89); 15 Feb 2016 18:33:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=BAYES_05, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=asi, ENTRY, retl, storestore X-HELO: userp1040.oracle.com From: "Jose E. Marchesi" To: libc-alpha@sourceware.org Subject: [PATCH] sparc: restore %asi in memcpy_large as mandated by the ABI. Date: Mon, 15 Feb 2016 10:41:37 -0800 Message-Id: <1455561697-21573-1-git-send-email-jose.marchesi@oracle.com> The SPARC ABI (SCD 2.4.1, page 3P-10) mandates that the %asi register, if modified, should be restored to its default value ASI_PRIMARY_NOFAULT, 0x82) before claling anohter function or returning. This patch fixes sysdeps/sparc/sparc64/memcpy.S. Tested in sparcv9-*-* and sparc64-*-* targets in both multi- and not multi-arch configurations. --- ChangeLog | 6 ++++++ sysdeps/sparc/sparc64/memcpy.S | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a2b394e..207b4bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-02-15 Jose E. Marchesi + + * sysdeps/sparc/sparc64/memcpy.S: Restore the %asi register to + ASI_PRIMARY_NOFAULT before returning, as mandated by the SPARC + ABI. + 2016-02-14 Carlos O'Donelll * manual/install.texi: Latest tested is GCC 5.3, texinfo 6.0, gawk diff --git a/sysdeps/sparc/sparc64/memcpy.S b/sysdeps/sparc/sparc64/memcpy.S index 3a286c4..c0da066 100644 --- a/sysdeps/sparc/sparc64/memcpy.S +++ b/sysdeps/sparc/sparc64/memcpy.S @@ -351,6 +351,7 @@ ENTRY(__memcpy_large) stb %g5, [%o0 - 1] /* Store Group */ 207: membar #StoreLoad | #StoreStore /* LSU Group */ wr %g0, FPRS_FEF, %fprs + wr %g0, ASI_PNF, %asi /* LSU Group */ retl mov %g4, %o0 @@ -370,7 +371,8 @@ ENTRY(__memcpy_large) stb %g5, [%o0 - 2] /* Store */ bne,pt %xcc, 2b /* CTI */ stb %o5, [%o0 - 1] /* Store */ -209: retl +209: wr %g0, ASI_PNF, %asi /* LSU Group */ + retl mov %g4, %o0 END(__memcpy_large)