libc-top-half/musl/src/string/i386/memcpy.s
raw| 1 | .global memcpy |
| 2 | .global __memcpy_fwd |
| 3 | .hidden __memcpy_fwd |
| 4 | .type memcpy,@function |
| 5 | memcpy: |
| 6 | __memcpy_fwd: |
| 7 | push %esi |
| 8 | push %edi |
| 9 | mov 12(%esp),%edi |
| 10 | mov 16(%esp),%esi |
| 11 | mov 20(%esp),%ecx |
| 12 | mov %edi,%eax |
| 13 | cmp $4,%ecx |
| 14 | jc 1f |
| 15 | test $3,%edi |
| 16 | jz 1f |
| 17 | 2: movsb |
| 18 | dec %ecx |
| 19 | test $3,%edi |
| 20 | jnz 2b |
| 21 | 1: mov %ecx,%edx |
| 22 | shr $2,%ecx |
| 23 | rep |
| 24 | movsl |
| 25 | and $3,%edx |
| 26 | jz 1f |
| 27 | 2: movsb |
| 28 | dec %edx |
| 29 | jnz 2b |
| 30 | 1: pop %edi |
| 31 | pop %esi |
| 32 | ret |