update for HEAD-2003091401
[reactos.git] / lib / string / i386 / memcpy.s
1 /* 
2  * $Id$
3  */
4
5 /*
6  * void *memcpy (void *to, const void *from, size_t count)
7  */
8
9 .globl  _memcpy
10
11 _memcpy:
12         push    %ebp
13         mov     %esp,%ebp
14         push    %esi
15         push    %edi
16         mov     0x8(%ebp),%edi
17         mov     0xc(%ebp),%esi
18         mov     0x10(%ebp),%ecx
19         cld
20         cmp     $16,%ecx
21         jb      .L1
22         mov     %ecx,%edx
23         test    $3,%edi
24         je      .L2
25 /*
26  *  Make the destination dword aligned
27  */
28         mov     %edi,%ecx
29         and     $3,%ecx
30         sub     $5,%ecx
31         not     %ecx
32         sub     %ecx,%edx
33         rep     movsb
34         mov     %edx,%ecx       
35 .L2:
36         shr     $2,%ecx
37         rep     movsl
38         mov     %edx,%ecx
39         and     $3,%ecx
40 .L1:    
41         test    %ecx,%ecx
42         je      .L3
43         rep     movsb
44 .L3:
45         pop     %edi
46         pop     %esi
47         mov     0x8(%ebp),%eax
48         leave
49         ret
50