Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc Improve EABI handling of string functions. M...



details:   https://anonhg.NetBSD.org/src/rev/89225ff57797
branches:  trunk
changeset: 325065:89225ff57797
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Dec 02 21:21:33 2013 +0000

description:
Improve EABI handling of string functions. Most importantly, fix
__aeabi_memset, which has the arguments in the wrong order.

diffstat:

 common/lib/libc/arch/arm/string/memcmp.S     |   8 ++++++--
 common/lib/libc/arch/arm/string/memcpy.S     |   6 +++++-
 common/lib/libc/arch/arm/string/memcpy_arm.S |   6 +-----
 common/lib/libc/arch/arm/string/memmove.S    |   4 +++-
 common/lib/libc/arch/arm/string/memset.S     |  21 ++++++++++++++++++---
 common/lib/libc/string/memcmp.c              |   8 ++++++--
 common/lib/libc/string/memcpy.c              |   6 +++++-
 common/lib/libc/string/memmove.c             |   8 +++++++-
 common/lib/libc/string/memset.c              |  24 ++++++++++++++++++++++--
 9 files changed, 73 insertions(+), 18 deletions(-)

diffs (213 lines):

diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/arch/arm/string/memcmp.S
--- a/common/lib/libc/arch/arm/string/memcmp.S  Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memcmp.S  Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: memcmp.S,v 1.3 2013/08/19 06:23:59 matt Exp $ */
+/*      $NetBSD: memcmp.S,v 1.4 2013/12/02 21:21:33 joerg Exp $ */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -64,7 +64,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: memcmp.S,v 1.3 2013/08/19 06:23:59 matt Exp $")
+RCSID("$NetBSD: memcmp.S,v 1.4 2013/12/02 21:21:33 joerg Exp $")
 
 ENTRY(memcmp)
        mov     ip, r0
@@ -179,3 +179,7 @@
        RET
 #endif
 END(memcmp)
+
+#if defined(__ARM_EABI__)
+STRONG_ALIAS(__aeabi_memcmp, memcmp)
+#endif
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/arch/arm/string/memcpy.S
--- a/common/lib/libc/arch/arm/string/memcpy.S  Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memcpy.S  Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memcpy.S,v 1.5 2013/08/20 07:25:52 matt Exp $  */
+/*     $NetBSD: memcpy.S,v 1.6 2013/12/02 21:21:33 joerg Exp $ */
 
 #include <arm/cdefs.h>
 
@@ -7,3 +7,7 @@
 #else
 #include "memcpy_xscale.S"
 #endif
+
+#if defined(__ARM_EABI__)
+STRONG_ALIAS(__aeabi_memcpy, memcpy)
+#endif
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/arch/arm/string/memcpy_arm.S
--- a/common/lib/libc/arch/arm/string/memcpy_arm.S      Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memcpy_arm.S      Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memcpy_arm.S,v 1.4 2013/08/11 04:56:32 matt Exp $      */
+/*     $NetBSD: memcpy_arm.S,v 1.5 2013/12/02 21:21:33 joerg Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,10 +31,6 @@
 
 #include <machine/asm.h>
 
-#if defined(__ARM_EABI__)
-STRONG_ALIAS(__aeabi_memcpy, memcpy)
-#endif
-
 /*
  * This is one fun bit of code ...
  * Some easy listening music is suggested while trying to understand this
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/arch/arm/string/memmove.S
--- a/common/lib/libc/arch/arm/string/memmove.S Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memmove.S Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memmove.S,v 1.7 2013/11/30 20:20:42 joerg Exp $        */
+/*     $NetBSD: memmove.S,v 1.8 2013/12/02 21:21:33 joerg Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -587,4 +587,6 @@
 
 #if defined(__ARM_EABI__) && !defined(BCOPY)
 STRONG_ALIAS(__aeabi_memmove, memmove)
+STRONG_ALIAS(__aeabi_memmove4, memmove)
+STRONG_ALIAS(__aeabi_memmove8, memmove)
 #endif
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/arch/arm/string/memset.S
--- a/common/lib/libc/arch/arm/string/memset.S  Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memset.S  Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memset.S,v 1.6 2013/11/30 21:09:11 joerg Exp $ */
+/*     $NetBSD: memset.S,v 1.7 2013/12/02 21:21:33 joerg Exp $ */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -68,8 +68,23 @@
 
 #include <machine/asm.h>
 
