33 lines
503 B
ArmAsm
33 lines
503 B
ArmAsm
/*
|
|
* Written by J.T. Conklin <jtc@NetBSD.org>.
|
|
* Public domain.
|
|
*/
|
|
|
|
#include <machine/asm.h>
|
|
|
|
#if defined(LIBC_SCCS)
|
|
RCSID("$NetBSD: strrchr.S,v 1.4 2005/02/26 22:58:56 perry Exp $")
|
|
#endif
|
|
|
|
#ifdef RINDEX
|
|
ENTRY(rindex)
|
|
#else
|
|
ENTRY(strrchr)
|
|
#endif
|
|
pushl %ebx
|
|
movl 8(%esp),%edx
|
|
movb 12(%esp),%cl
|
|
xorl %eax,%eax /* init pointer to null */
|
|
_ALIGN_TEXT,0x90
|
|
L1:
|
|
movb (%edx),%bl
|
|
cmpb %bl,%cl
|
|
jne L2
|
|
movl %edx,%eax
|
|
L2:
|
|
incl %edx
|
|
testb %bl,%bl /* null terminator??? */
|
|
jnz L1
|
|
popl %ebx
|
|
ret
|