3 ;Copyright (c) 2007, 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.
18 ; This is the code that uses rep movsb CopyMem service
22 ;---------------------------------------------------------------------------
27 ;---------------------------------------------------------------------------
31 ;EfiCommonLibCopyMem (
32 ; IN VOID *Destination,
40 ; Copy Length bytes from Source to Destination.
44 ; Destination - Target of copy
46 ; Source - Place to copy from
48 ; Length - Number of bytes to copy
55 EfiCommonLibCopyMem PROC
60 mov esi, dword ptr[ebp + 0Ch] ; esi <- Source
61 mov edi, dword ptr[ebp + 8] ; edi <- Destination
62 mov edx, dword ptr[ebp + 10h] ; edx <- Count
67 lea eax, [esi + edx - 1] ; eax <- End of Source
71 jb _CopyBytes ; Copy backward if overlapped
72 mov esi, eax ; esi <- End of Source
73 lea edi, [edi + edx - 1] ; edi <- End of Destination
77 rep movsb ; Copy bytes backward
84 EfiCommonLibCopyMem ENDP