diff options
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S index 6f19826956..5621f7ee5b 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S @@ -21,7 +21,7 @@ # #------------------------------------------------------------------------------ -.globl _InternalMemCopyMem +.globl ASM_PFX(InternalMemCopyMem) #------------------------------------------------------------------------------ # VOID * @@ -32,30 +32,30 @@ # IN UINTN Count # ); #------------------------------------------------------------------------------ -_InternalMemCopyMem: +ASM_PFX(InternalMemCopyMem): push %esi push %edi movl 16(%esp), %esi # esi <- Source movl 12(%esp), %edi # edi <- Destination movl 20(%esp), %edx # edx <- Count - cmpl %esi, %edi
- je L_CopyDone
+ cmpl %esi, %edi + je L_CopyDone cmpl $0, %edx - je L_CopyDone
+ je L_CopyDone leal -1(%esi, %edx), %eax # eax <- End of Source - cmpl %esi, %edi
- jae L_CopyBytes
- cmpl %eax, %edi
- jb L_CopyBytes # Copy backward if overlapped
- movl %esi, %eax # esi <- End of Source
+ cmpl %edi, %esi + jae L_CopyBytes + cmpl %edi, %eax + jb L_CopyBytes # Copy backward if overlapped + movl %eax, %esi # esi <- End of Source leal -1(%edi, %edx), %edi # edi <- End of Destination - std
-L_CopyBytes:
- movl %ecx, %edx
+ std +L_CopyBytes: + movl %edx, %ecx rep movsb # Copy bytes backward cld -L_CopyDone:
+L_CopyDone: movl 12(%esp), %eax # eax <- Destination as return value pop %edi pop %esi |