NetBSD/lib/libc/arch/i386/string/index.S

30 lines
451 B
ArmAsm

/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: index.S,v 1.10 2000/08/07 14:46:52 ad Exp $")
#endif
#ifdef STRCHR
ENTRY(strchr)
#else
ENTRY(index)
#endif
movl 4(%esp),%eax
movb 8(%esp),%cl
_ALIGN_TEXT,0x90
L1:
movb (%eax),%dl
cmpb %dl,%cl /* found char??? */
je L2
incl %eax
testb %dl,%dl /* null terminator??? */
jnz L1
xorl %eax,%eax
L2:
ret