Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
memset.S
Package: linux-2.4.20.tar.gz [view]
Upload User: jlfgdled
Upload Date: 2013-04-10
Package Size: 33168k
Code Size: 1k
Category:
Linux-Unix program
Development Platform:
Unix_Linux
- /* Copyright 2002 Andi Kleen, SuSE Labs */
- /*
- * ISO C memset - set a memory block to a byte value.
- *
- * rdi destination
- * rsi value (char)
- * rdx count (bytes)
- *
- * rax original destination
- */
- .globl __memset
- .globl memset
- .p2align
- memset:
- __memset:
- movq %rdi,%r10
- movq %rdx,%r11
- /* expand byte value */
- movzbl %sil,%ecx
- movabs $0x0101010101010101,%rax
- mul %rcx /* with rax, clobbers rdx */
- /* align dst */
- movl %edi,%r9d
- andl $7,%r9d
- jnz bad_alignment
- after_bad_alignment:
- movq %r11,%rcx
- movl $64,%r8d
- shrq $6,%rcx
- jz handle_tail
- loop_64:
- movq %rax,(%rdi)
- movq %rax,8(%rdi)
- movq %rax,16(%rdi)
- movq %rax,24(%rdi)
- movq %rax,32(%rdi)
- movq %rax,40(%rdi)
- movq %rax,48(%rdi)
- movq %rax,56(%rdi)
- addq %r8,%rdi
- decl %ecx
- jnz loop_64
- /* Handle tail in loops. The loops should be faster than hard
- to predict jump tables. */
- handle_tail:
- movl %r11d,%ecx
- andl $63&(~7),%ecx
- jz handle_7
- shrl $3,%ecx
- loop_8:
- movq %rax,(%rdi)
- addq $8,%rdi
- decl %ecx
- jnz loop_8
- handle_7:
- movl %r11d,%ecx
- andl $7,%ecx
- jz ende
- loop_1:
- movb %al,(%rdi)
- addq $1,%rdi
- decl %ecx
- jnz loop_1
- ende:
- movq %r10,%rax
- ret
- bad_alignment:
- cmpq $7,%r11
- jbe handle_7
- movq %rax,(%rdi) /* unaligned store */
- movq $8,%r8
- subq %r9,%r8
- addq %r8,%rdi
- subq %r8,%r11
- jmp after_bad_alignment