Rev | Line | |
---|
[9] | 1 | ! memcpy() Author: Kees J. Bot
|
---|
| 2 | ! 2 Jan 1994
|
---|
| 3 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
| 4 |
|
---|
| 5 | ! void *memcpy(void *s1, const void *s2, size_t n)
|
---|
| 6 | ! Copy a chunk of memory.
|
---|
| 7 | ! This routine need not handle overlap, so it does not handle overlap.
|
---|
| 8 | ! One could simply call __memmove, the cost of the overlap check is
|
---|
| 9 | ! negligible, but you are dealing with a programmer who believes that
|
---|
| 10 | ! if anything can go wrong, it should go wrong.
|
---|
| 11 | !
|
---|
| 12 | .sect .text
|
---|
| 13 | .define _memcpy
|
---|
| 14 | .align 16
|
---|
| 15 | _memcpy:
|
---|
| 16 | push ebp
|
---|
| 17 | mov ebp, esp
|
---|
| 18 | push esi
|
---|
| 19 | push edi
|
---|
| 20 | mov edi, 8(ebp) ! String s1
|
---|
| 21 | mov esi, 12(ebp) ! String s2
|
---|
| 22 | mov ecx, 16(ebp) ! Length
|
---|
| 23 | ! No overlap check here
|
---|
| 24 | jmp __memcpy ! Call the part of __memmove that copies up
|
---|
Note:
See
TracBrowser
for help on using the repository browser.