git: 79e01e7e643c - main - lib/libc/aarch64/string: add bcopy & bzero wrapper

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Fri, 10 Jan 2025 15:04:01 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/src/commit/?id=79e01e7e643c9337d8d6046b6db7df674475a099

commit 79e01e7e643c9337d8d6046b6db7df674475a099
Author:     Getz Mikalsen <getz@FreeBSD.org>
AuthorDate: 2024-08-28 13:13:45 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-01-10 15:02:40 +0000

    lib/libc/aarch64/string: add bcopy & bzero wrapper
    
    This patch enabled usage of SIMD enhanced functions to implement
    bcopy and bzero.
    
    Tested by:      fuz (exprun)
    Reviewed by:    fuz, emaste
    Sponsored by:   Google LLC (GSoC 2024)
    PR:             281175
    Differential Revision: https://reviews.freebsd.org/D46459
---
 lib/libc/aarch64/string/Makefile.inc |  4 +++-
 lib/libc/aarch64/string/bcopy.c      | 14 ++++++++++++++
 lib/libc/aarch64/string/bzero.c      | 14 ++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc
index 7325b54d9716..752cc6d9900b 100644
--- a/lib/libc/aarch64/string/Makefile.inc
+++ b/lib/libc/aarch64/string/Makefile.inc
@@ -30,7 +30,9 @@ MDSRCS+= \
 	memccpy.S \
 	strncat.c \
 	strlcat.c \
-	strlen.S
+	strlen.S \
+	bcopy.c \
+	bzero.c
 
 #
 # Add the above functions. Generate an asm file that includes the needed
diff --git a/lib/libc/aarch64/string/bcopy.c b/lib/libc/aarch64/string/bcopy.c
new file mode 100644
index 000000000000..0dee529fb9df
--- /dev/null
+++ b/lib/libc/aarch64/string/bcopy.c
@@ -0,0 +1,14 @@
+/*-
+ * Public domain.
+ */
+
+#include <string.h>
+
+#undef bcopy	/* _FORTIFY_SOURCE */
+
+void
+bcopy(const void *src, void *dst, size_t len)
+{
+
+	memmove(dst, src, len);
+}
diff --git a/lib/libc/aarch64/string/bzero.c b/lib/libc/aarch64/string/bzero.c
new file mode 100644
index 000000000000..d82f3061865b
--- /dev/null
+++ b/lib/libc/aarch64/string/bzero.c
@@ -0,0 +1,14 @@
+/*-
+ * Public domain.
+ */
+
+#include <string.h>
+
+#undef bzero	/* _FORTIFY_SOURCE */
+
+void
+bzero(void *b, size_t len)
+{
+
+	memset(b, 0, len);
+}