Home | History | Annotate | Line # | Download | only in string
rindex.S revision 1.13
      1  1.13  christos /*
      2  1.13  christos  * Written by J.T. Conklin <jtc (at) NetBSD.org>.
      3  1.13  christos  * Public domain.
      4  1.13  christos  */
      5   1.1       cgd 
      6  1.13  christos #include <machine/asm.h>
      7  1.13  christos 
      8  1.13  christos #if defined(LIBC_SCCS)
      9  1.13  christos 	RCSID("$NetBSD: rindex.S,v 1.13 2005/02/07 05:22:51 christos Exp $")
     10  1.13  christos #endif
     11  1.13  christos 
     12  1.13  christos #ifdef STRRCHR
     13  1.13  christos ENTRY(strrchr)
     14  1.13  christos #else
     15  1.13  christos ENTRY(rindex)
     16  1.13  christos #endif
     17  1.13  christos 	pushl	%ebx
     18  1.13  christos 	movl	8(%esp),%edx
     19  1.13  christos 	movb	12(%esp),%cl
     20  1.13  christos 	xorl	%eax,%eax		/* init pointer to null */
     21  1.13  christos 	_ALIGN_TEXT,0x90
     22  1.13  christos L1:
     23  1.13  christos 	movb	(%edx),%bl
     24  1.13  christos 	cmpb	%bl,%cl
     25  1.13  christos 	jne	L2
     26  1.13  christos 	movl	%edx,%eax
     27  1.13  christos L2:
     28  1.13  christos 	incl	%edx
     29  1.13  christos 	testb	%bl,%bl			/* null terminator??? */
     30  1.13  christos 	jnz	L1
     31  1.13  christos 	popl	%ebx
     32  1.13  christos 	ret
     33