1/* $OpenBSD: strrchr.S,v 1.8 2017/11/29 05:13:57 guenther Exp $ */ 2/* 3 * Written by J.T. Conklin <jtc@netbsd.org>. 4 * Public domain. 5 */ 6 7#include "DEFS.h" 8 9WEAK_ALIAS(rindex, strrchr) 10 11ENTRY(strrchr) 12 pushl %ebx 13 movl 8(%esp),%edx 14 movb 12(%esp),%cl 15 xorl %eax,%eax /* init pointer to null */ 16 .align 2,0x90 17L1: 18 movb (%edx),%bl 19 cmpb %bl,%cl 20 jne L2 21 movl %edx,%eax 22L2: 23 incl %edx 24 testb %bl,%bl /* null terminator??? */ 25 jnz L1 26 popl %ebx 27 ret 28END_STRONG(strrchr) 29