git: b5dbf3de5611 - main - libc/riscv64: implement bcopy() and bzero() through memcpy() and memset()

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Fri, 31 Oct 2025 12:48:42 UTC
The branch main has been updated by fuz:

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

commit b5dbf3de561189140c73f915bd50c28ea69a1e19
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-10-21 18:55:41 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-10-31 12:48:00 +0000

    libc/riscv64: implement bcopy() and bzero() through memcpy() and memset()
    
    This picks up the accelerated string functions written by
    strajabot@.
    
    Event:          Google Summer of Code 2024
    MFC after:      1 month
    MFC to:         stable/15
    See also:       79e01e7e643c9337d8d6046b6db7df674475a099
    Approved by:    markj (mentor)
    Differential Revision:  https://reviews.freebsd.org/D53248
---
 lib/libc/riscv/string/Makefile.inc |  2 ++
 lib/libc/riscv/string/bcopy.c      | 14 ++++++++++++++
 lib/libc/riscv/string/bzero.c      | 14 ++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/lib/libc/riscv/string/Makefile.inc b/lib/libc/riscv/string/Makefile.inc
index 719f22f6077f..6dae6b2cb62d 100644
--- a/lib/libc/riscv/string/Makefile.inc
+++ b/lib/libc/riscv/string/Makefile.inc
@@ -1,4 +1,6 @@
 MDSRCS+= \
+	bcopy.c \
+	bzero.c \
 	memchr.S \
 	memcpy.S \
 	memset.S \
diff --git a/lib/libc/riscv/string/bcopy.c b/lib/libc/riscv/string/bcopy.c
new file mode 100644
index 000000000000..0dee529fb9df
--- /dev/null
+++ b/lib/libc/riscv/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/riscv/string/bzero.c b/lib/libc/riscv/string/bzero.c
new file mode 100644
index 000000000000..d82f3061865b
--- /dev/null
+++ b/lib/libc/riscv/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);
+}