summaryrefslogtreecommitdiff
path: root/lib/libc/arch
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2012-01-17 21:31:20 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2012-01-17 21:31:20 +0000
commit8b32f16e7fe9c826ca4e787966cb27b77363be0e (patch)
tree49d0df613f1fa6f92923e3dfab8a20b3e434655c /lib/libc/arch
parent2ad8ee1c3882a4b6e1a9f3dc90f607a6e37d13cd (diff)
Remove assembly version of strlen from i386 and amd64, where it's
up to 3 times slower than the C code most of the time. This was brought up by DragonflyBSD guys initially. ok deraadt, guenther. miod will not miss it.
Diffstat (limited to 'lib/libc/arch')
-rw-r--r--lib/libc/arch/amd64/string/strlen.S18
-rw-r--r--lib/libc/arch/i386/Makefile.inc6
-rw-r--r--lib/libc/arch/i386/string/Makefile.inc6
-rw-r--r--lib/libc/arch/i386/string/strlen.S20
4 files changed, 6 insertions, 44 deletions
diff --git a/lib/libc/arch/amd64/string/strlen.S b/lib/libc/arch/amd64/string/strlen.S
deleted file mode 100644
index 3afccb8f1ac..00000000000
--- a/lib/libc/arch/amd64/string/strlen.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: strlen.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
- */
-
-#include <machine/asm.h>
-
-ENTRY(strlen)
- cld /* set search forward */
- xorl %eax,%eax /* set search for null terminator */
- movq $-1,%rcx /* set search for lots of characters */
- repne /* search! */
- scasb
- notq %rcx /* get length by taking complement */
- leaq -1(%rcx),%rax /* and subtracting one */
- ret
diff --git a/lib/libc/arch/i386/Makefile.inc b/lib/libc/arch/i386/Makefile.inc
index b0f1da56f3a..1b1fc263f5d 100644
--- a/lib/libc/arch/i386/Makefile.inc
+++ b/lib/libc/arch/i386/Makefile.inc
@@ -1,5 +1,5 @@
-# $OpenBSD: Makefile.inc,v 1.2 1996/08/19 08:12:11 tholo Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2012/01/17 21:31:19 mikeb Exp $
KMINCLUDES= arch/i386/SYS.h arch/i386/DEFS.h
-KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S \
- htonl.S htons.S ntohl.S ntohs.S
+KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S htonl.S htons.S \
+ ntohl.S ntohs.S
diff --git a/lib/libc/arch/i386/string/Makefile.inc b/lib/libc/arch/i386/string/Makefile.inc
index f357d3d8f23..d18a67fa921 100644
--- a/lib/libc/arch/i386/string/Makefile.inc
+++ b/lib/libc/arch/i386/string/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.4 1999/04/25 00:23:58 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2012/01/17 21:31:19 mikeb Exp $
SRCS+= bcmp.S bcopy.S bzero.S ffs.S index.S memchr.S memcmp.S memset.S \
- rindex.S strcat.S strcmp.S strcpy.S strcspn.c strlcpy.c strlen.S \
+ rindex.S strcat.S strcmp.S strcpy.S strcspn.c strlcpy.c strlen.c \
strncat.c strncmp.S strncpy.c strpbrk.c strsep.c \
strspn.c strstr.c swab.S
SRCS+= memcpy.S memmove.S strchr.S strrchr.S
LSRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memchr.c memcmp.c memset.c \
- rindex.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c swab.c
+ rindex.c strcat.c strcmp.c strcpy.c strncmp.c swab.c
diff --git a/lib/libc/arch/i386/string/strlen.S b/lib/libc/arch/i386/string/strlen.S
deleted file mode 100644
index 4f04ffc995d..00000000000
--- a/lib/libc/arch/i386/string/strlen.S
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: strlen.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- */
-
-#include <machine/asm.h>
-
-ENTRY(strlen)
- pushl %edi
- movl 8(%esp),%edi /* string address */
- cld /* set search forward */
- xorl %eax,%eax /* set search for null terminator */
- movl $-1,%ecx /* set search for lots of characters */
- repne /* search! */
- scasb
- notl %ecx /* get length by taking complement */
- leal -1(%ecx),%eax /* and subtracting one */
- popl %edi
- ret