Renamed remotely
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6017 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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
|
||||
; EfiCommonLibCopyMem (
|
||||
; OUT VOID *Destination,
|
||||
; IN VOID *Source,
|
||||
; IN UINTN Count
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibCopyMem PROC USES rsi rdi
|
||||
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||
je @CopyMemDone
|
||||
cmp r8, 0 ; if Count == 0, do nothing
|
||||
je @CopyMemDone
|
||||
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, rdi
|
||||
jae @CopyBackward ; Copy backward if overlapped
|
||||
@@:
|
||||
mov rcx, r8
|
||||
and r8, 7
|
||||
shr rcx, 3 ; rcx <- # of Qwords to copy
|
||||
jz @CopyBytes
|
||||
DB 49h, 0fh, 7eh, 0c2h ; movd r10, mm0 (Save mm0 in r10)
|
||||
@@:
|
||||
DB 0fh, 6fh, 06h ; movd mm0, [rsi]
|
||||
DB 48h, 0fh, 7eh, 07h ; movd [rdi], mm0
|
||||
add rsi, 8
|
||||
add rdi, 8
|
||||
loop @B
|
||||
DB 49h, 0fh, 6eh, 0c2h ; movd mm0, r10 (Restore mm0)
|
||||
jmp @CopyBytes
|
||||
@CopyBackward:
|
||||
mov rsi, r9 ; rsi <- End of Source
|
||||
lea rdi, [rdi + r8 - 1] ; rdi <- End of Destination
|
||||
std ; set direction flag
|
||||
@CopyBytes:
|
||||
mov rcx, r8
|
||||
rep movsb ; Copy bytes backward
|
||||
cld
|
||||
@CopyMemDone:
|
||||
ret
|
||||
EfiCommonLibCopyMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,66 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2008, 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:
|
||||
#
|
||||
# EfiCopyMemRep1.S
|
||||
#
|
||||
# Abstract:
|
||||
#
|
||||
# CopyMem function
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#include <EfiBind.h>
|
||||
|
||||
.code:
|
||||
|
||||
.global ASM_PFX(EfiCommonLibCopyMem)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# VOID
|
||||
# EfiCommonLibCopyMem (
|
||||
# OUT VOID *Destination,
|
||||
# IN VOID *Source,
|
||||
# IN UINTN Count
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
ASM_PFX(EfiCommonLibCopyMem):
|
||||
push %rsi
|
||||
push %rdi
|
||||
cmp %rcx,%rdx
|
||||
je CopyMemDone
|
||||
cmp $0x0,%r8
|
||||
je CopyMemDone
|
||||
mov %rdx,%rsi
|
||||
mov %rcx,%rdi
|
||||
lea -1(%r8,%rsi,1),%r9
|
||||
cmp %rdi,%rsi
|
||||
jae CopyBytes
|
||||
cmp %rdi,%r9
|
||||
jb CopyBytes
|
||||
mov %r9,%rsi
|
||||
lea -1(%r8,%rdi,1),%rdi
|
||||
std
|
||||
|
||||
CopyBytes:
|
||||
mov %r8,%rcx
|
||||
rep movsb %ds:(%rsi),%es:(%rdi)
|
||||
cld
|
||||
|
||||
CopyMemDone:
|
||||
pop %rdi
|
||||
pop %rsi
|
||||
retq
|
||||
|
||||
|
||||
|
@@ -0,0 +1,58 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiCopyMemRep1.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; CopyMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibCopyMem (
|
||||
; OUT VOID *Destination,
|
||||
; IN VOID *Source,
|
||||
; IN UINTN Count
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibCopyMem PROC USES rsi rdi
|
||||
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||
je @CopyMemDone
|
||||
cmp r8, 0 ; if Count == 0, do nothing
|
||||
je @CopyMemDone
|
||||
mov rsi, rdx ; rsi <- Source
|
||||
mov rdi, rcx ; rdi <- Destination
|
||||
lea r9, [rsi + r8 - 1] ; r9 <- End of Source
|
||||
cmp rsi, rdi
|
||||
jae @CopyBytes
|
||||
cmp r9, rdi
|
||||
jb @CopyBytes ; Copy backward if overlapped
|
||||
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
|
||||
@CopyMemDone:
|
||||
ret
|
||||
EfiCommonLibCopyMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,65 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiCopyMemRep4.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; CopyMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibCopyMem (
|
||||
; OUT VOID *Destination,
|
||||
; IN VOID *Source,
|
||||
; IN UINTN Count
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibCopyMem PROC USES rsi rdi
|
||||
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||
je @CopyMemDone
|
||||
cmp r8, 0 ; if Count == 0, do nothing
|
||||
je @CopyMemDone
|
||||
mov rsi, rdx ; rsi <- Source
|
||||
mov rdi, rcx ; rdi <- Destination
|
||||
lea r9, [rsi + r8 - 1] ; r9 <- End of Source
|
||||
cmp rsi, rdi
|
||||
jae @F
|
||||
cmp r9, rdi
|
||||
jae @CopyBackward ; Copy backward if overlapped
|
||||
@@:
|
||||
mov rcx, r8
|
||||
and r8, 3
|
||||
shr rcx, 2
|
||||
rep movsd ; Copy as many Dwords 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
|
||||
@CopyMemDone:
|
||||
ret
|
||||
EfiCommonLibCopyMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,65 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiCopyMemRep8.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; CopyMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibCopyMem (
|
||||
; OUT VOID *Destination,
|
||||
; IN VOID *Source,
|
||||
; IN UINTN Count
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibCopyMem PROC USES rsi rdi
|
||||
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||
je @CopyMemDone
|
||||
cmp r8, 0 ; if Count == 0, do nothing
|
||||
je @CopyMemDone
|
||||
mov rsi, rdx ; rsi <- Source
|
||||
mov rdi, rcx ; rdi <- Destination
|
||||
lea r9, [rsi + r8 - 1] ; r9 <- End of Source
|
||||
cmp rsi, rdi
|
||||
jae @F
|
||||
cmp r9, rdi
|
||||
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
|
||||
@CopyMemDone:
|
||||
ret
|
||||
EfiCommonLibCopyMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,80 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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
|
||||
; EfiCommonLibCopyMem (
|
||||
; OUT VOID *Destination,
|
||||
; IN VOID *Source,
|
||||
; IN UINTN Count
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibCopyMem PROC USES rsi rdi
|
||||
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||
je @CopyMemDone
|
||||
cmp r8, 0 ; if Count == 0, do nothing
|
||||
je @CopyMemDone
|
||||
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 ; 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
|
||||
@@:
|
||||
movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned
|
||||
movdqa [rdi], xmm0 ; rdi should be 16-byte aligned
|
||||
add rsi, 16
|
||||
add rdi, 16
|
||||
loop @B
|
||||
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
|
||||
@CopyMemDone:
|
||||
ret
|
||||
EfiCommonLibCopyMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,60 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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
|
||||
; EfiCommonLibSetMem (
|
||||
; OUT VOID *Buffer,
|
||||
; IN UINTN Size,
|
||||
; IN UINT8 Value
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibSetMem PROC USES rdi
|
||||
cmp rdx, 0 ; if Size == 0, do nothing
|
||||
je @SetDone
|
||||
mov rax, r8
|
||||
mov ah, al
|
||||
DB 48h, 0fh, 6eh, 0c0h ; movd mm0, rax
|
||||
mov r8, rcx
|
||||
mov rdi, r8 ; rdi <- Buffer
|
||||
mov rcx, rdx
|
||||
and edx, 7
|
||||
shr rcx, 3
|
||||
jz @SetBytes
|
||||
DB 0fh, 70h, 0C0h, 00h ; pshufw mm0, mm0, 0h
|
||||
@@:
|
||||
DB 48h, 0fh, 7eh, 07h ; movd [rdi], mm0
|
||||
add rdi, 8
|
||||
loop @B
|
||||
@SetBytes:
|
||||
mov ecx, edx
|
||||
rep stosb
|
||||
mov rax, r8
|
||||
@SetDone:
|
||||
ret
|
||||
EfiCommonLibSetMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,46 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiSetMemRep1.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; SetMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibSetMem (
|
||||
; OUT VOID *Buffer,
|
||||
; IN UINTN Size,
|
||||
; IN UINT8 Value
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibSetMem PROC USES rdi
|
||||
cmp rdx, 0 ; if Size == 0, do nothing
|
||||
je @SetDone
|
||||
mov rax, r8
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
rep stosb
|
||||
@SetDone:
|
||||
ret
|
||||
EfiCommonLibSetMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,54 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2008, 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:
|
||||
#
|
||||
# EfiSetMemRep4.S
|
||||
#
|
||||
# Abstract:
|
||||
#
|
||||
# SetMem function
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#include <EfiBind.h>
|
||||
|
||||
.code:
|
||||
|
||||
.global ASM_PFX(EfiCommonLibCopyMem)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# VOID
|
||||
# EfiCommonLibSetMem (
|
||||
# OUT VOID *Buffer,
|
||||
# IN UINTN Size,
|
||||
# IN UINT8 Value
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
ASM_PFX(EfiCommonLibSetMem):
|
||||
push %rdi
|
||||
cmp $0x0,%rdx
|
||||
je SetDone
|
||||
mov %rcx,%rdi
|
||||
mov %r8b,%al
|
||||
mov %al,%ah
|
||||
shrd $0x10,%eax,%ecx
|
||||
shld $0x10,%ecx,%eax
|
||||
mov %rdx,%rcx
|
||||
shr $0x2,%rcx
|
||||
rep stos %eax,%es:(%rdi)
|
||||
mov %rdx,%rcx
|
||||
and $0x3,%rcx
|
||||
rep stos %al,%es:(%rdi)
|
||||
SetDone:
|
||||
pop %rdi
|
||||
retq
|
@@ -0,0 +1,53 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiSetMemRep4.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; SetMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibSetMem (
|
||||
; OUT VOID *Buffer,
|
||||
; IN UINTN Size,
|
||||
; IN UINT8 Value
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibSetMem PROC USES rdi
|
||||
cmp rdx, 0 ; if Size == 0, do nothing
|
||||
je @SetDone
|
||||
mov rdi, rcx
|
||||
mov al, r8b
|
||||
mov ah, al
|
||||
shrd ecx, eax, 16
|
||||
shld eax, ecx, 16
|
||||
mov rcx, rdx
|
||||
shr rcx, 2
|
||||
rep stosd
|
||||
mov rcx, rdx
|
||||
and rcx, 3
|
||||
rep stosb
|
||||
@SetDone:
|
||||
ret
|
||||
EfiCommonLibSetMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,58 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiSetMemRep8.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; SetMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibSetMem (
|
||||
; OUT VOID *Buffer,
|
||||
; IN UINTN Size,
|
||||
; IN UINT8 Value
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibSetMem PROC USES rdi rbx
|
||||
cmp rdx, 0 ; if Size == 0, do nothing
|
||||
je @SetDone
|
||||
mov rax, r8
|
||||
mov bl, al
|
||||
mov bh, bl
|
||||
mov ax, bx
|
||||
shl rax, 10h
|
||||
mov ax, bx
|
||||
mov ebx, eax
|
||||
shl rax, 20h
|
||||
mov eax, ebx
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
shr rcx, 3
|
||||
rep stosq
|
||||
mov rcx, rdx
|
||||
and rcx, 7
|
||||
rep stosb
|
||||
@SetDone:
|
||||
ret
|
||||
EfiCommonLibSetMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,67 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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
|
||||
; EfiCommonLibSetMem (
|
||||
; OUT VOID *Buffer,
|
||||
; IN UINTN Size,
|
||||
; IN UINT8 Value
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibSetMem PROC USES rdi
|
||||
cmp rdx, 0 ; if Size == 0, do nothing
|
||||
je @SetDone
|
||||
mov rdi, rcx ; rdi <- Buffer
|
||||
mov al, r8b ; al <- Value
|
||||
xor rcx, rcx
|
||||
sub rcx, rdi
|
||||
and rcx, 15 ; rcx + rdi aligns on 16-byte boundary
|
||||
jz @F
|
||||
cmp rcx, rdx
|
||||
cmova rcx, rdx
|
||||
sub rdx, rcx
|
||||
rep stosb
|
||||
@@:
|
||||
mov rcx, rdx
|
||||
and rdx, 15
|
||||
shr rcx, 4
|
||||
jz @SetBytes
|
||||
mov ah, al ; ax <- Value repeats twice
|
||||
movd xmm0, eax ; xmm0[0..16] <- Value repeats twice
|
||||
pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times
|
||||
movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times
|
||||
@@:
|
||||
movdqa [rdi], xmm0 ; rdi should be 16-byte aligned
|
||||
add rdi, 16
|
||||
loop @B
|
||||
@SetBytes:
|
||||
mov ecx, edx ; high 32 bits of rcx are always zero
|
||||
rep stosb
|
||||
@SetDone:
|
||||
ret
|
||||
EfiCommonLibSetMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,53 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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 *
|
||||
; EfiCommonLibZeroMem (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Size
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibZeroMem PROC USES rdi
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
mov r8, rdi
|
||||
and edx, 7
|
||||
shr rcx, 3
|
||||
jz @ZeroBytes
|
||||
DB 0fh, 0efh, 0c0h ; pxor mm0, mm0
|
||||
@@:
|
||||
DB 48h, 0fh, 7eh, 07h ; movd [rdi], mm0
|
||||
add rdi, 8
|
||||
loop @B
|
||||
@ZeroBytes:
|
||||
xor eax, eax
|
||||
mov ecx, edx
|
||||
rep stosb
|
||||
mov rax, r8
|
||||
ret
|
||||
EfiCommonLibZeroMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,42 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiZeroMemRep1.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; ZeroMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibZeroMem (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Size
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibZeroMem PROC USES rdi
|
||||
xor rax, rax
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
rep stosb
|
||||
ret
|
||||
EfiCommonLibZeroMem ENDP
|
||||
|
||||
END
|
||||
|
@@ -0,0 +1,46 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2008, 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:
|
||||
#
|
||||
# EfiZeroMemRep4.S
|
||||
#
|
||||
# Abstract:
|
||||
#
|
||||
# ZeroMem function
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#include <EfiBind.h>
|
||||
|
||||
.code:
|
||||
|
||||
.global ASM_PFX(EfiCommonLibZeroMem)
|
||||
#------------------------------------------------------------------------------
|
||||
# VOID
|
||||
# EfiCommonLibZeroMem (
|
||||
# IN VOID *Buffer,
|
||||
# IN UINTN Size
|
||||
# );
|
||||
#------------------------------------------------------------------------------
|
||||
ASM_PFX(EfiCommonLibZeroMem):
|
||||
push %rdi
|
||||
xor %rax,%rax
|
||||
mov %rcx,%rdi
|
||||
mov %rdx,%rcx
|
||||
shr $0x2,%rcx
|
||||
and $0x3,%rdx
|
||||
rep stos %eax,%es:(%rdi)
|
||||
mov %rdx,%rcx
|
||||
rep stos %al,%es:(%rdi)
|
||||
pop %rdi
|
||||
retq
|
@@ -0,0 +1,45 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiZeroMemRep4.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; ZeroMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibZeroMem (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Size
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibZeroMem PROC USES rdi
|
||||
xor rax, rax
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
shr rcx, 2
|
||||
and rdx, 3
|
||||
rep stosd
|
||||
mov rcx, rdx
|
||||
rep stosb
|
||||
ret
|
||||
EfiCommonLibZeroMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,45 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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:
|
||||
;
|
||||
; EfiZeroMemRep8.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; ZeroMem function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EfiCommonLibZeroMem (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Size
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibZeroMem PROC USES rdi
|
||||
xor rax, rax
|
||||
mov rdi, rcx
|
||||
mov rcx, rdx
|
||||
shr rcx, 3
|
||||
and rdx, 7
|
||||
rep stosq
|
||||
mov rcx, rdx
|
||||
rep stosb
|
||||
ret
|
||||
EfiCommonLibZeroMem ENDP
|
||||
|
||||
END
|
@@ -0,0 +1,60 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, 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
|
||||
; EfiCommonLibZeroMem (
|
||||
; IN VOID *Buffer,
|
||||
; IN UINTN Size
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
EfiCommonLibZeroMem PROC USES rdi
|
||||
mov rdi, rcx
|
||||
xor rcx, rcx
|
||||
xor eax, eax
|
||||
sub rcx, rdi
|
||||
and rcx, 15
|
||||
jz @F
|
||||
cmp rcx, rdx
|
||||
cmova rcx, rdx
|
||||
sub rdx, rcx
|
||||
rep stosb
|
||||
@@:
|
||||
mov rcx, rdx
|
||||
and edx, 15
|
||||
shr rcx, 4
|
||||
jz @ZeroBytes
|
||||
pxor xmm0, xmm0
|
||||
@@:
|
||||
movdqa [rdi], xmm0 ; rdi should be 16-byte aligned
|
||||
add rdi, 16
|
||||
loop @B
|
||||
@ZeroBytes:
|
||||
mov ecx, edx
|
||||
rep stosb
|
||||
ret
|
||||
EfiCommonLibZeroMem ENDP
|
||||
|
||||
END
|
Reference in New Issue
Block a user