OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / bionic / libc / arch-x86 / string / index.S
1 /*      $OpenBSD: index.S,v 1.4 2005/08/07 11:30:38 espie Exp $ */
2 /*
3  * Written by J.T. Conklin <jtc@netbsd.org>.
4  * Public domain.
5  */
6
7 #include <machine/asm.h>
8
9 #ifdef STRCHR
10 ENTRY(strchr)
11 #else
12 ENTRY(index)
13 #endif
14         movl    4(%esp),%eax
15         movb    8(%esp),%cl
16         .align 2,0x90
17 L1:
18         movb    (%eax),%dl
19         cmpb    %dl,%cl                 /* found char??? */
20         je      L2
21         incl    %eax
22         testb   %dl,%dl                 /* null terminator??? */
23         jnz     L1
24         xorl    %eax,%eax
25 L2:
26         ret