[BACK]Return to bzero.S CVS log [TXT][DIR] Up to [local] / sys / lib / libkern / arch / i386

Annotation of sys/lib/libkern/arch/i386/bzero.S, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: bzero.S,v 1.3 2007/05/25 20:32:29 krw Exp $   */
        !             2:
        !             3: /*
        !             4:  * Written by J.T. Conklin <jtc@netbsd.org>.
        !             5:  * Public domain.
        !             6:  */
        !             7:
        !             8: #include <machine/asm.h>
        !             9:
        !            10: ENTRY(bzero)
        !            11:        pushl   %edi
        !            12:        movl    8(%esp),%edi
        !            13:        movl    12(%esp),%edx
        !            14:
        !            15:        cld                             /* set fill direction forward */
        !            16:        xorl    %eax,%eax               /* set fill data to 0 */
        !            17:
        !            18:        /*
        !            19:         * if the string is too short, it's really not worth the overhead
        !            20:         * of aligning to word boundaries, etc.  So we jump to a plain
        !            21:         * unaligned set.
        !            22:         */
        !            23:        cmpl    $16,%edx
        !            24:        jb      L1
        !            25:
        !            26:        movl    %edi,%ecx               /* compute misalignment */
        !            27:        negl    %ecx
        !            28:        andl    $3,%ecx
        !            29:        subl    %ecx,%edx
        !            30:        rep                             /* zero until word aligned */
        !            31:        stosb
        !            32:
        !            33:        movl    %edx,%ecx               /* zero by words */
        !            34:        shrl    $2,%ecx
        !            35:        andl    $3,%edx
        !            36:        rep
        !            37:        stosl
        !            38:
        !            39: L1:    movl    %edx,%ecx               /* zero remainder by bytes */
        !            40:        rep
        !            41:        stosb
        !            42:
        !            43:        popl    %edi
        !            44:        ret

CVSweb