]>
Commit | Line | Data |
---|---|---|
b1ff428c | 1 | #\r |
2 | # ConvertAsm.py: Automatically generated from CopyMem.asm\r | |
3 | #\r | |
4 | #------------------------------------------------------------------------------\r | |
5 | #\r | |
373ade0e | 6 | # Copyright (c) 2006 - 2008, Intel Corporation\r |
b1ff428c | 7 | # All rights reserved. This program and the accompanying materials\r |
8 | # are licensed and made available under the terms and conditions of the BSD License\r | |
9 | # which accompanies this distribution. The full text of the license may be found at\r | |
10 | # http://opensource.org/licenses/bsd-license.php\r | |
11 | #\r | |
12 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | #\r | |
15 | # Module Name:\r | |
16 | #\r | |
17 | # CopyMem.S\r | |
18 | #\r | |
19 | # Abstract:\r | |
20 | #\r | |
21 | # CopyMem function\r | |
22 | #\r | |
23 | # Notes:\r | |
24 | #\r | |
25 | #------------------------------------------------------------------------------\r | |
26 | \r | |
27 | \r | |
28 | #------------------------------------------------------------------------------\r | |
29 | # VOID *\r | |
30 | # EFIAPI\r | |
31 | # InternalMemCopyMem (\r | |
32 | # IN VOID *Destination,\r | |
33 | # IN VOID *Source,\r | |
34 | # IN UINTN Count\r | |
35 | # )\r | |
36 | #------------------------------------------------------------------------------\r | |
37 | .intel_syntax noprefix\r | |
38 | .globl ASM_PFX(InternalMemCopyMem)\r | |
39 | ASM_PFX(InternalMemCopyMem):\r | |
40 | push rsi\r | |
41 | push rdi\r | |
42 | mov rsi, rdx # rsi <- Source\r | |
43 | mov rdi, rcx # rdi <- Destination\r | |
44 | lea r9, [rsi + r8 - 1] # r9 <- End of Source\r | |
45 | cmp rsi, rdi\r | |
46 | mov rax, rdi # rax <- Destination as return value\r | |
47 | jae _InternalMemCopyMem_al_0000\r | |
48 | cmp r9, rdi\r | |
49 | jae _atSym_CopyBackward # Copy backward if overlapped\r | |
50 | _InternalMemCopyMem_al_0000:\r | |
51 | mov rcx, r8\r | |
52 | and r8, 7\r | |
53 | shr rcx, 3\r | |
54 | rep movsq # Copy as many Qwords as possible\r | |
55 | jmp _atSym_CopyBytes\r | |
56 | _atSym_CopyBackward:\r | |
57 | mov rsi, r9 # rsi <- End of Source\r | |
58 | lea rdi, [rdi + r8 - 1] # esi <- End of Destination\r | |
59 | std # set direction flag\r | |
60 | _atSym_CopyBytes:\r | |
61 | mov rcx, r8\r | |
62 | rep movsb # Copy bytes backward\r | |
63 | cld\r | |
64 | pop rdi\r | |
65 | pop rsi\r | |
66 | ret\r | |
67 | \r |