+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- EfiCopyMemRep1.c\r
-\r
-Abstract:\r
-\r
- This is the code that uses rep movsb CopyMem service\r
-\r
---*/\r
-\r
-#include "Tiano.h"\r
-\r
-VOID\r
-EfiCommonLibCopyMem (\r
- IN VOID *Destination,\r
- IN VOID *Source,\r
- IN UINTN Count\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Copy Length bytes from Source to Destination.\r
-\r
-Arguments:\r
-\r
- Destination - Target of copy\r
-\r
- Source - Place to copy from\r
-\r
- Length - Number of bytes to copy\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-{\r
- __asm {\r
- mov esi, Source ; esi <- Source\r
- mov edi, Destination ; edi <- Destination\r
- mov edx, Count ; edx <- Count\r
- cmp esi, edi\r
- je _CopyDone\r
- cmp edx, 0\r
- je _CopyDone\r
- lea eax, [esi + edx - 1] ; eax <- End of Source\r
- cmp esi, edi\r
- jae _CopyBytes\r
- cmp eax, edi\r
- jb _CopyBytes ; Copy backward if overlapped\r
- mov esi, eax ; esi <- End of Source\r
- lea edi, [edi + edx - 1] ; edi <- End of Destination\r
- std\r
-_CopyBytes:\r
- mov ecx, edx\r
- rep movsb ; Copy bytes backward\r
- cld\r
-_CopyDone:\r
- }\r
-}\r
-\r