1*ea6088e7Sguenther/* $OpenBSD: strrchr.S,v 1.8 2017/11/29 05:13:57 guenther Exp $ */ 25b859c19Sderaadt/* 35b859c19Sderaadt * Written by J.T. Conklin <jtc@netbsd.org>. 45b859c19Sderaadt * Public domain. 55b859c19Sderaadt */ 65b859c19Sderaadt 7*ea6088e7Sguenther#include "DEFS.h" 85b859c19Sderaadt 9cb39b413SmillertWEAK_ALIAS(rindex, strrchr) 10f1bfdb2bSkettenis 115b859c19SderaadtENTRY(strrchr) 125b859c19Sderaadt pushl %ebx 135b859c19Sderaadt movl 8(%esp),%edx 145b859c19Sderaadt movb 12(%esp),%cl 155b859c19Sderaadt xorl %eax,%eax /* init pointer to null */ 165b859c19Sderaadt .align 2,0x90 175b859c19SderaadtL1: 185b859c19Sderaadt movb (%edx),%bl 195b859c19Sderaadt cmpb %bl,%cl 205b859c19Sderaadt jne L2 215b859c19Sderaadt movl %edx,%eax 225b859c19SderaadtL2: 235b859c19Sderaadt incl %edx 245b859c19Sderaadt testb %bl,%bl /* null terminator??? */ 255b859c19Sderaadt jnz L1 265b859c19Sderaadt popl %ebx 275b859c19Sderaadt ret 289b9d2a55SguentherEND_STRONG(strrchr) 29