1 /* $OpenBSD: strlen.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */
3 * Written by J.T. Conklin <jtc@netbsd.org>.
7 #include <machine/asm.h>
11 movl 8(%esp),%edi /* string address */
12 cld /* set search forward */
13 xorl %eax,%eax /* set search for null terminator */
14 movl $-1,%ecx /* set search for lots of characters */
17 notl %ecx /* get length by taking complement */
18 leal -1(%ecx),%eax /* and subtracting one */