summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-23 05:17:35 +0000
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-23 05:17:35 +0000
commita8f1dcd7b7fcbe1dc51f79bd4b346121e073ea72 (patch)
tree9fa61cc782d7d9b0286a9b32919065117ec9b022
parenta7b645843417cebf7443c393d7431acdfb6507b8 (diff)
downloadedk2-a8f1dcd7b7fcbe1dc51f79bd4b346121e073ea72.tar.gz
edk2-a8f1dcd7b7fcbe1dc51f79bd4b346121e073ea72.tar.bz2
edk2-a8f1dcd7b7fcbe1dc51f79bd4b346121e073ea72.zip
modify CopyMem.S to align with CopyMem.asm
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6191 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S28
1 files changed, 18 insertions, 10 deletions
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
index 3e7a396b5b..426a602286 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
+++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
@@ -44,24 +44,32 @@ ASM_PFX(InternalMemCopyMem):
lea r9, [rsi + r8 - 1] # r9 <- End of Source
cmp rsi, rdi
mov rax, rdi # rax <- Destination as return value
- jae _InternalMemCopyMem_al_0000
+ jae L0
cmp r9, rdi
- jae _atSym_CopyBackward # Copy backward if overlapped
-_InternalMemCopyMem_al_0000:
+ jae L_CopyBackward # Copy backward if overlapped
+L0:
mov rcx, r8
and r8, 7
- shr rcx, 3
- rep movsq # Copy as many Qwords as possible
- jmp _atSym_CopyBytes
-_atSym_CopyBackward:
+ shr rcx, 3 # rcx <- # of Qwords to copy
+ jz L_CopyBytes
+ movd r10, mm0 # (Save mm0 in r10)
+L1:
+ movq mm0, [rsi]
+ movntq [rdi], mm0
+ add rsi, 8
+ add rdi, 8
+ loop L1
+ mfence
+ movd mm0, r10 # (Restore mm0)
+ jmp L_CopyBytes
+L_CopyBackward:
mov rsi, r9 # rsi <- End of Source
- lea rdi, [rdi + r8 - 1] # esi <- End of Destination
+ lea rdi, [rdi + r8 - 1] # rdi <- End of Destination
std # set direction flag
-_atSym_CopyBytes:
+L_CopyBytes:
mov rcx, r8
rep movsb # Copy bytes backward
cld
pop rdi
pop rsi
ret
-