summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/i386/string/strchr.S
blob: a73f62311d9aad1102e7e69c9d801a55f553db43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*	$OpenBSD: strchr.S,v 1.8 2017/11/29 05:13:57 guenther Exp $ */
/*
 * Written by J.T. Conklin <jtc@netbsd.org>.
 * Public domain.
 */

#include "DEFS.h"

WEAK_ALIAS(index, strchr)

ENTRY(strchr)
	movl	4(%esp),%eax
	movb	8(%esp),%cl
	.align 2,0x90
L1:
	movb	(%eax),%dl
	cmpb	%dl,%cl			/* found char??? */
	je 	L2
	incl	%eax
	testb	%dl,%dl			/* null terminator??? */
	jnz	L1
	xorl	%eax,%eax
L2:
	ret
END_STRONG(strchr)