diff options
author | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-10-22 08:36:39 +0000 |
---|---|---|
committer | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-10-22 08:36:39 +0000 |
commit | 4df876adfb234d0c73b8be407ef3436cdce86af5 (patch) | |
tree | 659cf36c0692390f2200ca46f318480aded1c7f2 /MdePkg/Library/BaseMemoryLibMmx | |
parent | 710a5b358451cf471ec82fec0637ed6ea8c687b4 (diff) | |
download | edk2-platforms-4df876adfb234d0c73b8be407ef3436cdce86af5.tar.xz |
add corresponding .S files for BaseMemoryLibXXX X64 arch. Note that we use ".intel_syntax noprefix" directive to simplify the .S implementation.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6184 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibMmx')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf | 11 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S | 32 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S | 83 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S | 57 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S | 57 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S | 56 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S | 57 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S | 62 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S | 61 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S | 56 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S | 48 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S | 58 |
12 files changed, 581 insertions, 57 deletions
diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf index c8f5cedf95..67e461a0c6 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf +++ b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf @@ -85,6 +85,17 @@ X64/SetMem16.asm
X64/SetMem.asm
X64/CopyMem.asm
+ X64/ScanMem64.S
+ X64/ScanMem32.S
+ X64/ScanMem16.S
+ X64/ScanMem8.S
+ X64/CompareMem.S
+ X64/SetMem64.S
+ X64/SetMem32.S
+ X64/SetMem16.S
+ X64/ZeroMem.S
+ X64/SetMem.S
+ X64/CopyMem.S
[LibraryClasses]
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S index 2dc71b2b9a..5580d6237a 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S @@ -1,3 +1,6 @@ +# +# ConvertAsm.py: Automatically generated from CompareMem.asm +# #------------------------------------------------------------------------------ # # Copyright (c) 2006, Intel Corporation @@ -11,7 +14,7 @@ # # Module Name: # -# CompareMem.Asm +# CompareMem.S # # Abstract: # @@ -29,6 +32,7 @@ # #------------------------------------------------------------------------------ + #------------------------------------------------------------------------------ # INTN # EFIAPI @@ -38,17 +42,19 @@ # IN UINTN Length # ); #------------------------------------------------------------------------------ -.global _InternalMemCompareMem; -_InternalMemCompareMem: - push %rsi - push %rdi - mov %rcx, %rsi - mov %rdx, %rdi - mov %r8, %rcx +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCompareMem) +ASM_PFX(InternalMemCompareMem): + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 repe cmpsb - movzbq -1(%rsi), %rax - movzbq -1(%rdi), %rdx - sub %rdx, %rax - pop %rdi - pop %rsi + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + pop rdi + pop rsi ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S index c4ecdc70eb..3e7a396b5b 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S @@ -1,3 +1,6 @@ +# +# ConvertAsm.py: Automatically generated from CopyMem.asm +# #------------------------------------------------------------------------------ # # Copyright (c) 2006, Intel Corporation @@ -11,7 +14,7 @@ # # Module Name: # -# CopyMem.asm +# CopyMem.S # # Abstract: # @@ -23,50 +26,42 @@ #------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# OUT VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ) #------------------------------------------------------------------------------ -.global _InternalMemCopyMem; -_InternalMemCopyMem: - push %rsi - push %rdi - mov %rdi, %rsi - mov %rcx, %rdi - lea -1(%r8,%rsi,1),%r9 - cmp %rdi, %rsi - mov %rdi, %rax - jae L1 - cmp %rdi, %r9 - jae LCopyBackward # Copy backward if overlapped -L1: - mov %r8, %rcx - and $7, %r8 - shr $3, %rcx - jz LCopyBytes - movd %mm0, %r10 # (Save mm0 in r10) -L2: - movd (%rsi), %mm0 - movntq %mm0, (%rdi) - add $8, %rsi - add $8, %rdi - loop L2 - mfence - movd %r10, %mm0 #(Restore mm0) - jmp LCopyBytes -LCopyBackward: - mov %r9, %rsi - lea -1(%r8,%rdi,1),%rdi +.intel_syntax noprefix +.globl 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 + jae _InternalMemCopyMem_al_0000 + cmp r9, rdi + jae _atSym_CopyBackward # Copy backward if overlapped +_InternalMemCopyMem_al_0000: + mov rcx, r8 + and r8, 7 + shr rcx, 3 + rep movsq # Copy as many Qwords as possible + jmp _atSym_CopyBytes +_atSym_CopyBackward: + mov rsi, r9 # rsi <- End of Source + lea rdi, [rdi + r8 - 1] # esi <- End of Destination std # set direction flag -LCopyBytes: - mov %r8, %rcx - rep - movsb # Copy bytes backward +_atSym_CopyBytes: + mov rcx, r8 + rep movsb # Copy bytes backward cld - pop %rdi - pop %rsi + pop rdi + pop rsi ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S new file mode 100644 index 0000000000..9a94f5d936 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S @@ -0,0 +1,57 @@ +# +# ConvertAsm.py: Automatically generated from ScanMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem16) +ASM_PFX(InternalMemScanMem16): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S new file mode 100644 index 0000000000..86a6503fb3 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S @@ -0,0 +1,57 @@ +# +# ConvertAsm.py: Automatically generated from ScanMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl 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 + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S new file mode 100644 index 0000000000..bd1eee7852 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S @@ -0,0 +1,56 @@ +# +# ConvertAsm.py: Automatically generated from ScanMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl 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 + ret diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S new file mode 100644 index 0000000000..1d8b4e1b23 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S @@ -0,0 +1,57 @@ +# +# ConvertAsm.py: Automatically generated from ScanMem8.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl 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 + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S new file mode 100644 index 0000000000..87b1a308bc --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S @@ -0,0 +1,62 @@ +# +# ConvertAsm.py: Automatically generated from SetMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl 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 + jz L_SetBytes + pshufw mm0, mm0, 0x0 +L0: + movntq [rdi], mm0 + add rdi, 8 + loop L0 + mfence +L_SetBytes: + mov ecx, edx + rep stosb + mov rax, r8 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S new file mode 100644 index 0000000000..834adb15c6 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S @@ -0,0 +1,61 @@ +# +# ConvertAsm.py: Automatically generated from SetMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl 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 +L0: + movntq [rdi], mm0 + add rdi, 8 + loop L0 + mfence +L_SetWords: + mov ecx, edx + rep stosw + mov rax, r8 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S new file mode 100644 index 0000000000..099e53d607 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S @@ -0,0 +1,56 @@ +# +# ConvertAsm.py: Automatically generated from SetMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl 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 + jz L_SetDwords + pshufw mm0, mm0, 0x44 +L0: + movntq [rdx], mm0 + lea rdx, [rdx + 8] # use "lea" to avoid flag changes + loop L0 + mfence +L_SetDwords: + jnc L1 + movd [rdx], mm0 +L1: + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S new file mode 100644 index 0000000000..76dbdf262f --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S @@ -0,0 +1,48 @@ +# +# ConvertAsm.py: Automatically generated from SetMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem64) +ASM_PFX(InternalMemSetMem64): + movq mm0, r8 #Value + mov rax, rcx #rax <- Buffer + xchg rcx, rdx #rcx <- Count +L0: + movntq [rdx], mm0 + add rdx, 8 + loop L0 + mfence + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S new file mode 100644 index 0000000000..f8d24cc23e --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S @@ -0,0 +1,58 @@ +# +# ConvertAsm.py: Automatically generated from ZeroMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, 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 +# http://opensource.org/licenses/bsd-license.php +# +# 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: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemZeroMem) +ASM_PFX(InternalMemZeroMem): + push rdi + mov rdi, rcx + mov rcx, rdx + mov r8, rdi + and edx, 7 + shr rcx, 3 + jz L_ZeroBytes + pxor mm0, mm0 +L0: + movntq [rdi], mm0 + add rdi, 8 + loop L0 + mfence +L_ZeroBytes: + xor eax, eax + mov ecx, edx + rep stosb + mov rax, r8 + pop rdi + ret + |