1. Port X64, IPF and EBC arch for BaseLib
2. Port X64 arch codes for BaseMemoryLibRepStr and BaseMemoryLibSee2 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2955 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
52
MdePkg/Library/BaseMemoryLibRepStr/x64/CompareMem.asm
Normal file
52
MdePkg/Library/BaseMemoryLibRepStr/x64/CompareMem.asm
Normal file
@@ -0,0 +1,52 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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 share the same version of this file:
|
||||
;
|
||||
; BaseMemoryLibRepStr
|
||||
; BaseMemoryLibMmx
|
||||
; BaseMemoryLibSse2
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.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
|
61
MdePkg/Library/BaseMemoryLibRepStr/x64/CopyMem.asm
Normal file
61
MdePkg/Library/BaseMemoryLibRepStr/x64/CopyMem.asm
Normal file
@@ -0,0 +1,61 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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 <- End of Source
|
||||
cmp rsi, rdi
|
||||
mov rax, rdi ; rax <- Destination as return value
|
||||
jae @F
|
||||
cmp r9, rsi
|
||||
jae @CopyBackward ; Copy backward if overlapped
|
||||
@@:
|
||||
mov rcx, r8
|
||||
and r8, 7
|
||||
shr rcx, 3
|
||||
rep movsq ; Copy as many Qwords as possible
|
||||
jmp @CopyBytes
|
||||
@CopyBackward:
|
||||
mov rsi, r9 ; rsi <- End of Source
|
||||
lea rdi, [rdi + r8 - 1] ; esi <- End of Destination
|
||||
std ; set direction flag
|
||||
@CopyBytes:
|
||||
mov rcx, r8
|
||||
rep movsb ; Copy bytes backward
|
||||
cld
|
||||
ret
|
||||
InternalMemCopyMem ENDP
|
||||
|
||||
END
|
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem16.asm
Normal file
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem16.asm
Normal file
@@ -0,0 +1,51 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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 share the same version of this file:
|
||||
;
|
||||
; BaseMemoryLibRepStr
|
||||
; BaseMemoryLibMmx
|
||||
; BaseMemoryLibSse2
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.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
|
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem32.asm
Normal file
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem32.asm
Normal file
@@ -0,0 +1,51 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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 share the same version of this file:
|
||||
;
|
||||
; BaseMemoryLibRepStr
|
||||
; BaseMemoryLibMmx
|
||||
; BaseMemoryLibSse2
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.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
|
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem64.asm
Normal file
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem64.asm
Normal file
@@ -0,0 +1,51 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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 share the same version of this file:
|
||||
;
|
||||
; BaseMemoryLibRepStr
|
||||
; BaseMemoryLibMmx
|
||||
; BaseMemoryLibSse2
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.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
|
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem8.asm
Normal file
51
MdePkg/Library/BaseMemoryLibRepStr/x64/ScanMem8.asm
Normal file
@@ -0,0 +1,51 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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 share the same version of this file:
|
||||
;
|
||||
; BaseMemoryLibRepStr
|
||||
; BaseMemoryLibMmx
|
||||
; BaseMemoryLibSse2
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.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
|
44
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem.asm
Normal file
44
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem.asm
Normal file
@@ -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:
|
||||
;
|
||||
; SetMem.Asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; SetMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID *
|
||||
; EFIAPI
|
||||
; InternalMemSetMem (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Count,
|
||||
; IN UINT8 Value
|
||||
; )
|
||||
;------------------------------------------------------------------------------
|
||||
InternalMemSetMem PROC USES rdi
|
||||
mov rax, r8
|
||||
mov rdi, rcx
|
||||
xchg rcx, rdx
|
||||
rep stosb
|
||||
mov rax, rdx
|
||||
ret
|
||||
InternalMemSetMem ENDP
|
||||
|
||||
END
|
44
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem16.asm
Normal file
44
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem16.asm
Normal file
@@ -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:
|
||||
;
|
||||
; SetMem16.Asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; SetMem16 function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID *
|
||||
; EFIAPI
|
||||
; InternalMemSetMem16 (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Count,
|
||||
; IN UINT16 Value
|
||||
; )
|
||||
;------------------------------------------------------------------------------
|
||||
InternalMemSetMem16 PROC USES rdi
|
||||
mov rdi, rcx
|
||||
mov rax, r8
|
||||
xchg rcx, rdx
|
||||
rep stosw
|
||||
mov rax, rdx
|
||||
ret
|
||||
InternalMemSetMem16 ENDP
|
||||
|
||||
END
|
44
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem32.asm
Normal file
44
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem32.asm
Normal file
@@ -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:
|
||||
;
|
||||
; SetMem32.Asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; SetMem32 function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID *
|
||||
; EFIAPI
|
||||
; InternalMemSetMem32 (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Count,
|
||||
; IN UINT32 Value
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
InternalMemSetMem32 PROC USES rdi
|
||||
mov rdi, rcx
|
||||
mov rax, r8
|
||||
xchg rcx, rdx
|
||||
rep stosd
|
||||
mov rax, rdx
|
||||
ret
|
||||
InternalMemSetMem32 ENDP
|
||||
|
||||
END
|
43
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem64.asm
Normal file
43
MdePkg/Library/BaseMemoryLibRepStr/x64/SetMem64.asm
Normal file
@@ -0,0 +1,43 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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
|
||||
mov rdi, rcx
|
||||
mov rax, r8
|
||||
xchg rcx, rdx
|
||||
rep stosq
|
||||
mov rax, rdx
|
||||
ret
|
||||
InternalMemSetMem64 ENDP
|
||||
|
||||
END
|
47
MdePkg/Library/BaseMemoryLibRepStr/x64/ZeroMem.asm
Normal file
47
MdePkg/Library/BaseMemoryLibRepStr/x64/ZeroMem.asm
Normal file
@@ -0,0 +1,47 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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
|
||||
xor rax, rax
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
shr rcx, 3
|
||||
and rdx, 7
|
||||
rep stosq
|
||||
mov ecx, edx
|
||||
rep stosb
|
||||
pop rax
|
||||
ret
|
||||
InternalMemZeroMem ENDP
|
||||
|
||||
END
|
Reference in New Issue
Block a user