Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1626 → Rev 1627

/drivers/ddk/string/memcpy.S
1,26 → 1,22
# memcpy() Author: Kees J. Bot 2 Jan 1994
/* memcpy() Author: Kees J. Bot */
/* 2 Jan 1994 */
 
# void *memcpy(void *s1, const void *s2, size_t n)
# Copy a chunk of memory.
# This routine need not handle overlap, so it does not handle overlap.
# One could simply call __memmove, the cost of the overlap check is
# negligible, but you are dealing with a programmer who believes that
# if anything can go wrong, it should go wrong.
/* void *memcpy(void *s1, const void *s2, size_t n) */
/* Copy a chunk of memory. */
/* This routine need not handle overlap, so it does not handle overlap. */
/* One could simply call __memmove, the cost of the overlap check is */
/* negligible, but you are dealing with a programmer who believes that if */
/* anything can go wrong, it should go wrong. */
/* */
#include "asm.h"
 
.intel_syntax
 
.globl _memcpy
 
.text
 
.align 16
_memcpy:
push ebp
mov ebp, esp
push esi
push edi
mov edi, [ebp+8] # String s1
mov esi, [ebp+12] # String s2
mov ecx, [ebp+16] # Length
# No overlap check here
jmp __memcpy # Call the part of __memmove that copies up
ENTRY(memcpy)
push %ebp
movl %esp, %ebp
push %esi
push %edi
movl 8(%ebp), %edi /* String s1 */
movl 12(%ebp), %esi /* String s2 */
movl 16(%ebp), %ecx /* Length */
/* No overlap check here */
jmp _C_LABEL(_memcpy) /* Call the part of __memmove that copies up */