1/* $OpenBSD: bcmp.S,v 1.5 2017/11/29 05:13:57 guenther Exp $ */ 2/* 3 * Written by J.T. Conklin <jtc@netbsd.org>. 4 * Public domain. 5 */ 6 7#include "DEFS.h" 8 9ENTRY(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 29L1: incl %eax 30L2: popl %esi 31 popl %edi 32 ret 33END_WEAK(bcmp) 34