diff options
author | bxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-28 07:28:19 +0000 |
---|---|---|
committer | bxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-28 07:28:19 +0000 |
commit | eb227e96bd06a5b0f2f933187a679e7fb3382cd9 (patch) | |
tree | b16e46f494d8d9d8552d8d0e882ad78019934071 /MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm | |
parent | 27169a56e67556796ab0410c8917436dc9aa2abf (diff) | |
download | edk2-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/X64/CopyMem.asm')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm index 801cf92750..b57192edbe 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm @@ -23,42 +23,42 @@ .code
+;------------------------------------------------------------------------------
+; VOID *
+; EFIAPI
+; InternalMemCopyMem (
+; OUT VOID *DestinationBuffer,
+; IN CONST VOID *SourceBuffer,
+; IN UINTN Length
+; );
+;------------------------------------------------------------------------------
InternalMemCopyMem PROC USES rsi rdi
mov rsi, rdx ; rsi <- Source
mov rdi, rcx ; rdi <- Destination
- lea r9, [rdi + r8 - 1] ; r9 <- End of Destination
+ lea r9, [rsi + r8 - 1] ; r9 <- End of Source
cmp rsi, rdi
mov rax, rdi ; rax <- Destination as return value
jae @F
- cmp r9, rsi
+ cmp r9, rdi
jae @CopyBackward ; Copy backward if overlapped
@@:
- xor rcx, rcx
- sub rcx, rsi
- and rcx, 7 ; rcx + rsi aligns on 8-byte boundary
- jz @F
- cmp rcx, r8
- cmova rcx, r8
- sub r8, rcx ; r8 <- remaining bytes to copy
- rep movsb
-@@:
mov rcx, r8
and r8, 7
shr rcx, 3 ; rcx <- # of Qwords to copy
jz @CopyBytes
- DB 49h, 0fh, 7eh, 0c2h ; movq r10, mm0 ; save mm0
+ DB 49h, 0fh, 7eh, 0c2h ; movd r10, mm0 (Save mm0 in r10)
@@:
- DB 48h, 0fh, 6fh, 06h ; movq mm0, [rsi]
- DB 48h, 0fh, 0e7h, 07h ; movntq [rdi], mm0
+ DB 0fh, 6fh, 06h ; movd mm0, [rsi]
+ DB 0fh, 0e7h, 07h ; movntq [rdi], mm0
add rsi, 8
add rdi, 8
loop @B
mfence
- DB 49h, 0fh, 6eh, 0c2h ; movq mm0, r10 ; restore mm0
+ DB 49h, 0fh, 6eh, 0c2h ; movd mm0, r10 (Restore mm0)
jmp @CopyBytes
@CopyBackward:
- mov rdi, r9 ; rdi <- End of Destination
- lea rsi, [rsi + r8 - 1] ; rsi <- End of Source
+ mov rsi, r9 ; rsi <- End of Source
+ lea rdi, [rdi + r8 - 1] ; rdi <- End of Destination
std ; set direction flag
@CopyBytes:
mov rcx, r8
|