1/* $OpenBSD: strchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ 2/* 3 * Written by J.T. Conklin <jtc@netbsd.org>. 4 * Public domain. 5 */ 6 7#include "SYS.h" 8 9WEAK_ALIAS(index, strchr) 10 11ENTRY(strchr) 12 movl 4(%esp),%eax 13 movb 8(%esp),%cl 14 .align 2,0x90 15L1: 16 movb (%eax),%dl 17 cmpb %dl,%cl /* found char??? */ 18 je L2 19 incl %eax 20 testb %dl,%dl /* null terminator??? */ 21 jnz L1 22 xorl %eax,%eax 23L2: 24 ret 25END_STRONG(strchr) 26