From cf02652abc8dd18a71daed12efa4cdafd1fca4d7 Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 22 Feb 1998 07:21:32 +0000 Subject: [PATCH] And rindex.S... --- lib/libc/arch/i386/Makefile.inc | 4 ++-- sys/lib/libkern/arch/i386/rindex.S | 32 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 sys/lib/libkern/arch/i386/rindex.S diff --git a/lib/libc/arch/i386/Makefile.inc b/lib/libc/arch/i386/Makefile.inc index b0c735a6883c..786060e59344 100644 --- a/lib/libc/arch/i386/Makefile.inc +++ b/lib/libc/arch/i386/Makefile.inc @@ -1,7 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.8 1998/02/22 07:20:24 mycroft Exp $ +# $NetBSD: Makefile.inc,v 1.9 1998/02/22 07:21:32 mycroft Exp $ KMINCLUDES= arch/i386/SYS.h -KMSRCS= bcmp.S bcopy.S bzero.S ffs.S index.S \ +KMSRCS= bcmp.S bcopy.S bzero.S ffs.S index.S rindex.S \ memchr.S memcpy.S memset.S \ strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S \ htonl.S htons.S ntohl.S ntohs.S diff --git a/sys/lib/libkern/arch/i386/rindex.S b/sys/lib/libkern/arch/i386/rindex.S new file mode 100644 index 000000000000..3ebcd16f3297 --- /dev/null +++ b/sys/lib/libkern/arch/i386/rindex.S @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +#if defined(LIBC_SCCS) + RCSID("$NetBSD: rindex.S,v 1.1 1998/02/22 07:21:53 mycroft Exp $") +#endif + +#ifdef STRRCHR +ENTRY(strrchr) +#else +ENTRY(rindex) +#endif + pushl %ebx + movl 8(%esp),%edx + movb 12(%esp),%cl + xorl %eax,%eax /* init pointer to null */ + .align 2,0x90 +L1: + movb (%edx),%bl + cmpb %bl,%cl + jne L2 + movl %edx,%eax +L2: + incl %edx + testb %bl,%bl /* null terminator??? */ + jnz L1 + popl %ebx + ret