From a0bdf7588a4896aade0a4194722324a1b2cc2b8f Mon Sep 17 00:00:00 2001 From: vanjeff Date: Thu, 25 Sep 2008 03:13:50 +0000 Subject: Change name. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5981 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/BaseMemoryLibOptDxe/X64/CompareMem.asm | 54 +++++++++++++++ MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.asm | 79 ++++++++++++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/ScanMem16.asm | 53 +++++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/ScanMem32.asm | 53 +++++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/ScanMem64.asm | 53 +++++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/ScanMem8.asm | 53 +++++++++++++++ MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.asm | 58 ++++++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/SetMem16.asm | 45 ++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/SetMem32.asm | 45 ++++++++++++ .../Library/BaseMemoryLibOptDxe/X64/SetMem64.asm | 44 ++++++++++++ MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.asm | 48 +++++++++++++ .../Library/BaseMemoryLibOptDxe/x64/CompareMem.asm | 54 --------------- MdePkg/Library/BaseMemoryLibOptDxe/x64/CopyMem.asm | 79 ---------------------- .../Library/BaseMemoryLibOptDxe/x64/ScanMem16.asm | 53 --------------- .../Library/BaseMemoryLibOptDxe/x64/ScanMem32.asm | 53 --------------- .../Library/BaseMemoryLibOptDxe/x64/ScanMem64.asm | 53 --------------- .../Library/BaseMemoryLibOptDxe/x64/ScanMem8.asm | 53 --------------- MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem.asm | 58 ---------------- .../Library/BaseMemoryLibOptDxe/x64/SetMem16.asm | 45 ------------ .../Library/BaseMemoryLibOptDxe/x64/SetMem32.asm | 45 ------------ .../Library/BaseMemoryLibOptDxe/x64/SetMem64.asm | 44 ------------ MdePkg/Library/BaseMemoryLibOptDxe/x64/ZeroMem.asm | 48 ------------- 22 files changed, 585 insertions(+), 585 deletions(-) create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.asm create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/CompareMem.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/CopyMem.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem16.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem32.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem64.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem8.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem16.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem32.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem64.asm delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/x64/ZeroMem.asm (limited to 'MdePkg/Library/BaseMemoryLibOptDxe') diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.asm new file mode 100644 index 0000000000..7446a052e0 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.asm @@ -0,0 +1,54 @@ +;------------------------------------------------------------------------------ +; +; 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: +; +; CompareMem.Asm +; +; Abstract: +; +; CompareMem function +; +; Notes: +; +; The following BaseMemoryLib instances contain the same copy of this file: +; +; BaseMemoryLibRepStr +; BaseMemoryLibMmx +; BaseMemoryLibSse2 +; BaseMemoryLibOptDxe +; BaseMemoryLibOptPei +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; INTN +; EFIAPI +; InternalMemCompareMem ( +; IN CONST VOID *DestinationBuffer, +; IN CONST VOID *SourceBuffer, +; IN UINTN Length +; ); +;------------------------------------------------------------------------------ +InternalMemCompareMem PROC USES rsi rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 + repe cmpsb + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + ret +InternalMemCompareMem ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.asm new file mode 100644 index 0000000000..03ffe0c00f --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.asm @@ -0,0 +1,79 @@ +;------------------------------------------------------------------------------ +; +; 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: +; +; CopyMem.asm +; +; Abstract: +; +; CopyMem function +; +; Notes: +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID * +; EFIAPI +; InternalMemCopyMem ( +; IN VOID *Destination, +; IN VOID *Source, +; IN UINTN Count +; ); +;------------------------------------------------------------------------------ +InternalMemCopyMem PROC USES rsi rdi + mov rsi, rdx ; rsi <- Source + mov rdi, rcx ; rdi <- Destination + lea r9, [rsi + r8 - 1] ; r9 <- Last byte of Source + cmp rsi, rdi + mov rax, rdi ; rax <- Destination as return value + jae @F ; Copy forward if Source > Destination + cmp r9, rdi ; Overlapped? + jae @CopyBackward ; Copy backward if overlapped +@@: + xor rcx, rcx + sub rcx, rdi ; rcx <- -rdi + and rcx, 15 ; rcx + rsi should be 16 bytes aligned + jz @F ; skip if rcx == 0 + cmp rcx, r8 + cmova rcx, r8 + sub r8, rcx + rep movsb +@@: + mov rcx, r8 + and r8, 15 + shr rcx, 4 ; rcx <- # of DQwords to copy + jz @CopyBytes + movdqa [rsp + 18h], xmm0 ; save xmm0 on stack +@@: + movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned + movntdq [rdi], xmm0 ; rdi should be 16-byte aligned + add rsi, 16 + add rdi, 16 + loop @B + mfence + movdqa xmm0, [rsp + 18h] ; restore xmm0 + jmp @CopyBytes ; copy remaining bytes +@CopyBackward: + mov rsi, r9 ; rsi <- Last byte of Source + lea rdi, [rdi + r8 - 1] ; rdi <- Last byte of Destination + std +@CopyBytes: + mov rcx, r8 + rep movsb + cld + ret +InternalMemCopyMem ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.asm new file mode 100644 index 0000000000..0871a4b0f5 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; ScanMem16 function +; +; Notes: +; +; The following BaseMemoryLib instances contain the same copy of this file: +; +; BaseMemoryLibRepStr +; BaseMemoryLibMmx +; BaseMemoryLibSse2 +; BaseMemoryLibOptDxe +; BaseMemoryLibOptPei +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; CONST VOID * +; EFIAPI +; InternalMemScanMem16 ( +; IN CONST VOID *Buffer, +; IN UINTN Length, +; IN UINT16 Value +; ); +;------------------------------------------------------------------------------ +InternalMemScanMem16 PROC USES rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + ret +InternalMemScanMem16 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.asm new file mode 100644 index 0000000000..53a33bafb2 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; ScanMem32 function +; +; Notes: +; +; The following BaseMemoryLib instances contain the same copy of this file: +; +; BaseMemoryLibRepStr +; BaseMemoryLibMmx +; BaseMemoryLibSse2 +; BaseMemoryLibOptDxe +; BaseMemoryLibOptPei +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; CONST VOID * +; EFIAPI +; InternalMemScanMem32 ( +; IN CONST VOID *Buffer, +; IN UINTN Length, +; IN UINT32 Value +; ); +;------------------------------------------------------------------------------ +InternalMemScanMem32 PROC USES rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasd + lea rax, [rdi - 4] + cmovnz rax, rcx + ret +InternalMemScanMem32 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.asm new file mode 100644 index 0000000000..71f85a1ab7 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; ScanMem64 function +; +; Notes: +; +; The following BaseMemoryLib instances contain the same copy of this file: +; +; BaseMemoryLibRepStr +; BaseMemoryLibMmx +; BaseMemoryLibSse2 +; BaseMemoryLibOptDxe +; BaseMemoryLibOptPei +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; CONST VOID * +; EFIAPI +; InternalMemScanMem64 ( +; IN CONST VOID *Buffer, +; IN UINTN Length, +; IN UINT64 Value +; ); +;------------------------------------------------------------------------------ +InternalMemScanMem64 PROC USES rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasq + lea rax, [rdi - 8] + cmovnz rax, rcx + ret +InternalMemScanMem64 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.asm new file mode 100644 index 0000000000..39adb01b7f --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; ScanMem8 function +; +; Notes: +; +; The following BaseMemoryLib instances contain the same copy of this file: +; +; BaseMemoryLibRepStr +; BaseMemoryLibMmx +; BaseMemoryLibSse2 +; BaseMemoryLibOptDxe +; BaseMemoryLibOptPei +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; CONST VOID * +; EFIAPI +; InternalMemScanMem8 ( +; IN CONST VOID *Buffer, +; IN UINTN Length, +; IN UINT8 Value +; ); +;------------------------------------------------------------------------------ +InternalMemScanMem8 PROC USES 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 + ret +InternalMemScanMem8 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.asm new file mode 100644 index 0000000000..c94b6b5703 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.asm @@ -0,0 +1,58 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; SetMem function +; +; Notes: +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID * +; EFIAPI +; InternalMemSetMem ( +; IN VOID *Buffer, +; IN UINTN Count, +; IN UINT8 Value +; ) +;------------------------------------------------------------------------------ +InternalMemSetMem PROC USES rdi rbx + push rcx ; push Buffer + mov rax, r8 ; rax = Value + and rax, 0ffh ; rax = lower 8 bits of r8, upper 56 bits are 0 + mov ah, al ; ah = al + mov bx, ax ; bx = ax + shl rax, 10h ; rax = ax << 16 + mov ax, bx ; ax = bx + mov rbx, rax ; ebx = eax + shl rax, 20h ; rax = rax << 32 + or rax, rbx ; eax = ebx + mov rdi, rcx ; rdi = Buffer + mov rcx, rdx ; rcx = Count + shr rcx, 3 ; rcx = rcx / 8 + cld + rep stosq + mov rcx, rdx ; rcx = rdx + and rcx, 7 ; rcx = rcx & 7 + rep stosb + pop rax ; rax = Buffer + ret +InternalMemSetMem ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.asm new file mode 100644 index 0000000000..68ff48821e --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.asm @@ -0,0 +1,45 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; SetMem16 function +; +; Notes: +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID * +; EFIAPI +; InternalMemSetMem16 ( +; IN VOID *Buffer, +; IN UINTN Count, +; IN UINT16 Value +; ) +;------------------------------------------------------------------------------ +InternalMemSetMem16 PROC USES rdi + push rcx + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosw + pop rax + ret +InternalMemSetMem16 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.asm new file mode 100644 index 0000000000..c81c81f901 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.asm @@ -0,0 +1,45 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; SetMem32 function +; +; Notes: +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID * +; EFIAPI +; InternalMemSetMem32 ( +; IN VOID *Buffer, +; IN UINTN Count, +; IN UINT32 Value +; ); +;------------------------------------------------------------------------------ +InternalMemSetMem32 PROC USES rdi + push rcx + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosd + pop rax + ret +InternalMemSetMem32 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.asm new file mode 100644 index 0000000000..282a86c239 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.asm @@ -0,0 +1,44 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; SetMem64 function +; +; Notes: +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID * +; InternalMemSetMem64 ( +; IN VOID *Buffer, +; IN UINTN Count, +; IN UINT64 Value +; ) +;------------------------------------------------------------------------------ +InternalMemSetMem64 PROC USES rdi + push rcx + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosq + pop rax + ret +InternalMemSetMem64 ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.asm new file mode 100644 index 0000000000..940864fba1 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.asm @@ -0,0 +1,48 @@ +;------------------------------------------------------------------------------ +; +; 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.Asm +; +; Abstract: +; +; ZeroMem function +; +; Notes: +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID * +; InternalMemZeroMem ( +; IN VOID *Buffer, +; IN UINTN Count +; ); +;------------------------------------------------------------------------------ +InternalMemZeroMem PROC USES rdi + push rcx ; push Buffer + xor rax, rax ; rax = 0 + mov rdi, rcx ; rdi = Buffer + mov rcx, rdx ; rcx = Count + shr rcx, 3 ; rcx = rcx / 8 + and rdx, 7 ; rdx = rdx & 7 + cld + rep stosq + mov rcx, rdx ; rcx = rdx + rep stosb + pop rax ; rax = Buffer + ret +InternalMemZeroMem ENDP + + END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/CompareMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/CompareMem.asm deleted file mode 100644 index 7446a052e0..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/CompareMem.asm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -InternalMemCompareMem PROC USES rsi rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - ret -InternalMemCompareMem ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/CopyMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/CopyMem.asm deleted file mode 100644 index 03ffe0c00f..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/CopyMem.asm +++ /dev/null @@ -1,79 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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: -; -; CopyMem.asm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -InternalMemCopyMem PROC USES rsi rdi - mov rsi, rdx ; rsi <- Source - mov rdi, rcx ; rdi <- Destination - lea r9, [rsi + r8 - 1] ; r9 <- Last byte of Source - cmp rsi, rdi - mov rax, rdi ; rax <- Destination as return value - jae @F ; Copy forward if Source > Destination - cmp r9, rdi ; Overlapped? - jae @CopyBackward ; Copy backward if overlapped -@@: - xor rcx, rcx - sub rcx, rdi ; rcx <- -rdi - and rcx, 15 ; rcx + rsi should be 16 bytes aligned - jz @F ; skip if rcx == 0 - cmp rcx, r8 - cmova rcx, r8 - sub r8, rcx - rep movsb -@@: - mov rcx, r8 - and r8, 15 - shr rcx, 4 ; rcx <- # of DQwords to copy - jz @CopyBytes - movdqa [rsp + 18h], xmm0 ; save xmm0 on stack -@@: - movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned - movntdq [rdi], xmm0 ; rdi should be 16-byte aligned - add rsi, 16 - add rdi, 16 - loop @B - mfence - movdqa xmm0, [rsp + 18h] ; restore xmm0 - jmp @CopyBytes ; copy remaining bytes -@CopyBackward: - mov rsi, r9 ; rsi <- Last byte of Source - lea rdi, [rdi + r8 - 1] ; rdi <- Last byte of Destination - std -@CopyBytes: - mov rcx, r8 - rep movsb - cld - ret -InternalMemCopyMem ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem16.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem16.asm deleted file mode 100644 index 0871a4b0f5..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem16.asm +++ /dev/null @@ -1,53 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -InternalMemScanMem16 PROC USES rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - ret -InternalMemScanMem16 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem32.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem32.asm deleted file mode 100644 index 53a33bafb2..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem32.asm +++ /dev/null @@ -1,53 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -InternalMemScanMem32 PROC USES rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - ret -InternalMemScanMem32 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem64.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem64.asm deleted file mode 100644 index 71f85a1ab7..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem64.asm +++ /dev/null @@ -1,53 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -InternalMemScanMem64 PROC USES rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - ret -InternalMemScanMem64 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem8.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem8.asm deleted file mode 100644 index 39adb01b7f..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ScanMem8.asm +++ /dev/null @@ -1,53 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -InternalMemScanMem8 PROC USES 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 - ret -InternalMemScanMem8 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem.asm deleted file mode 100644 index c94b6b5703..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem.asm +++ /dev/null @@ -1,58 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -InternalMemSetMem PROC USES rdi rbx - push rcx ; push Buffer - mov rax, r8 ; rax = Value - and rax, 0ffh ; rax = lower 8 bits of r8, upper 56 bits are 0 - mov ah, al ; ah = al - mov bx, ax ; bx = ax - shl rax, 10h ; rax = ax << 16 - mov ax, bx ; ax = bx - mov rbx, rax ; ebx = eax - shl rax, 20h ; rax = rax << 32 - or rax, rbx ; eax = ebx - mov rdi, rcx ; rdi = Buffer - mov rcx, rdx ; rcx = Count - shr rcx, 3 ; rcx = rcx / 8 - cld - rep stosq - mov rcx, rdx ; rcx = rdx - and rcx, 7 ; rcx = rcx & 7 - rep stosb - pop rax ; rax = Buffer - ret -InternalMemSetMem ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem16.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem16.asm deleted file mode 100644 index 68ff48821e..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem16.asm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -InternalMemSetMem16 PROC USES rdi - push rcx - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - pop rax - ret -InternalMemSetMem16 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem32.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem32.asm deleted file mode 100644 index c81c81f901..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem32.asm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -InternalMemSetMem32 PROC USES rdi - push rcx - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - pop rax - ret -InternalMemSetMem32 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem64.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem64.asm deleted file mode 100644 index 282a86c239..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/SetMem64.asm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -InternalMemSetMem64 PROC USES rdi - push rcx - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - pop rax - ret -InternalMemSetMem64 ENDP - - END diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ZeroMem.asm b/MdePkg/Library/BaseMemoryLibOptDxe/x64/ZeroMem.asm deleted file mode 100644 index 940864fba1..0000000000 --- a/MdePkg/Library/BaseMemoryLibOptDxe/x64/ZeroMem.asm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; 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.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -InternalMemZeroMem PROC USES rdi - push rcx ; push Buffer - xor rax, rax ; rax = 0 - mov rdi, rcx ; rdi = Buffer - mov rcx, rdx ; rcx = Count - shr rcx, 3 ; rcx = rcx / 8 - and rdx, 7 ; rdx = rdx & 7 - cld - rep stosq - mov rcx, rdx ; rcx = rdx - rep stosb - pop rax ; rax = Buffer - ret -InternalMemZeroMem ENDP - - END -- cgit v1.2.3