]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep4.asm
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / CompilerStub / Ia32 / memcpyRep4.asm
1 ;------------------------------------------------------------------------------
2 ;
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
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 ; memcpy function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .686
25 .model flat,C
26 .mmx
27 .code
28
29 ;------------------------------------------------------------------------------
30 ; VOID *
31 ; memcpy (
32 ; IN VOID *Destination,
33 ; IN VOID *Source,
34 ; IN UINTN Count
35 ; );
36 ;------------------------------------------------------------------------------
37 memcpy PROC USES esi edi
38 mov esi, [esp + 16] ; esi <- Source
39 mov edi, [esp + 12] ; edi <- Destination
40 mov edx, [esp + 20] ; edx <- Count
41 cmp esi, edi
42 je @CopyDone
43 cmp edx, 0
44 je @CopyDone
45 lea eax, [esi + edx - 1] ; eax <- End of Source
46 cmp esi, edi
47 jae @F
48 cmp eax, edi
49 jae @CopyBackward ; Copy backward if overlapped
50 @@:
51 mov ecx, edx
52 and edx, 3
53 shr ecx, 2
54 rep movsd ; Copy as many Dwords as possible
55 jmp @CopyBytes
56 @CopyBackward:
57 mov esi, eax ; esi <- End of Source
58 lea edi, [edi + edx - 1] ; edi <- End of Destination
59 std
60 @CopyBytes:
61 mov ecx, edx
62 rep movsb ; Copy bytes backward
63 cld
64 @CopyDone:
65 mov eax, [esp + 12]
66 ret
67
68 memcpy ENDP
69
70 END