]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / X64 / CopyMem.S
... / ...
CommitLineData
1#\r
2# ConvertAsm.py: Automatically generated from CopyMem.asm\r
3#\r
4#------------------------------------------------------------------------------\r
5#\r
6# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
7# 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
37ASM_GLOBAL ASM_PFX(InternalMemCopyMem)\r
38ASM_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 L0\r
47 cmpq %rdi, %r9\r
48 jae L_CopyBackward # Copy backward if overlapped\r
49L0:\r
50 movq %r8, %rcx \r
51 andq $7, %r8\r
52 shrq $3, %rcx # rcx <- # of Qwords to copy\r
53 jz L_CopyBytes\r
54 movd %mm0, %r10 # (Save mm0 in r10)\r
55L1:\r
56 movq (%rsi), %mm0\r
57 movntq %mm0, (%rdi)\r
58 addq $8, %rsi \r
59 addq $8, %rdi\r
60 loop L1\r
61 mfence\r
62 movd %r10, %mm0 # (Restore mm0)\r
63 jmp L_CopyBytes\r
64L_CopyBackward:\r
65 movq %r9, %rsi # rsi <- End of Source\r
66 leaq -1(%rdi, %r8,), %rdi # rdi <- End of Destination\r
67 std # set direction flag\r
68L_CopyBytes:\r
69 movq %r8, %rcx \r
70 rep movsb # Copy bytes backward\r
71 cld\r
72 popq %rdi\r
73 popq %rsi\r
74 ret\r