svn commit: r340463 - head/lib/libc/amd64/string
Mateusz Guzik
mjg at FreeBSD.org
Thu Nov 15 20:20:40 UTC 2018
Author: mjg
Date: Thu Nov 15 20:20:39 2018
New Revision: 340463
URL: https://svnweb.freebsd.org/changeset/base/340463
Log:
amd64: convert libc bzero to a C func to avoid future bloat
Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17549
Added:
head/lib/libc/amd64/string/bzero.c (contents, props changed)
Deleted:
head/lib/libc/amd64/string/bzero.S
Modified:
head/lib/libc/amd64/string/Makefile.inc
head/lib/libc/amd64/string/memset.S
Modified: head/lib/libc/amd64/string/Makefile.inc
==============================================================================
--- head/lib/libc/amd64/string/Makefile.inc Thu Nov 15 19:06:07 2018 (r340462)
+++ head/lib/libc/amd64/string/Makefile.inc Thu Nov 15 20:20:39 2018 (r340463)
@@ -2,7 +2,6 @@
MDSRCS+= \
bcmp.S \
- bzero.S \
memcmp.S \
memcpy.S \
memmove.S \
Added: head/lib/libc/amd64/string/bzero.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/lib/libc/amd64/string/bzero.c Thu Nov 15 20:20:39 2018 (r340463)
@@ -0,0 +1,15 @@
+/*-
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <string.h>
+
+void
+bzero(void *b, size_t len)
+{
+
+ memset(b, 0, len);
+}
Modified: head/lib/libc/amd64/string/memset.S
==============================================================================
--- head/lib/libc/amd64/string/memset.S Thu Nov 15 19:06:07 2018 (r340462)
+++ head/lib/libc/amd64/string/memset.S Thu Nov 15 20:20:39 2018 (r340463)
@@ -31,18 +31,12 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
-.macro MEMSET bzero erms
-.if \bzero == 1
- movq %rsi,%rcx
- movq %rsi,%rdx
- xorl %eax,%eax
-.else
+.macro MEMSET erms
movq %rdi,%r9
movq %rdx,%rcx
movzbq %sil,%r8
movabs $0x0101010101010101,%rax
imulq %r8,%rax
-.endif
cmpq $32,%rcx
jb 1016f
@@ -95,9 +89,7 @@ __FBSDID("$FreeBSD$");
jl 1000f
movb %al,(%rdi)
1000:
-.if \bzero == 0
movq %r9,%rax
-.endif
ret
1256:
@@ -112,20 +104,12 @@ __FBSDID("$FreeBSD$");
andb $7,%cl
jne 1004b
.endif
-.if \bzero == 0
movq %r9,%rax
-.endif
ret
.endm
-#ifndef BZERO
ENTRY(memset)
- MEMSET bzero=0 erms=0
+ MEMSET erms=0
END(memset)
-#else
-ENTRY(bzero)
- MEMSET bzero=1 erms=0
-END(bzero)
-#endif
.section .note.GNU-stack,"",%progbits
More information about the svn-src-all
mailing list