And rindex.S...

This commit is contained in:
mycroft 1998-02-22 07:21:32 +00:00
parent 6b7f2d0f92
commit cf02652abc
2 changed files with 34 additions and 2 deletions

View File

@ -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 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 \ memchr.S memcpy.S memset.S \
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S \ strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S \
htonl.S htons.S ntohl.S ntohs.S htonl.S htons.S ntohl.S ntohs.S

View File

@ -0,0 +1,32 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <machine/asm.h>
#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