summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-28 07:28:19 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-28 07:28:19 +0000
commiteb227e96bd06a5b0f2f933187a679e7fb3382cd9 (patch)
treeb16e46f494d8d9d8552d8d0e882ad78019934071 /MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
parent27169a56e67556796ab0410c8917436dc9aa2abf (diff)
downloadedk2-platforms-eb227e96bd06a5b0f2f933187a679e7fb3382cd9.tar.xz
1. Updated function headers for all assembly function
2. Optimized register usage in SetMemXX functions in all lib instances 3. Fixed a logical error in CopyMem for all lib instances git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1139 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S')
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S32
1 files changed, 14 insertions, 18 deletions
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
index fff8bde5ea..d644b34675 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
+++ b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
@@ -21,32 +21,29 @@
#
#------------------------------------------------------------------------------
- .686:
- #.MODEL flat,C
- .xmm:
- .code:
+.global _InternalMemCopyMem
#------------------------------------------------------------------------------
# VOID *
-# _mem_CopyMem (
+# EFIAPI
+# InternalMemCopyMem (
# IN VOID *Destination,
# IN VOID *Source,
# IN UINTN Count
-# )
+# );
#------------------------------------------------------------------------------
-.global _InternalMemCopyMem
_InternalMemCopyMem:
push %esi
push %edi
movl 16(%esp), %esi # esi <- Source
movl 12(%esp), %edi # edi <- Destination
movl 20(%esp), %edx # edx <- Count
- leal -1(%edi,%edx,), %eax # eax <- End of Destination
+ leal -1(%esi,%edx,), %eax # eax <- End of Source
cmpl %edi, %esi
jae L0
- cmpl %esi, %eax # Overlapped?
+ cmpl %edi, %eax # Overlapped?
jae @CopyBackward # Copy backward if overlapped
-L0:
+L0:
xorl %ecx, %ecx
subl %esi, %ecx
andl $7, %ecx # ecx + esi aligns on 8-byte boundary
@@ -56,7 +53,7 @@ L0:
subl %ecx, %edx # edx <- remaining bytes to copy
rep
movsb
-L1:
+L1:
movl %edx, %ecx
andl $7, %edx
shrl $3, %ecx # ecx <- # of Qwords to copy
@@ -64,22 +61,21 @@ L1:
pushl %eax
pushl %eax
movq %mm0, (%esp) # save mm0
-L2:
+L2:
movq (%esi), %mm0
- movntq %mm0, (%edi)
+ movq %mm0, (%edi)
addl $8, %esi
addl $8, %edi
loop L2
- mfence
movq (%esp), %mm0 # restore mm0
popl %ecx # stack cleanup
popl %ecx # stack cleanup
jmp @CopyBytes
-@CopyBackward:
- movl %eax, %edi # edi <- Last byte in Destination
- leal -1(%esi,%edx,), %esi # esi <- Last byte in Source
+@CopyBackward:
+ movl %eax, %esi # esi <- Last byte in Source
+ leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
std
-@CopyBytes:
+@CopyBytes:
movl %edx, %ecx
rep
movsb