summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/arch
diff options
context:
space:
mode:
authorchuck <chuck@cvs.openbsd.org>1997-11-04 19:08:20 +0000
committerchuck <chuck@cvs.openbsd.org>1997-11-04 19:08:20 +0000
commit543ad208f86c4407686b5ae68e8136a299c887d4 (patch)
tree5ecf9d115175fea3fabbc922e906ca70018372de /sys/lib/libkern/arch
parent6b57d10d1974c94e115608d07f1c152a2447e274 (diff)
add memchr to libkern
Diffstat (limited to 'sys/lib/libkern/arch')
-rw-r--r--sys/lib/libkern/arch/alpha/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/arm32/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/i386/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/i386/memchr.S27
-rw-r--r--sys/lib/libkern/arch/m68k/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/mips/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/ns32k/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/ns32k/memchr.S26
-rw-r--r--sys/lib/libkern/arch/powerpc/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/sparc/Makefile.inc3
-rw-r--r--sys/lib/libkern/arch/vax/Makefile.inc3
11 files changed, 71 insertions, 9 deletions
diff --git a/sys/lib/libkern/arch/alpha/Makefile.inc b/sys/lib/libkern/arch/alpha/Makefile.inc
index ce0e0bcf1ba..22ee7218ea2 100644
--- a/sys/lib/libkern/arch/alpha/Makefile.inc
+++ b/sys/lib/libkern/arch/alpha/Makefile.inc
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile.inc,v 1.7 1997/05/05 14:31:43 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.8 1997/11/04 19:08:01 chuck Exp $
# $NetBSD: Makefile.inc,v 1.9 1996/08/27 00:44:24 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
bcmp.c bzero.S ffs.S strcat.c strcmp.c strcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c htonl.S htons.S ntohl.S ntohs.S \
random.c strncasecmp.c
diff --git a/sys/lib/libkern/arch/arm32/Makefile.inc b/sys/lib/libkern/arch/arm32/Makefile.inc
index af5cd572ac9..7e5d52920f5 100644
--- a/sys/lib/libkern/arch/arm32/Makefile.inc
+++ b/sys/lib/libkern/arch/arm32/Makefile.inc
@@ -1,6 +1,7 @@
-# $Id: Makefile.inc,v 1.1 1996/04/21 22:27:47 deraadt Exp $
+# $Id: Makefile.inc,v 1.2 1997/11/04 19:08:04 chuck Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
bcmp.c bzero.c ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c locc.c htonl.c htons.c ntohl.c ntohs.c \
div.S random.c strncasecmp.c
diff --git a/sys/lib/libkern/arch/i386/Makefile.inc b/sys/lib/libkern/arch/i386/Makefile.inc
index 857134d5146..e048a85a5de 100644
--- a/sys/lib/libkern/arch/i386/Makefile.inc
+++ b/sys/lib/libkern/arch/i386/Makefile.inc
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile.inc,v 1.4 1996/04/21 22:27:52 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.5 1997/11/04 19:08:05 chuck Exp $
# $NetBSD: Makefile.inc,v 1.10 1996/04/13 01:17:41 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.S \
bcmp.S ffs.S memset.S strcat.S strcmp.S strcpy.S strlen.S strncmp.c \
strncpy.c scanc.S skpc.S locc.S htonl.S htons.S ntohl.S ntohs.S \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/i386/memchr.S b/sys/lib/libkern/arch/i386/memchr.S
new file mode 100644
index 00000000000..43f7a91e0a1
--- /dev/null
+++ b/sys/lib/libkern/arch/i386/memchr.S
@@ -0,0 +1,27 @@
+/* $OpenBSD: memchr.S,v 1.1 1997/11/04 19:08:06 chuck Exp $ */
+
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(memchr)
+ pushl %edi
+ movl 8(%esp),%edi /* string address */
+ movl 12(%esp),%eax /* set character to search for */
+ movl 16(%esp),%ecx /* set length of search */
+ testl %ecx,%ecx /* test for len == 0 */
+ jz L1
+ cld /* set search forward */
+ repne /* search! */
+ scasb
+ jne L1 /* scan failed, return null */
+ leal -1(%edi),%eax /* adjust result of scan */
+ popl %edi
+ ret
+ .align 2,0x90
+L1: xorl %eax,%eax
+ popl %edi
+ ret
diff --git a/sys/lib/libkern/arch/m68k/Makefile.inc b/sys/lib/libkern/arch/m68k/Makefile.inc
index 643e746f3c1..854cdc57e8a 100644
--- a/sys/lib/libkern/arch/m68k/Makefile.inc
+++ b/sys/lib/libkern/arch/m68k/Makefile.inc
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile.inc,v 1.3 1996/05/01 15:12:28 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.4 1997/11/04 19:08:08 chuck Exp $
# $NetBSD: Makefile.inc,v 1.7 1996/04/18 01:53:04 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S strncmp.S \
strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/mips/Makefile.inc b/sys/lib/libkern/arch/mips/Makefile.inc
index 26665e5e1d5..d60ae259ebb 100644
--- a/sys/lib/libkern/arch/mips/Makefile.inc
+++ b/sys/lib/libkern/arch/mips/Makefile.inc
@@ -1,9 +1,10 @@
-# $OpenBSD: Makefile.inc,v 1.4 1996/05/15 08:24:15 pefo Exp $
+# $OpenBSD: Makefile.inc,v 1.5 1997/11/04 19:08:10 chuck Exp $
# $NetBSD: Makefile.inc,v 1.4 1996/04/13 01:17:46 cgd Exp $
#
# There are likely more that we will notice when we go native
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
bcmp.S bcopy.S bzero.S strcat.c strcmp.c strcpy.c ffs.S htonl.S \
htons.S strcmp.S strlen.S strncmp.c random.c scanc.c skpc.c strncpy.c \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/ns32k/Makefile.inc b/sys/lib/libkern/arch/ns32k/Makefile.inc
index 67162a67186..d55cdd2c4de 100644
--- a/sys/lib/libkern/arch/ns32k/Makefile.inc
+++ b/sys/lib/libkern/arch/ns32k/Makefile.inc
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile.inc,v 1.3 1996/04/21 22:27:58 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.4 1997/11/04 19:08:11 chuck Exp $
# $NetBSD: Makefile.inc,v 1.7 1996/04/13 01:17:50 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.S \
bcmp.c ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c strncpy.c \
scanc.c skpc.c locc.c strncasecmp.c \
htonl.S htons.S ntohl.S ntohs.S
diff --git a/sys/lib/libkern/arch/ns32k/memchr.S b/sys/lib/libkern/arch/ns32k/memchr.S
new file mode 100644
index 00000000000..ce1c105a232
--- /dev/null
+++ b/sys/lib/libkern/arch/ns32k/memchr.S
@@ -0,0 +1,26 @@
+/* $OpenBSD: memchr.S,v 1.1 1997/11/04 19:08:13 chuck Exp $ */
+
+/*
+ * Written by Matthias Pfaller, 1996
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+
+/*
+ * void *
+ * memchr (const void *b, int c, size_t len)
+ * locate the first occurrence of c in string b.
+ */
+
+ENTRY(memchr)
+ enter [r4],0
+ movd B_ARG2,r0
+ movb B_ARG1,r4
+ movd B_ARG0,r1
+ skpsb u
+ bfc 0f
+ movd r1,r0
+0: exit [r4]
+ ret 0
diff --git a/sys/lib/libkern/arch/powerpc/Makefile.inc b/sys/lib/libkern/arch/powerpc/Makefile.inc
index d87436e87ae..42f058ef760 100644
--- a/sys/lib/libkern/arch/powerpc/Makefile.inc
+++ b/sys/lib/libkern/arch/powerpc/Makefile.inc
@@ -1,10 +1,11 @@
-# $OpenBSD: Makefile.inc,v 1.2 1996/12/28 06:17:46 rahnds Exp $
+# $OpenBSD: Makefile.inc,v 1.3 1997/11/04 19:08:15 chuck Exp $
# $NetBSD: Makefile.inc,v 1.6 1994/10/26 06:39:03 cgd Exp $
CFLAGS += -D_KERNEL
SRCS+= __main.c __eabi.c \
imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
bcmp.c bzero.c ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c locc.c htonl.c htons.c ntohl.c ntohs.c \
memcpy.c random.c
diff --git a/sys/lib/libkern/arch/sparc/Makefile.inc b/sys/lib/libkern/arch/sparc/Makefile.inc
index 2fe78069580..7f79c087380 100644
--- a/sys/lib/libkern/arch/sparc/Makefile.inc
+++ b/sys/lib/libkern/arch/sparc/Makefile.inc
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile.inc,v 1.3 1996/05/01 15:17:31 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.4 1997/11/04 19:08:16 chuck Exp $
# $NetBSD: Makefile.inc,v 1.12 1996/04/23 23:05:22 christos Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
bcmp.c bzero.S strcat.c strcmp.c strcpy.c strlen.S strncmp.c \
strncpy.c htonl.S htons.S ntohl.S ntohs.S scanc.c skpc.c \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/vax/Makefile.inc b/sys/lib/libkern/arch/vax/Makefile.inc
index 1741e47144d..57949c7e78a 100644
--- a/sys/lib/libkern/arch/vax/Makefile.inc
+++ b/sys/lib/libkern/arch/vax/Makefile.inc
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.3 1997/01/14 14:45:42 maja Exp $
+# $OpenBSD: Makefile.inc,v 1.4 1997/11/04 19:08:19 chuck Exp $
# $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ memchr.c \
strcat.c strcmp.c strcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c strncasecmp.c