]>
Commit | Line | Data |
---|---|---|
c1ea912c | 1 | ;/*++\r |
2 | ;\r | |
4ea9375a HT |
3 | ;Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r |
4 | ;This program and the accompanying materials \r | |
c1ea912c | 5 | ;are licensed and made available under the terms and conditions of the BSD License \r |
6 | ;which accompanies this distribution. The full text of the license may be found at \r | |
7 | ;http://opensource.org/licenses/bsd-license.php \r | |
8 | ; \r | |
9 | ;THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | ;WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | ;\r | |
12 | ;Module Name:\r | |
13 | ;\r | |
14 | ; EfiCopyMemRep1.asm\r | |
15 | ;\r | |
16 | ;Abstract:\r | |
17 | ;\r | |
18 | ; This is the code that uses rep movsb CopyMem service\r | |
19 | ;\r | |
20 | ;--*/\r | |
21 | ;\r | |
22 | ;---------------------------------------------------------------------------\r | |
23 | .686\r | |
24 | .model flat,C\r | |
25 | .code\r | |
26 | \r | |
27 | ;---------------------------------------------------------------------------\r | |
28 | ;#include "Tiano.h"\r | |
29 | ;\r | |
30 | ;VOID\r | |
31 | ;EfiCommonLibCopyMem (\r | |
32 | ; IN VOID *Destination,\r | |
33 | ; IN VOID *Source,\r | |
34 | ; IN UINTN Count\r | |
35 | ; )\r | |
36 | ;/*++\r | |
37 | ;\r | |
38 | ;Routine Description:\r | |
39 | ;\r | |
40 | ; Copy Length bytes from Source to Destination.\r | |
41 | ;\r | |
42 | ;Arguments:\r | |
43 | ;\r | |
44 | ; Destination - Target of copy\r | |
45 | ;\r | |
46 | ; Source - Place to copy from\r | |
47 | ;\r | |
48 | ; Length - Number of bytes to copy\r | |
49 | ;\r | |
50 | ;Returns:\r | |
51 | ;\r | |
52 | ; None\r | |
53 | ;\r | |
54 | ;--*/\r | |
55 | EfiCommonLibCopyMem PROC\r | |
56 | push ebp\r | |
57 | mov ebp, esp\r | |
58 | push esi\r | |
59 | push edi\r | |
60 | mov esi, dword ptr[ebp + 0Ch] ; esi <- Source\r | |
61 | mov edi, dword ptr[ebp + 8] ; edi <- Destination\r | |
62 | mov edx, dword ptr[ebp + 10h] ; edx <- Count\r | |
63 | cmp esi, edi\r | |
64 | je _CopyDone\r | |
65 | cmp edx, 0\r | |
66 | je _CopyDone\r | |
67 | lea eax, [esi + edx - 1] ; eax <- End of Source\r | |
68 | cmp esi, edi\r | |
69 | jae _CopyBytes\r | |
70 | cmp eax, edi\r | |
71 | jb _CopyBytes ; Copy backward if overlapped\r | |
72 | mov esi, eax ; esi <- End of Source\r | |
73 | lea edi, [edi + edx - 1] ; edi <- End of Destination\r | |
74 | std\r | |
75 | _CopyBytes:\r | |
76 | mov ecx, edx\r | |
77 | rep movsb ; Copy bytes backward\r | |
78 | cld\r | |
79 | _CopyDone:\r | |
80 | pop edi\r | |
81 | pop esi\r | |
82 | pop ebp\r | |
83 | ret\r | |
84 | EfiCommonLibCopyMem ENDP\r | |
85 | END\r | |
86 | \r |