memmove.S for i386
Nikola Vladov <[email protected]>
| Newsgroups | gmane.linux.lib.dietlibc |
|---|---|
| Message-ID | <[email protected]> |
Can some assembler guru verify next function? For me it works fine.
I'm not shure on cmpl and ja bellow.
-------------------------
/* public domain. author: Nikola Vladov */
.text
.align 0
.global memmove
.type memmove,@function
memmove:
pushl %esi
pushl %edi
movl 12(%esp),%edi
movl 16(%esp),%esi
movl 20(%esp),%ecx
movl %edi, %eax
cld
cmpl %edi, %esi
ja .L1
std
decl %edi
decl %esi
addl %ecx, %edi
addl %ecx, %esi
.L1:
rep movsb
cld
popl %edi
popl %esi
ret