1/* $OpenBSD: bcmp.S,v 1.3 2014/11/29 18:51:23 tedu Exp $ */ 2 3/* 4 * Written by J.T. Conklin <jtc@netbsd.org>. 5 * Public domain. 6 */ 7 8#include <machine/asm.h> 9 10ENTRY(bcmp) 11 pushl %edi 12 pushl %esi 13 movl 12(%esp),%edi 14 movl 16(%esp),%esi 15 xorl %eax,%eax /* clear return value */ 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 33