update for HEAD-2003091401
[reactos.git] / lib / string / i386 / memset.s
1 /* 
2  * $Id$
3  */
4
5 /*
6  * void *memset (void *src, int val, size_t count)
7  */
8
9 .globl  _memset
10
11 _memset:
12         push    %ebp
13         mov     %esp,%ebp
14         push    %edi
15         mov     0x8(%ebp),%edi
16         movzb   0xc(%ebp),%eax
17         mov     0x10(%ebp),%ecx
18         cld
19         cmp     $16,%ecx
20         jb      .L1
21         mov     $0x01010101,%edx
22         mul     %edx
23         mov     %ecx,%edx
24         test    $3,%edi
25         je      .L2
26         mov     %edi,%ecx
27         and     $3,%ecx
28         sub     $5,%ecx
29         not     %ecx
30         sub     %ecx,%edx
31         rep     stosb
32         mov     %edx,%ecx
33 .L2:
34         shr     $2,%ecx
35         rep     stosl
36         mov     %edx,%ecx
37         and     $3,%ecx
38 .L1:    
39         test    %ecx,%ecx
40         je      .L3
41         rep     stosb
42 .L3:
43         pop     %edi
44         mov     0x8(%ebp),%eax
45         leave
46         ret
47