aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Clausecker <fuz@FreeBSD.org>2025-10-21 18:55:41 +0000
committerRobert Clausecker <fuz@FreeBSD.org>2025-10-31 12:48:00 +0000
commitb5dbf3de561189140c73f915bd50c28ea69a1e19 (patch)
treef3d9eab6d65739b4b3b7f9f537d2b0ec3c7eade6
parent39fef5b9fa943f301776e0b0bf406cedd7c29af2 (diff)
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
-rw-r--r--lib/libc/riscv/string/Makefile.inc2
-rw-r--r--lib/libc/riscv/string/bcopy.c14
-rw-r--r--lib/libc/riscv/string/bzero.c14
3 files changed, 30 insertions, 0 deletions
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);
+}