]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.asm
Prepend underscores to procedure identifiers.
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibRepStr / Ia32 / CopyMem.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006, Intel Corporation
4 ; All rights reserved. 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
8 ;
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.
11 ;
12 ; Module Name:
13 ;
14 ; CopyMem.Asm
15 ;
16 ; Abstract:
17 ;
18 ; CopyMem function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .386
25 .model flat,C
26 .code
27
28 InternalMemCopyMem PROC USES esi edi
29 mov esi, [esp + 16] ; esi <- Source
30 mov edi, [esp + 12] ; edi <- Destination
31 mov edx, [esp + 20] ; edx <- Count
32 lea eax, [edi + edx - 1] ; eax <- End of Destination
33 cmp esi, edi
34 jae @F
35 cmp eax, esi
36 jae @CopyBackward ; Copy backward if overlapped
37 @@:
38 mov ecx, edx
39 and edx, 3
40 shr ecx, 2
41 rep movsd ; Copy as many Dwords as possible
42 jmp @CopyBytes
43 @CopyBackward:
44 mov edi, eax ; edi <- End of Destination
45 lea esi, [esi + edx - 1] ; esi <- End of Source
46 std
47 @CopyBytes:
48 mov ecx, edx
49 rep movsb ; Copy bytes backward
50 cld
51 mov eax, [esp + 12] ; eax <- Destination as return value
52 ret
53 InternalMemCopyMem ENDP
54
55 END