mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-13 10:27:12 +03:00
49cb0f914d
devman: scan pci root bus git-svn-id: svn://kolibrios.org@1627 a494cfbc-eb01-0410-851d-a64ba20cac60
36 lines
749 B
ArmAsm
36 lines
749 B
ArmAsm
/* strrchr() Author: Kees J. Bot */
|
|
/* 2 Jan 1994 */
|
|
|
|
/* char *strrchr(const char *s, int c) */
|
|
/* Look for the last occurrence a character in a string. */
|
|
/* */
|
|
#include "asm.h"
|
|
|
|
ENTRY(strrchr)
|
|
push %ebp
|
|
movl %esp, %ebp
|
|
push %edi
|
|
movl 8(%ebp), %edi /* edi = string */
|
|
movl $-1, %ecx
|
|
xorb %al, %al
|
|
cld
|
|
|
|
repne scasb /* Look for the end of the string */
|
|
notl %ecx /* -1 - ecx = Length of the string + null */
|
|
decl %edi /* Put edi back on the zero byte */
|
|
movb 12(%ebp), %al /* The character to look for */
|
|
std /* Downwards search */
|
|
|
|
repne scasb
|
|
cld /* Direction bit back to default */
|
|
jne failure
|
|
leal 1(%edi), %eax /* Found it */
|
|
pop %edi
|
|
pop %ebp
|
|
ret
|
|
failure:
|
|
xorl %eax, %eax /* Not there */
|
|
pop %edi
|
|
pop %ebp
|
|
ret
|