• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*	$OpenBSD: index.S,v 1.4 2005/08/07 11:30:38 espie Exp $ */
2/*
3 * Written by J.T. Conklin <jtc@netbsd.org>.
4 * Public domain.
5 */
6
7#include <machine/asm.h>
8
9#ifdef STRCHR
10ENTRY(strchr)
11#else
12ENTRY(index)
13#endif
14	movl	4(%esp),%eax
15	movb	8(%esp),%cl
16	.align 2,0x90
17L1:
18	movb	(%eax),%dl
19	cmpb	%dl,%cl			/* found char??? */
20	je 	L2
21	incl	%eax
22	testb	%dl,%dl			/* null terminator??? */
23	jnz	L1
24	xorl	%eax,%eax
25L2:
26	ret
27