26
27 .file "memset.s"
28
29 #include <sys/asm_linkage.h>
30
31 ANSI_PRAGMA_WEAK(memset,function)
32
33 ENTRY(memset)
34 pushl %edi / save register variable
35 movl 8(%esp),%edi / %edi = string address
36 movl 12(%esp),%eax / %al = byte to duplicate
37 movl 16(%esp),%ecx / %ecx = number of copies
38
39 / For all basic blocks in this routine, maintain the following
40 / entry conditions: %eax each byte is set to desired byte.
41 / NOTE: .byteset doesn't require this
42 / %ecx contains # bytes to set
43 / %edi contain address to set
44
45 cld / make sure we go the right way...
46 cmpl $20,%ecx / strings with fewer than 20 chars should be byte set
47 jbe .byteset
48
49 andl $0xff, %eax / trim anything above low byte
50 imul $0x01010101, %eax / extend low byte to each byte
51
52 cmpl $256, %ecx / smaller areas don't benefit from alignment
53 jbe .wordset
54
55 cmpl $511, %ecx / areas smaller than this should be wordset
56 jbe .check_wordset
57
58 /
59 / prep work for sse temporal and non-temporal
60 /
61
62 pushl %ebx / more registers are needed
63 pushl %esi / for alignment work
64
65 /
66 / align address to 64 byte boundaries.
|
26
27 .file "memset.s"
28
29 #include <sys/asm_linkage.h>
30
31 ANSI_PRAGMA_WEAK(memset,function)
32
33 ENTRY(memset)
34 pushl %edi / save register variable
35 movl 8(%esp),%edi / %edi = string address
36 movl 12(%esp),%eax / %al = byte to duplicate
37 movl 16(%esp),%ecx / %ecx = number of copies
38
39 / For all basic blocks in this routine, maintain the following
40 / entry conditions: %eax each byte is set to desired byte.
41 / NOTE: .byteset doesn't require this
42 / %ecx contains # bytes to set
43 / %edi contain address to set
44
45 cld / make sure we go the right way...
46 cmpl $20,%ecx / strings with fewer than 20 chars should be
47 / byte set
48 jbe .byteset
49
50 andl $0xff, %eax / trim anything above low byte
51 imul $0x01010101, %eax / extend low byte to each byte
52
53 cmpl $256, %ecx / smaller areas don't benefit from alignment
54 jbe .wordset
55
56 cmpl $511, %ecx / areas smaller than this should be wordset
57 jbe .check_wordset
58
59 /
60 / prep work for sse temporal and non-temporal
61 /
62
63 pushl %ebx / more registers are needed
64 pushl %esi / for alignment work
65
66 /
67 / align address to 64 byte boundaries.
|