/*1* Copyright (c) 1993 Winning Strategies, Inc.2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. All advertising materials mentioning features or use of this software13* must display the following acknowledgement:14* This product includes software developed by Winning Strategies, Inc.15* 4. The name of the author may not be used to endorse or promote products16* derived from this software without specific prior written permission17*18* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR19* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES20* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.21* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,22* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT23* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,24* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY25* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF27* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.28*/2930#include <machine/asm.h>31/*32* strrchr(s, c)33* return a pointer to the last occurrence of the character c in34* string s, or NULL if c does not occur in the string.35*36* %edx - pointer iterating through string37* %eax - pointer to last occurrence of 'c'38* %cl - character we're comparing against39* %bl - character at %edx40*41* Written by:42* J.T. Conklin ([email protected]), Winning Strategies, Inc.43*/4445ENTRY(strrchr)46pushl %ebx47movl 8(%esp),%edx48movb 12(%esp),%cl49xorl %eax,%eax /* init pointer to null */50.align 2,0x9051L1:52movb (%edx),%bl53cmpb %bl,%cl54jne L255movl %edx,%eax56L2:57incl %edx58testb %bl,%bl /* null terminator??? */59jne L160popl %ebx61ret62END(strrchr)6364WEAK_REFERENCE(strrchr, rindex)6566.section .note.GNU-stack,"",%progbits676869