]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / Ia32 / CopyMem.S
CommitLineData
c5ecf6c1 1#------------------------------------------------------------------------------\r
2#\r
085c3968
HT
3# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4# This program and the accompanying materials\r
c5ecf6c1 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\r
132f41f0 24ASM_GLOBAL ASM_PFX(InternalMemCopyMem)\r
c5ecf6c1 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
d3c0cbce 35ASM_PFX(InternalMemCopyMem):\r
c5ecf6c1 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 # Overlapped?\r
45 jae L_CopyBackward # Copy backward if overlapped\r
46L0:\r
47 xorl %ecx, %ecx\r
48 subl %esi, %ecx\r
49 andl $7, %ecx # ecx + esi aligns on 8-byte boundary\r
50 jz L1\r
51 cmpl %edx, %ecx\r
52 cmova %edx, %ecx\r
53 subl %ecx, %edx # edx <- remaining bytes to copy\r
54 rep\r
55 movsb\r
56L1:\r
57 movl %edx, %ecx\r
58 andl $7, %edx\r
59 shrl $3, %ecx # ecx <- # of Qwords to copy\r
60 jz L_CopyBytes\r
61 pushl %eax\r
62 pushl %eax\r
63 movq %mm0, (%esp) # save mm0\r
64L2:\r
65 movq (%esi), %mm0\r
66 movq %mm0, (%edi)\r
67 addl $8, %esi\r
68 addl $8, %edi\r
69 loop L2\r
70 movq (%esp), %mm0 # restore mm0\r
71 popl %ecx # stack cleanup\r
72 popl %ecx # stack cleanup\r
73 jmp L_CopyBytes\r
74L_CopyBackward:\r
75 movl %eax, %esi # esi <- Last byte in Source\r
76 leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination\r
77 std\r
78L_CopyBytes:\r
79 movl %edx, %ecx\r
80 rep\r
81 movsb\r
82 cld\r
83 movl 12(%esp), %eax\r
84 pop %edi\r
85 pop %esi\r
86 ret\r