]>
Commit | Line | Data |
---|---|---|
1 | #\r | |
2 | # ConvertAsm.py: Automatically generated from CopyMem.asm\r | |
3 | #\r | |
4 | #------------------------------------------------------------------------------\r | |
5 | #\r | |
6 | # Copyright (c) 2006 - 2009, Intel Corporation\r | |
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 | ASM_GLOBAL ASM_PFX(InternalMemCopyMem)\r | |
38 | ASM_PFX(InternalMemCopyMem):\r | |
39 | pushq %rsi\r | |
40 | pushq %rdi\r | |
41 | movq %rdx, %rsi # rsi <- Source\r | |
42 | movq %rcx, %rdi # rdi <- Destination\r | |
43 | leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source\r | |
44 | cmpq %rdi, %rsi\r | |
45 | movq %rdi, %rax # rax <- Destination as return value\r | |
46 | jae _InternalMemCopyMem_al_0000\r | |
47 | cmpq %rdi, %r9\r | |
48 | jae _atSym_CopyBackward # Copy backward if overlapped\r | |
49 | _InternalMemCopyMem_al_0000:\r | |
50 | movq %r8, %rcx\r | |
51 | andq $7, %r8\r | |
52 | shrq $3, %rcx\r | |
53 | rep movsq # Copy as many Qwords as possible\r | |
54 | jmp _atSym_CopyBytes\r | |
55 | _atSym_CopyBackward:\r | |
56 | movq %r9, %rsi # rsi <- End of Source\r | |
57 | leaq -1(%rdi, %r8), %rdi # rdi <- End of Destination\r | |
58 | std # set direction flag\r | |
59 | _atSym_CopyBytes:\r | |
60 | movq %r8, %rcx\r | |
61 | rep movsb # Copy bytes backward\r | |
62 | cld\r | |
63 | popq %rdi\r | |
64 | popq %rsi\r | |
65 | ret\r | |
66 | \r |