clean up all of eight BaseMemoryLib instances in MdePkg with the following updates:
1. Remove .intel_syntax directives in GCC assembly files. All these assembly files have been updated to use the preferred syntax for GAS 2. Correct the incorrect comments for internal worker functions for SetMemXX() and ScanMemXX(). The Length parameter is actually the counter of 16-bit, 32-bit or 64-bit value. 3. Simplify the logic in ZeroMemoryWrapper.c for BaseMemoryLibOptPei instance to remove the conditional statement for zero length. This logic is already covered by worker function InternalMemZeroMem(). 4. Cleanup all the Wrapper C files in BaseMemoryLib instances. They are supposed to be shared by all these 8 BaseMemoryLib instances, but are out-of-sync after some maintenance. This patch re-syncs them and makes them exactly the same. 5. Cleanup MemLibInternal.h so that it is shared by 6 BaseMemoryLib instance except for PeiMemoryLib and UefiMemoryLib. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9041 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -8,10 +8,8 @@
|
||||
BaseMemoryLibRepStr
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
@@ -34,8 +32,8 @@
|
||||
Copy Length bytes from Source to Destination.
|
||||
|
||||
@param DestinationBuffer Target of copy
|
||||
@param SourceBuffer Place to copy from
|
||||
@param Length Number of bytes to copy
|
||||
@param SourceBuffer Place to copy from
|
||||
@param Length Number of bytes to copy
|
||||
|
||||
@return Destination
|
||||
|
||||
@@ -51,9 +49,9 @@ InternalMemCopyMem (
|
||||
/**
|
||||
Set Buffer to Value for Size bytes.
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Value Value of the set operation.
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer
|
||||
|
||||
@@ -70,7 +68,7 @@ InternalMemSetMem (
|
||||
Fills a target buffer with a 16-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Length Count of 16-bit value to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
@@ -88,7 +86,7 @@ InternalMemSetMem16 (
|
||||
Fills a target buffer with a 32-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Length Count of 32-bit value to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
@@ -106,7 +104,7 @@ InternalMemSetMem32 (
|
||||
Fills a target buffer with a 64-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Length Count of 64-bit value to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
@@ -162,7 +160,7 @@ InternalMemCompareMem (
|
||||
matching 8-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Length Count of 8-bit value to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
@@ -181,7 +179,7 @@ InternalMemScanMem8 (
|
||||
matching 16-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Length Count of 16-bit value to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
@@ -200,7 +198,7 @@ InternalMemScanMem16 (
|
||||
matching 32-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Length Count of 32-bit value to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
@@ -219,7 +217,7 @@ InternalMemScanMem32 (
|
||||
matching 64-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Length Count of 64-bit value to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -9,9 +9,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -9,9 +9,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -9,9 +9,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -9,9 +9,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -42,19 +42,18 @@
|
||||
# IN UINTN Length
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
|
||||
ASM_PFX(InternalMemCompareMem):
|
||||
push rsi
|
||||
push rdi
|
||||
mov rsi, rcx
|
||||
mov rdi, rdx
|
||||
mov rcx, r8
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
movq %rcx, %rsi
|
||||
movq %rdx, %rdi
|
||||
movq %r8, %rcx
|
||||
repe cmpsb
|
||||
movzx rax, byte ptr [rsi - 1]
|
||||
movzx rdx, byte ptr [rdi - 1]
|
||||
sub rax, rdx
|
||||
pop rdi
|
||||
pop rsi
|
||||
movzbq -1(%rsi), %rax
|
||||
movzbq -1(%rdi), %rdx
|
||||
subq %rdx, %rax
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -34,42 +34,41 @@
|
||||
# IN UINTN Count
|
||||
# )
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
|
||||
ASM_PFX(InternalMemCopyMem):
|
||||
push rsi
|
||||
push rdi
|
||||
mov rsi, rdx # rsi <- Source
|
||||
mov rdi, rcx # rdi <- Destination
|
||||
lea r9, [rsi + r8 - 1] # r9 <- End of Source
|
||||
cmp rsi, rdi
|
||||
mov rax, rdi # rax <- Destination as return value
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
movq %rdx, %rsi # rsi <- Source
|
||||
movq %rcx, %rdi # rdi <- Destination
|
||||
leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
|
||||
cmpq %rdi, %rsi
|
||||
movq %rdi, %rax # rax <- Destination as return value
|
||||
jae L0
|
||||
cmp r9, rdi
|
||||
cmpq %rdi, %r9
|
||||
jae L_CopyBackward # Copy backward if overlapped
|
||||
L0:
|
||||
mov rcx, r8
|
||||
and r8, 7
|
||||
shr rcx, 3 # rcx <- # of Qwords to copy
|
||||
movq %r8, %rcx
|
||||
andq $7, %r8
|
||||
shrq $3, %rcx # rcx <- # of Qwords to copy
|
||||
jz L_CopyBytes
|
||||
movd r10, mm0 # (Save mm0 in r10)
|
||||
movq %mm0, %r10 # (Save mm0 in r10) ; Why just save 32 bits?
|
||||
L1:
|
||||
movq mm0, [rsi]
|
||||
movntq [rdi], mm0
|
||||
add rsi, 8
|
||||
add rdi, 8
|
||||
movq (%rsi), %mm0
|
||||
movntq %mm0, (%rdi)
|
||||
addq $8, %rsi
|
||||
addq $8, %rdi
|
||||
loop L1
|
||||
mfence
|
||||
movd mm0, r10 # (Restore mm0)
|
||||
movd %r10, %mm0 # (Restore mm0)
|
||||
jmp L_CopyBytes
|
||||
L_CopyBackward:
|
||||
mov rsi, r9 # rsi <- End of Source
|
||||
lea rdi, [rdi + r8 - 1] # rdi <- End of Destination
|
||||
movq %r9, %rsi # rsi <- End of Source
|
||||
leaq -1(%rdi, %r8,), %rdi # rdi <- End of Destination
|
||||
std # set direction flag
|
||||
L_CopyBytes:
|
||||
mov rcx, r8
|
||||
movq %r8, %rcx
|
||||
rep movsb # Copy bytes backward
|
||||
cld
|
||||
pop rdi
|
||||
pop rsi
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
ret
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -42,16 +42,15 @@
|
||||
# IN UINT16 Value
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
|
||||
ASM_PFX(InternalMemScanMem16):
|
||||
push rdi
|
||||
mov rdi, rcx
|
||||
mov rax, r8
|
||||
mov rcx, rdx
|
||||
pushq %rdi
|
||||
movq %rcx, %rdi
|
||||
movq %r8, %rax
|
||||
movq %rdx, %rcx
|
||||
repne scasw
|
||||
lea rax, [rdi - 2]
|
||||
cmovnz rax, rcx
|
||||
pop rdi
|
||||
leaq -2(%rdi), %rax
|
||||
cmovnz %rcx, %rax
|
||||
popq %rdi
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -42,16 +42,15 @@
|
||||
# IN UINT32 Value
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
|
||||
ASM_PFX(InternalMemScanMem32):
|
||||
push rdi
|
||||
mov rdi, rcx
|
||||
mov rax, r8
|
||||
mov rcx, rdx
|
||||
repne scasd
|
||||
lea rax, [rdi - 4]
|
||||
cmovnz rax, rcx
|
||||
pop rdi
|
||||
pushq %rdi
|
||||
movq %rcx, %rdi
|
||||
movq %r8, %rax
|
||||
movq %rdx, %rcx
|
||||
repne scasl
|
||||
leaq -4(%rdi), %rax
|
||||
cmovnz %rcx, %rax
|
||||
popq %rdi
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -42,15 +42,14 @@
|
||||
# IN UINT64 Value
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
|
||||
ASM_PFX(InternalMemScanMem64):
|
||||
push rdi
|
||||
mov rdi, rcx
|
||||
mov rax, r8
|
||||
mov rcx, rdx
|
||||
repne scasq
|
||||
lea rax, [rdi - 8]
|
||||
cmovnz rax, rcx
|
||||
pop rdi
|
||||
pushq %rdi
|
||||
movq %rcx, %rdi
|
||||
movq %r8, %rax
|
||||
movq %rdx, %rcx
|
||||
repne scasq
|
||||
leaq -8(%rdi), %rax
|
||||
cmovnz %rcx, %rax
|
||||
popq %rdi
|
||||
ret
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -42,16 +42,15 @@
|
||||
# IN UINT8 Value
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
|
||||
ASM_PFX(InternalMemScanMem8):
|
||||
push rdi
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
mov rax, r8
|
||||
repne scasb
|
||||
lea rax, [rdi - 1]
|
||||
cmovnz rax, rcx # set rax to 0 if not found
|
||||
pop rdi
|
||||
pushq %rdi
|
||||
movq %rcx, %rdi
|
||||
movq %rdx, %rcx
|
||||
movq %r8, %rax
|
||||
repne scasb
|
||||
leaq -1(%rdi), %rax
|
||||
cmovnz %rcx, %rax # set rax to 0 if not found
|
||||
popq %rdi
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -34,29 +34,28 @@
|
||||
# IN UINT8 Value
|
||||
# )
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemSetMem)
|
||||
ASM_PFX(InternalMemSetMem):
|
||||
push rdi
|
||||
mov rax, r8
|
||||
mov ah, al
|
||||
movq mm0, rax
|
||||
mov r8, rcx
|
||||
mov rdi, r8 # rdi <- Buffer
|
||||
mov rcx, rdx
|
||||
and edx, 7
|
||||
shr rcx, 3
|
||||
push %rdi
|
||||
movq %r8, %rax
|
||||
movb %al, %ah
|
||||
movq %rax, %mm0
|
||||
movq %rcx, %r8
|
||||
movq %r8, %rdi # rdi <- Buffer
|
||||
movq %rdx, %rcx
|
||||
andq $7, %rdx
|
||||
shrq $3, %rcx
|
||||
jz L_SetBytes
|
||||
pshufw mm0, mm0, 0x0
|
||||
.byte 0x0f, 0x70, 0x0C0, 0x00
|
||||
L0:
|
||||
movntq [rdi], mm0
|
||||
add rdi, 8
|
||||
movntq %mm0, (%rdi)
|
||||
addq $8, %rdi
|
||||
loop L0
|
||||
mfence
|
||||
L_SetBytes:
|
||||
mov ecx, edx
|
||||
rep stosb
|
||||
mov rax, r8
|
||||
pop rdi
|
||||
movl %edx, %ecx
|
||||
rep stosb
|
||||
movq %r8, %rax
|
||||
pop %rdi
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -34,28 +34,27 @@
|
||||
# IN UINT16 Value
|
||||
# )
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
|
||||
ASM_PFX(InternalMemSetMem16):
|
||||
push rdi
|
||||
mov rax, r8
|
||||
movq mm0, rax
|
||||
mov r8, rcx
|
||||
mov rdi, r8
|
||||
mov rcx, rdx
|
||||
and edx, 3
|
||||
shr rcx, 2
|
||||
jz L_SetWords
|
||||
pshufw mm0, mm0, 0x0
|
||||
pushq %rdi
|
||||
movq %r8, %rax
|
||||
movq %rax, %mm0
|
||||
movq %rcx, %r8
|
||||
movq %r8, %rdi
|
||||
movq %rdx, %rcx
|
||||
andl $3, %edx
|
||||
shrq $2, %rcx
|
||||
jz L_SetWords
|
||||
.byte 0x0f, 0x70, 0x0C0, 0x00
|
||||
L0:
|
||||
movntq [rdi], mm0
|
||||
add rdi, 8
|
||||
loop L0
|
||||
movntq %mm0, (%rdi)
|
||||
addq $8, %rdi
|
||||
loop L0
|
||||
mfence
|
||||
L_SetWords:
|
||||
mov ecx, edx
|
||||
movl %edx, %ecx
|
||||
rep stosw
|
||||
mov rax, r8
|
||||
pop rdi
|
||||
movq %r8, %rax
|
||||
popq %rdi
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -34,23 +34,22 @@
|
||||
# IN UINT32 Value
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
|
||||
ASM_PFX(InternalMemSetMem32):
|
||||
movq mm0, r8 # mm0 <- Value
|
||||
mov rax, rcx # rax <- Buffer
|
||||
xchg rcx, rdx # rcx <- Count rdx <- Buffer
|
||||
shr rcx, 1 # rcx <- # of qwords to set
|
||||
movq %r8, %mm0 # mm0 <- Value
|
||||
movq %rcx, %rax # rax <- Buffer
|
||||
xchgq %rdx, %rcx # rcx <- Count rdx <- Buffer
|
||||
shrq $1, % rcx # rcx <- # of qwords to set
|
||||
jz L_SetDwords
|
||||
pshufw mm0, mm0, 0x44
|
||||
.byte 0x0f, 0x70, 0x0C0, 0x44
|
||||
L0:
|
||||
movntq [rdx], mm0
|
||||
lea rdx, [rdx + 8] # use "lea" to avoid flag changes
|
||||
movntq %mm0, (%rdx)
|
||||
leaq 8(%rdx), %rdx # use "lea" to avoid flag changes
|
||||
loop L0
|
||||
mfence
|
||||
L_SetDwords:
|
||||
jnc L1
|
||||
movd [rdx], mm0
|
||||
movd %mm0, (%rdx)
|
||||
L1:
|
||||
ret
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -33,15 +33,14 @@
|
||||
# IN UINT64 Value
|
||||
# )
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
|
||||
ASM_PFX(InternalMemSetMem64):
|
||||
movq mm0, r8 #Value
|
||||
mov rax, rcx #rax <- Buffer
|
||||
xchg rcx, rdx #rcx <- Count
|
||||
movq %r8, %mm0 #Value
|
||||
movw %rcx, %rax #rax <- Buffer
|
||||
xchg %rdx, %rcx #rcx <- Count
|
||||
L0:
|
||||
movntq [rdx], mm0
|
||||
add rdx, 8
|
||||
movntq %mm0, (%rdx)
|
||||
addq $8, %rdx
|
||||
loop L0
|
||||
mfence
|
||||
ret
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# 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
|
||||
@@ -32,27 +32,26 @@
|
||||
# IN UINTN Count
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
.intel_syntax noprefix
|
||||
ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
|
||||
ASM_PFX(InternalMemZeroMem):
|
||||
push rdi
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
mov r8, rdi
|
||||
and edx, 7
|
||||
shr rcx, 3
|
||||
pushq %rdi
|
||||
movq %rcx, %rdi
|
||||
movq %rdx, %rcx
|
||||
movq %rdi, %r8
|
||||
andq $7, %rdx
|
||||
shrq $3, %rcx
|
||||
jz L_ZeroBytes
|
||||
pxor mm0, mm0
|
||||
pxor %mm0, %mm0
|
||||
L0:
|
||||
movntq [rdi], mm0
|
||||
add rdi, 8
|
||||
movntq %mm0, (%rdi)
|
||||
addq $8, %rdi
|
||||
loop L0
|
||||
mfence
|
||||
L_ZeroBytes:
|
||||
xor eax, eax
|
||||
mov ecx, edx
|
||||
xorl %eax, %eax
|
||||
movl %edx, %ecx
|
||||
rep stosb
|
||||
mov rax, r8
|
||||
pop rdi
|
||||
movq %r8, %rax
|
||||
popq %rdi
|
||||
ret
|
||||
|
||||
|
@@ -10,9 +10,9 @@
|
||||
BaseMemoryLibOptDxe
|
||||
BaseMemoryLibOptPei
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
UefiMemoryLib
|
||||
|
||||
Copyright (c) 2006 - 2008 , Intel Corporation<BR>
|
||||
Copyright (c) 2006 - 2009 , Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
|
Reference in New Issue
Block a user