Annotation of coherent/b/lib/libc/string/i386/memcpy.s, revision 1.1

1.1     ! root        1: //////////
        !             2: / libc/string/i386/memcpy.s
        !             3: / i386 C string library.
        !             4: / ANSI 4.11.2.1.
        !             5: //////////
        !             6: 
        !             7: //////////
        !             8: / void *
        !             9: / memcpy(void *To, void *From, size_t Count)
        !            10: /
        !            11: / Copy Count bytes from From to To, return To.
        !            12: / Copies first by dwords, then by words, then by bytes, for efficiency;
        !            13: / does not try to align the arguments.
        !            14: //////////
        !            15: 
        !            16: To     .equ    12
        !            17: From   .equ    To+4
        !            18: Count  .equ    From+4
        !            19: 
        !            20:        .globl  memcpy
        !            21:        .globl  _memcpy
        !            22: 
        !            23: memcpy:
        !            24:        push    %esi
        !            25:        push    %edi
        !            26: 
        !            27:        movl    %esi, From(%esp)        / From to ESI
        !            28:        movl    %edi, To(%esp)          / To to EDI
        !            29:        movl    %ecx, Count(%esp)       / Count to ECX
        !            30:        movl    %eax, %edi              / Return value to EAX
        !            31: 
        !            32: _memcpy:                               / memmove() entry point
        !            33:        cld
        !            34:        movl    %edx, %ecx              / Save Count in EDX
        !            35:        shrl    %ecx, $2                / Count/4
        !            36:        rep
        !            37:        movsl                           / move Count/4 dwords
        !            38:        jnc     ?byte                   / CF contains Count bit 1 from shrl above
        !            39:        movsw                           / move a word
        !            40: 
        !            41: ?byte:
        !            42:        shrl    %edx, $1
        !            43:        jnc     ?done
        !            44:        movsb                           / move a byte
        !            45: 
        !            46: ?done:
        !            47:        pop     %edi
        !            48:        pop     %esi
        !            49:        ret
        !            50: 
        !            51: / end of libc/string/i386/memcpy.s

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.