2 // Include common header file for this module.
4 #include "CommonHeader.h"
6 #------------------------------------------------------------------------------
8 # Copyright (c) 2006, Intel Corporation
9 # All rights reserved. This program and the accompanying materials
10 # are licensed and made available under the terms and conditions of the BSD License
11 # which accompanies this distribution. The full text of the license may be found at
12 # http://opensource.org/licenses/bsd-license.php
14 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
27 #------------------------------------------------------------------------------
29 .globl _InternalMemCopyMem
31 #------------------------------------------------------------------------------
34 # InternalMemCopyMem (
35 # IN VOID *Destination,
39 #------------------------------------------------------------------------------
43 movl 16(%esp), %esi # esi <- Source
44 movl 12(%esp), %edi # edi <- Destination
45 movl 20(%esp), %edx # edx <- Count
46 leal -1(%esi,%edx,), %eax # eax <- End of Source
49 cmpl %edi, %eax # Overlapped?
50 jae L_CopyBackward # Copy backward if overlapped
54 andl $15, %ecx # ecx + edi aligns on 16-byte boundary
58 subl %ecx, %edx # edx <- remaining bytes to copy
64 shrl $4, %ecx # ecx <- # of DQwords to copy
76 addl $16, %esp # stack cleanup
79 movl %eax, %esi # esi <- Last byte in Source
80 leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
87 movl 12(%esp), %eax # eax <- Destination as return value