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 .text 10 .asciz "$OpenBSD: bcmp.S,v 1.2 1996/08/19 08:12:52 tholo Exp $" 11#endif 12 13ENTRY(bcmp) 14 pushl %edi 15 pushl %esi 16 movl 12(%esp),%edi 17 movl 16(%esp),%esi 18 xorl %eax,%eax /* clear return value */ 19 cld /* set compare direction forward */ 20 21 movl 20(%esp),%ecx /* compare by words */ 22 shrl $2,%ecx 23 repe 24 cmpsl 25 jne L1 26 27 movl 20(%esp),%ecx /* compare remainder by bytes */ 28 andl $3,%ecx 29 repe 30 cmpsb 31 je L2 32 33L1: incl %eax 34L2: popl %esi 35 popl %edi 36 ret 37