1/* 2 * Written by J.T. Conklin <jtc@netbsd.org>. 3 * Public domain. 4 */ 5 6#include <machine/asm.h> 7 8#if defined(LIBC_SCCS) 9 RCSID("$NetBSD: bcmp.S,v 1.7 1995/04/28 22:57:54 jtc Exp $") 10#endif 11 12ENTRY(bcmp) 13 pushl %edi 14 pushl %esi 15 movl 12(%esp),%edi 16 movl 16(%esp),%esi 17 xorl %eax,%eax /* clear return value */ 18 cld /* set compare direction forward */ 19 20 movl 20(%esp),%ecx /* compare by words */ 21 shrl $2,%ecx 22 repe 23 cmpsl 24 jne L1 25 26 movl 20(%esp),%ecx /* compare remainder by bytes */ 27 andl $3,%ecx 28 repe 29 cmpsb 30 je L2 31 32L1: incl %eax 33L2: popl %esi 34 popl %edi 35 ret 36