1 1.13 christos /* 2 1.13 christos * Written by J.T. Conklin <jtc (at) NetBSD.org>. 3 1.13 christos * Public domain. 4 1.13 christos */ 5 1.1 cgd 6 1.13 christos #include <machine/asm.h> 7 1.13 christos 8 1.13 christos #if defined(LIBC_SCCS) 9 1.13 christos RCSID("$NetBSD: index.S,v 1.13 2005/02/07 05:22:51 christos Exp $") 10 1.13 christos #endif 11 1.13 christos 12 1.13 christos #ifdef STRCHR 13 1.13 christos ENTRY(strchr) 14 1.13 christos #else 15 1.13 christos ENTRY(index) 16 1.13 christos #endif 17 1.13 christos movl 4(%esp),%eax 18 1.13 christos movb 8(%esp),%cl 19 1.13 christos _ALIGN_TEXT,0x90 20 1.13 christos L1: 21 1.13 christos movb (%eax),%dl 22 1.13 christos cmpb %dl,%cl /* found char??? */ 23 1.13 christos je L2 24 1.13 christos incl %eax 25 1.13 christos testb %dl,%dl /* null terminator??? */ 26 1.13 christos jnz L1 27 1.13 christos xorl %eax,%eax 28 1.13 christos L2: 29 1.13 christos ret 30