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