This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] sparc: restore %asi in memcpy_large as mandated by the ABI.
- From: "Jose E. Marchesi" <jose dot marchesi at oracle dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 15 Feb 2016 10:41:37 -0800
- Subject: [PATCH] sparc: restore %asi in memcpy_large as mandated by the ABI.
- Authentication-results: sourceware.org; auth=none
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 <jose.marchesi@oracle.com>
+
+ * 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 <carlos@redhat.com>
* 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)
--
2.3.4