1 #------------------------------------------------------------------------------
3 # Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php.
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #------------------------------------------------------------------------------
24 ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
26 #------------------------------------------------------------------------------
29 # InternalMemCopyMem (
30 # IN VOID *Destination,
34 #------------------------------------------------------------------------------
35 ASM_PFX(InternalMemCopyMem):
38 movl 16(%esp), %esi # esi <- Source
39 movl 12(%esp), %edi # edi <- Destination
40 movl 20(%esp), %edx # edx <- Count
41 leal -1(%esi,%edx,), %eax # eax <- End of Source
44 cmpl %edi, %eax # Overlapped?
45 jae L_CopyBackward # Copy backward if overlapped
49 andl $15, %ecx # ecx + edi aligns on 16-byte boundary
53 subl %ecx, %edx # edx <- remaining bytes to copy
59 shrl $4, %ecx # ecx <- # of DQwords to copy
71 addl $16, %esp # stack cleanup
74 movl %eax, %esi # esi <- Last byte in Source
75 leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
82 movl 12(%esp), %eax # eax <- Destination as return value