Rev 1408 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1408 | Rev 1627 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | # memcpy() Author: Kees J. Bot 2 Jan 1994 |
1 | /* memcpy() Author: Kees J. Bot */ |
- | 2 | /* 2 Jan 1994 */ |
|
Line 2... | Line 3... | ||
2 | 3 | ||
3 | # void *memcpy(void *s1, const void *s2, size_t n) |
4 | /* void *memcpy(void *s1, const void *s2, size_t n) */ |
4 | # Copy a chunk of memory. |
5 | /* Copy a chunk of memory. */ |
5 | # This routine need not handle overlap, so it does not handle overlap. |
6 | /* This routine need not handle overlap, so it does not handle overlap. */ |
6 | # One could simply call __memmove, the cost of the overlap check is |
7 | /* One could simply call __memmove, the cost of the overlap check is */ |
7 | # negligible, but you are dealing with a programmer who believes that |
8 | /* negligible, but you are dealing with a programmer who believes that if */ |
- | 9 | /* anything can go wrong, it should go wrong. */ |
|
- | 10 | /* */ |
|
Line 8... | Line -... | ||
8 | # if anything can go wrong, it should go wrong. |
- | |
9 | - | ||
10 | .intel_syntax |
- | |
11 | - | ||
12 | .globl _memcpy |
- | |
13 | - | ||
14 | .text |
- | |
15 | 11 | #include "asm.h" |
|
16 | .align 16 |
12 | |
17 | _memcpy: |
13 | ENTRY(memcpy) |
18 | push ebp |
14 | push %ebp |
19 | mov ebp, esp |
15 | movl %esp, %ebp |
20 | push esi |
16 | push %esi |
21 | push edi |
17 | push %edi |
22 | mov edi, [ebp+8] # String s1 |
18 | movl 8(%ebp), %edi /* String s1 */ |
23 | mov esi, [ebp+12] # String s2 |
19 | movl 12(%ebp), %esi /* String s2 */ |
24 | mov ecx, [ebp+16] # Length |
20 | movl 16(%ebp), %ecx /* Length */ |