mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
a7b6458434
commit
a8f1dcd7b7
|
@ -44,24 +44,32 @@ ASM_PFX(InternalMemCopyMem):
|
||||||
lea r9, [rsi + r8 - 1] # r9 <- End of Source
|
lea r9, [rsi + r8 - 1] # r9 <- End of Source
|
||||||
cmp rsi, rdi
|
cmp rsi, rdi
|
||||||
mov rax, rdi # rax <- Destination as return value
|
mov rax, rdi # rax <- Destination as return value
|
||||||
jae _InternalMemCopyMem_al_0000
|
jae L0
|
||||||
cmp r9, rdi
|
cmp r9, rdi
|
||||||
jae _atSym_CopyBackward # Copy backward if overlapped
|
jae L_CopyBackward # Copy backward if overlapped
|
||||||
_InternalMemCopyMem_al_0000:
|
L0:
|
||||||
mov rcx, r8
|
mov rcx, r8
|
||||||
and r8, 7
|
and r8, 7
|
||||||
shr rcx, 3
|
shr rcx, 3 # rcx <- # of Qwords to copy
|
||||||
rep movsq # Copy as many Qwords as possible
|
jz L_CopyBytes
|
||||||
jmp _atSym_CopyBytes
|
movd r10, mm0 # (Save mm0 in r10)
|
||||||
_atSym_CopyBackward:
|
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
|
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
|
std # set direction flag
|
||||||
_atSym_CopyBytes:
|
L_CopyBytes:
|
||||||
mov rcx, r8
|
mov rcx, r8
|
||||||
rep movsb # Copy bytes backward
|
rep movsb # Copy bytes backward
|
||||||
cld
|
cld
|
||||||
pop rdi
|
pop rdi
|
||||||
pop rsi
|
pop rsi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue