/* $OpenBSD: bcmp.S,v 1.6 2022/12/04 08:22:13 tb Exp $ */ /* * Written by J.T. Conklin . * Public domain. */ #include "DEFS.h" ENTRY_NB(bcmp) pushl %edi pushl %esi movl 12(%esp),%edi movl 16(%esp),%esi xorl %eax,%eax /* clear return value */ cld /* set compare direction forward */ movl 20(%esp),%ecx /* compare by words */ shrl $2,%ecx repe cmpsl jne L1 movl 20(%esp),%ecx /* compare remainder by bytes */ andl $3,%ecx repe cmpsb je L2 L1: incl %eax L2: popl %esi popl %edi ret END_WEAK(bcmp)