Home | History | Annotate | Download | only in string
      1 /*	$OpenBSD: bcmp.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */
      2 /*
      3  * Written by J.T. Conklin <jtc (at) netbsd.org>.
      4  * Public domain.
      5  */
      6 
      7 #include <machine/asm.h>
      8 
      9 ENTRY(bcmp)
     10 	pushl	%edi
     11 	pushl	%esi
     12 	movl	12(%esp),%edi
     13 	movl	16(%esp),%esi
     14 	xorl	%eax,%eax		/* clear return value */
     15 	cld				/* set compare direction forward */
     16 
     17 	movl	20(%esp),%ecx		/* compare by words */
     18 	shrl	$2,%ecx
     19 	repe
     20 	cmpsl
     21 	jne	L1
     22 
     23 	movl	20(%esp),%ecx		/* compare remainder by bytes */
     24 	andl	$3,%ecx
     25 	repe
     26 	cmpsb
     27 	je	L2
     28 
     29 L1:	incl	%eax
     30 L2:	popl	%esi
     31 	popl	%edi
     32 	ret
     33