Home | History | Annotate | Download | only in string
      1 /*	$OpenBSD: rindex.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */
      2 /*
      3  * Written by J.T. Conklin <jtc (at) netbsd.org>.
      4  * Public domain.
      5  */
      6 
      7 #include <machine/asm.h>
      8 
      9 #ifdef STRRCHR
     10 ENTRY(strrchr)
     11 #else
     12 ENTRY(rindex)
     13 #endif
     14 	pushl	%ebx
     15 	movl	8(%esp),%edx
     16 	movb	12(%esp),%cl
     17 	xorl	%eax,%eax		/* init pointer to null */
     18 	.align 2,0x90
     19 L1:
     20 	movb	(%edx),%bl
     21 	cmpb	%bl,%cl
     22 	jne	L2
     23 	movl	%edx,%eax
     24 L2:
     25 	incl	%edx
     26 	testb	%bl,%bl			/* null terminator??? */
     27 	jnz	L1
     28 	popl	%ebx
     29 	ret
     30