2008-11-03 10:25:10 +01:00
|
|
|
#
|
|
|
|
# ConvertAsm.py: Automatically generated from CopyMem.asm
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
#
|
2018-06-27 15:11:33 +02:00
|
|
|
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
2010-04-23 18:08:36 +02:00
|
|
|
# This program and the accompanying materials
|
2008-11-03 10:25:10 +01:00
|
|
|
# are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
# which accompanies this distribution. The full text of the license may be found at
|
2010-06-25 23:56:02 +02:00
|
|
|
# http://opensource.org/licenses/bsd-license.php.
|
2008-11-03 10:25:10 +01:00
|
|
|
#
|
|
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
#
|
|
|
|
# Module Name:
|
|
|
|
#
|
|
|
|
# CopyMem.S
|
|
|
|
#
|
|
|
|
# Abstract:
|
|
|
|
#
|
|
|
|
# CopyMem function
|
|
|
|
#
|
|
|
|
# Notes:
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# VOID *
|
|
|
|
# EFIAPI
|
|
|
|
# InternalMemCopyMem (
|
|
|
|
# IN VOID *Destination,
|
|
|
|
# IN VOID *Source,
|
|
|
|
# IN UINTN Count
|
|
|
|
# )
|
|
|
|
#------------------------------------------------------------------------------
|
2009-05-20 12:22:09 +02:00
|
|
|
ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
|
2008-11-03 10:25:10 +01:00
|
|
|
ASM_PFX(InternalMemCopyMem):
|
2009-08-11 17:32:16 +02:00
|
|
|
pushq %rsi
|
|
|
|
pushq %rdi
|
|
|
|
movq %rdx, %rsi # rsi <- Source
|
|
|
|
movq %rcx, %rdi # rdi <- Destination
|
2018-06-27 15:11:33 +02:00
|
|
|
leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
|
|
|
|
cmpq %rdi, %rsi
|
2009-08-11 17:32:16 +02:00
|
|
|
movq %rdi, %rax # rax <- Destination as return value
|
2008-11-03 10:25:10 +01:00
|
|
|
jae L0
|
2009-08-11 17:32:16 +02:00
|
|
|
cmpq %rdi, %r9
|
2008-11-03 10:25:10 +01:00
|
|
|
jae L_CopyBackward # Copy backward if overlapped
|
|
|
|
L0:
|
2018-06-27 15:11:33 +02:00
|
|
|
movq %r8, %rcx
|
2009-08-11 17:32:16 +02:00
|
|
|
andq $7, %r8
|
|
|
|
shrq $3, %rcx # rcx <- # of Qwords to copy
|
2008-11-03 10:25:10 +01:00
|
|
|
jz L_CopyBytes
|
2009-08-12 04:23:31 +02:00
|
|
|
movd %mm0, %r10 # (Save mm0 in r10)
|
2008-11-03 10:25:10 +01:00
|
|
|
L1:
|
2009-08-11 17:32:16 +02:00
|
|
|
movq (%rsi), %mm0
|
|
|
|
movntq %mm0, (%rdi)
|
2018-06-27 15:11:33 +02:00
|
|
|
addq $8, %rsi
|
2009-08-11 17:32:16 +02:00
|
|
|
addq $8, %rdi
|
2008-11-03 10:25:10 +01:00
|
|
|
loop L1
|
|
|
|
mfence
|
2009-08-11 17:32:16 +02:00
|
|
|
movd %r10, %mm0 # (Restore mm0)
|
2008-11-03 10:25:10 +01:00
|
|
|
jmp L_CopyBytes
|
|
|
|
L_CopyBackward:
|
2009-08-11 17:32:16 +02:00
|
|
|
movq %r9, %rsi # rsi <- End of Source
|
|
|
|
leaq -1(%rdi, %r8,), %rdi # rdi <- End of Destination
|
2008-11-03 10:25:10 +01:00
|
|
|
std # set direction flag
|
|
|
|
L_CopyBytes:
|
2018-06-27 15:11:33 +02:00
|
|
|
movq %r8, %rcx
|
2008-11-03 10:25:10 +01:00
|
|
|
rep movsb # Copy bytes backward
|
|
|
|
cld
|
2009-08-11 17:32:16 +02:00
|
|
|
popq %rdi
|
|
|
|
popq %rsi
|
2008-11-03 10:25:10 +01:00
|
|
|
ret
|