]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CopyMem.S
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseMemoryLib / Ia32 / CopyMem.S
CommitLineData
b341712e 1#------------------------------------------------------------------------------\r
2#\r
2c7e5c2f
HT
3# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4# This program and the accompanying materials\r
b341712e 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# CopyMem.Asm\r
15#\r
16# Abstract:\r
17#\r
18# CopyMem function\r
19#\r
20# Notes:\r
21#\r
22#------------------------------------------------------------------------------\r
23#include <EdkIIGlueBase.h>\r
24.globl ASM_PFX(InternalMemCopyMem)\r
25\r
26#------------------------------------------------------------------------------\r
27# VOID *\r
28# EFIAPI\r
29# InternalMemCopyMem (\r
30# IN VOID *Destination,\r
31# IN VOID *Source,\r
32# IN UINTN Count\r
33# );\r
34#------------------------------------------------------------------------------\r
35ASM_PFX(InternalMemCopyMem):\r
36 push %esi\r
37 push %edi\r
38 movl 16(%esp), %esi # esi <- Source\r
39 movl 12(%esp), %edi # edi <- Destination\r
40 movl 20(%esp), %edx # edx <- Count\r
41 leal -1(%esi, %edx), %eax # eax <- End of Source\r
42 cmpl %edi, %esi\r
43 jae L0\r
44 cmpl %edi, %eax\r
45 jae L_CopyBackward # Copy backward if overlapped\r
46L0:\r
47 movl %edx, %ecx\r
48 andl $3, %edx\r
49 shrl $2, %ecx\r
50 rep\r
51 movsl # Copy as many Dwords as possible\r
52 jmp L_CopyBytes\r
53L_CopyBackward:\r
54 movl %eax, %esi # esi <- End of Source\r
55 leal -1(%edi, %edx), %edi # edi <- End of Destination\r
56 std\r
57L_CopyBytes:\r
58 movl %edx, %ecx\r
59 rep\r
60 movsb # Copy bytes backward\r
61 cld\r
62 movl 12(%esp), %eax # eax <- Destination as return value\r
63 pop %edi\r
64 pop %esi\r
65 ret\r