summaryrefslogtreecommitdiff
path: root/lib/libc/arch/i386/string/rindex.S
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
commitd6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch)
treeece253b876159b39c620e62b6c9b1174642e070e /lib/libc/arch/i386/string/rindex.S
initial import of NetBSD tree
Diffstat (limited to 'lib/libc/arch/i386/string/rindex.S')
-rw-r--r--lib/libc/arch/i386/string/rindex.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/libc/arch/i386/string/rindex.S b/lib/libc/arch/i386/string/rindex.S
new file mode 100644
index 00000000000..27b8bdd5e25
--- /dev/null
+++ b/lib/libc/arch/i386/string/rindex.S
@@ -0,0 +1,32 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+#if defined(LIBC_SCCS)
+ RCSID("$NetBSD: rindex.S,v 1.9 1995/04/28 22:58:07 jtc Exp $")
+#endif
+
+#ifdef STRRCHR
+ENTRY(strrchr)
+#else
+ENTRY(rindex)
+#endif
+ pushl %ebx
+ movl 8(%esp),%edx
+ movb 12(%esp),%cl
+ xorl %eax,%eax /* init pointer to null */
+ .align 2,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