1 /* 2 * Written by J.T. Conklin <jtc (at) NetBSD.org>. 3 * Public domain. 4 */ 5 6 #include <machine/asm.h> 7 8 #if defined(LIBC_SCCS) 9 RCSID("$NetBSD: index.S,v 1.13 2005/02/07 05:22:51 christos Exp $") 10 #endif 11 12 #ifdef STRCHR 13 ENTRY(strchr) 14 #else 15 ENTRY(index) 16 #endif 17 movl 4(%esp),%eax 18 movb 8(%esp),%cl 19 _ALIGN_TEXT,0x90 20 L1: 21 movb (%eax),%dl 22 cmpb %dl,%cl /* found char??? */ 23 je L2 24 incl %eax 25 testb %dl,%dl /* null terminator??? */ 26 jnz L1 27 xorl %eax,%eax 28 L2: 29 ret 30