]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep4.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / Ia32 / EfiCopyMemRep4.c
CommitLineData
c7f33ca4 1/*++\r
2\r
4ea9375a
HT
3Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
c7f33ca4 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 EfiCopyMemRep4.c\r
15\r
16Abstract:\r
17\r
18 This is the code that uses rep movsd CopyMem service\r
19\r
20--*/\r
21\r
22#include "Tiano.h"\r
23\r
24VOID\r
25EfiCommonLibCopyMem (\r
26 IN VOID *Destination,\r
27 IN VOID *Source,\r
28 IN UINTN Count\r
29 )\r
30/*++\r
31\r
32Routine Description:\r
33\r
34 Copy Length bytes from Source to Destination.\r
35\r
36Arguments:\r
37\r
38 Destination - Target of copy\r
39\r
40 Source - Place to copy from\r
41\r
42 Length - Number of bytes to copy\r
43\r
44Returns:\r
45\r
46 None\r
47\r
48--*/\r
49{\r
50 __asm {\r
51 mov esi, Source ; esi <- Source\r
52 mov edi, Destination ; edi <- Destination\r
53 mov edx, Count ; edx <- Count\r
54 cmp esi, edi\r
55 je _CopyDone\r
56 cmp edx, 0\r
57 je _CopyDone\r
58 lea eax, [esi + edx - 1] ; eax <- End of Source\r
59 cmp esi, edi\r
60 jae _CopyDWord\r
61 cmp eax, edi\r
62 jae _CopyBackward ; Copy backward if overlapped\r
63_CopyDWord:\r
64 mov ecx, edx\r
65 and edx, 3\r
66 shr ecx, 2\r
67 rep movsd ; Copy as many Dwords as possible\r
68 jmp _CopyBytes\r
69_CopyBackward:\r
70 mov esi, eax ; esi <- End of Source\r
71 lea edi, [edi + edx - 1] ; edi <- End of Destination\r
72 std\r
73_CopyBytes:\r
74 mov ecx, edx\r
75 rep movsb ; Copy bytes backward\r
76 cld\r
77_CopyDone:\r
78 }\r
7ccf38a3 79}\r