-#if defined(__ARM_EABI__) && !defined(BZER0)
-STRONG_ALIAS(__aeabi_memset, memset)
+#if defined(__ARM_EABI__) && !defined(_BZERO)
+ENTRY(__aeabi_memset)
+       mov     r3, r1
+       mov     r1, r2
+       mov     r2, r3
+       b       memset
+END(__aeabi_memset)
+STRONG_ALIAS(__aeabi_memset4, __aeabi_memset)
+STRONG_ALIAS(__aeabi_memset8, __aeabi_memset)
+
+ENTRY(__aeabi_memclr)
+       mov     r2, r1
+       mov     r1, #0
+       b       memset
+END(__aeabi_memclr)
+STRONG_ALIAS(__aeabi_memclr4, __aeabi_memclr)
+STRONG_ALIAS(__aeabi_memclr8, __aeabi_memclr)
 #endif
 
 /*
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/string/memcmp.c
--- a/common/lib/libc/string/memcmp.c   Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/string/memcmp.c   Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memcmp.c,v 1.3 2011/11/08 16:52:11 joerg Exp $ */
+/*     $NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)memcmp.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memcmp.c,v 1.3 2011/11/08 16:52:11 joerg Exp $");
+__RCSID("$NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -68,3 +68,7 @@
        }
        return (0);
 }
+
+#if defined(__ARM_EABI__)
+__strong_alias(__aeabi_memcmp, memcmp)
+#endif
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/string/memcpy.c
--- a/common/lib/libc/string/memcpy.c   Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/string/memcpy.c   Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,8 @@
-/*     $NetBSD: memcpy.c,v 1.1 2005/12/20 19:28:52 christos Exp $      */
+/*     $NetBSD: memcpy.c,v 1.2 2013/12/02 21:21:33 joerg Exp $ */
 
 #define MEMCOPY
 #include "bcopy.c"
+
+#if defined(__ARM_EABI__)
+__strong_alias(__aeabi_memcpy, memcpy)
+#endif
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/string/memmove.c
--- a/common/lib/libc/string/memmove.c  Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/string/memmove.c  Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,10 @@
-/*     $NetBSD: memmove.c,v 1.1 2005/12/20 19:28:52 christos Exp $     */
+/*     $NetBSD: memmove.c,v 1.2 2013/12/02 21:21:33 joerg Exp $        */
 
 #define MEMMOVE
 #include "bcopy.c"
+
+#if defined(__ARM_EABI__)
+__strong_alias(__aeabi_memmove, memmove)
+__strong_alias(__aeabi_memmove4, memmove)
+__strong_alias(__aeabi_memmove8, memmove)
+#endif
diff -r 04bf5184a6ee -r 89225ff57797 common/lib/libc/string/memset.c
--- a/common/lib/libc/string/memset.c   Mon Dec 02 18:46:52 2013 +0000
+++ b/common/lib/libc/string/memset.c   Mon Dec 02 21:21:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memset.c,v 1.9 2011/11/08 16:52:11 joerg Exp $ */
+/*     $NetBSD: memset.c,v 1.10 2013/12/02 21:21:33 joerg Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)memset.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memset.c,v 1.9 2011/11/08 16:52:11 joerg Exp $");
+__RCSID("$NetBSD: memset.c,v 1.10 2013/12/02 21:21:33 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -76,6 +76,26 @@
 #define        VAL     c0
 #define        WIDEVAL c
 
+#if defined(__ARM_EABI__)
+void __aeabi_memset(void *, size_t, int);
+void __aeabi_memclr(void *, size_t);
+
+__strong_alias(__aeabi_memset4, __aebi_memset)
+__strong_alias(__aeabi_memset8, __aebi_memset)
+
+void
+__aeabi_memset(void *dst0, size_t length, int c)
+{
+       memset(dst0, c, length);
+}
+
+void
+__aeabi_memclr(void *dst0, size_t length)
+{
+       memset(dst0, 0, length);
+}
+#endif
+
 void *
 memset(void *dst0, int c0, size_t length)
 #endif



Home | Main Index | Thread Index | Old Index