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