Merge branch 'linville-e1000' of git://git.tuxdriver.com/git/netdev-jwl
[linux-2.6] / arch / x86_64 / lib / memset.S
1 /* Copyright 2002 Andi Kleen, SuSE Labs */
2 /*
3  * ISO C memset - set a memory block to a byte value.
4  *      
5  * rdi   destination
6  * rsi   value (char) 
7  * rdx   count (bytes) 
8  * 
9  * rax   original destination
10  */     
11         .globl __memset
12         .globl memset
13         .p2align 4
14 memset: 
15 __memset:
16         movq %rdi,%r9
17         movl %edx,%r8d
18         andl $7,%r8d            
19         movl %edx,%ecx
20         shrl $3,%ecx            
21         /* expand byte value  */
22         movzbl %sil,%esi
23         movabs $0x0101010101010101,%rax
24         mulq   %rsi             /* with rax, clobbers rdx */
25         rep
26         stosq   
27         movl %r8d,%ecx
28         rep
29         stosb
30         movq %r9,%rax
31         ret