From: qhuang8 Date: Mon, 3 Nov 2008 09:25:10 +0000 (+0000) Subject: Update to use DOS format X-Git-Tag: edk2-stable201903~19869 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=b1ff428c96518b7f4810eff4688d60ac7c65fba5 Update to use DOS format git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6360 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S index 0447b084f7..62ee83c4ac 100644 --- a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S +++ b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S @@ -1,67 +1,67 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# CpuIdEx.S -# -# Abstract: -# -# AsmCpuidEx function -# -# Notes: -# -#------------------------------------------------------------------------------ - - .686: - .code: - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# AsmCpuidEx ( -# IN UINT32 RegisterInEax, -# IN UINT32 RegisterInEcx, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -.globl ASM_PFX(AsmCpuidEx) -ASM_PFX(AsmCpuidEx): - push %ebx - push %ebp - movl %esp, %ebp - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - cpuid - push %ecx - movl 20(%ebp), %ecx - jecxz L1 - movl %eax, (%ecx) -L1: - movl 24(%ebp), %ecx - jecxz L2 - movl %ebx, (%ecx) -L2: - movl 28(%ebp), %ecx - jecxz L3 - popl (%ecx) -L3: - movl 32(%ebp), %edx - jecxz L4 - movl %edx, (%ecx) -L4: - movl 12(%ebp), %eax - leave - pop %ebx - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# CpuIdEx.S +# +# Abstract: +# +# AsmCpuidEx function +# +# Notes: +# +#------------------------------------------------------------------------------ + + .686: + .code: + +#------------------------------------------------------------------------------ +# UINT32 +# EFIAPI +# AsmCpuidEx ( +# IN UINT32 RegisterInEax, +# IN UINT32 RegisterInEcx, +# OUT UINT32 *RegisterOutEax OPTIONAL, +# OUT UINT32 *RegisterOutEbx OPTIONAL, +# OUT UINT32 *RegisterOutEcx OPTIONAL, +# OUT UINT32 *RegisterOutEdx OPTIONAL +# ) +#------------------------------------------------------------------------------ +.globl ASM_PFX(AsmCpuidEx) +ASM_PFX(AsmCpuidEx): + push %ebx + push %ebp + movl %esp, %ebp + movl 12(%ebp), %eax + movl 16(%ebp), %ecx + cpuid + push %ecx + movl 20(%ebp), %ecx + jecxz L1 + movl %eax, (%ecx) +L1: + movl 24(%ebp), %ecx + jecxz L2 + movl %ebx, (%ecx) +L2: + movl 28(%ebp), %ecx + jecxz L3 + popl (%ecx) +L3: + movl 32(%ebp), %edx + jecxz L4 + movl %edx, (%ecx) +L4: + movl 12(%ebp), %eax + leave + pop %ebx + ret diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32.S b/MdePkg/Library/BaseLib/Ia32/DivU64x32.S index c3f13960cc..d679eafe70 100644 --- a/MdePkg/Library/BaseLib/Ia32/DivU64x32.S +++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32.S @@ -1,41 +1,41 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# DivU64x32.S -# -# Abstract: -# -# Calculate the quotient of a 64-bit integer by a 32-bit integer -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMathDivU64x32) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathDivU64x32 ( -# IN UINT64 Dividend, -# IN UINT32 Divisor -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathDivU64x32): - movl 8(%esp), %eax - movl 12(%esp), %ecx - xorl %edx, %edx - divl %ecx - push %eax # save quotient on stack - movl 8(%esp), %eax - divl %ecx - pop %edx # restore high-order dword of the quotient - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# DivU64x32.S +# +# Abstract: +# +# Calculate the quotient of a 64-bit integer by a 32-bit integer +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMathDivU64x32) + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# InternalMathDivU64x32 ( +# IN UINT64 Dividend, +# IN UINT32 Divisor +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMathDivU64x32): + movl 8(%esp), %eax + movl 12(%esp), %ecx + xorl %edx, %edx + divl %ecx + push %eax # save quotient on stack + movl 8(%esp), %eax + divl %ecx + pop %edx # restore high-order dword of the quotient + ret diff --git a/MdePkg/Library/BaseLib/Ia32/LShiftU64.S b/MdePkg/Library/BaseLib/Ia32/LShiftU64.S index e9ddf6f131..dc99c8bb61 100644 --- a/MdePkg/Library/BaseLib/Ia32/LShiftU64.S +++ b/MdePkg/Library/BaseLib/Ia32/LShiftU64.S @@ -1,41 +1,41 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# LShiftU64.S -# -# Abstract: -# -# 64-bit left shift function for IA-32 -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMathLShiftU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathLShiftU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathLShiftU64): - movb 12(%esp), %cl - xorl %eax, %eax - movl 4(%esp), %edx - testb $32, %cl # Count >= 32? - cmovz %edx, %eax - cmovz 0x8(%esp), %edx - shld %cl, %eax, %edx - shl %cl, %eax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# LShiftU64.S +# +# Abstract: +# +# 64-bit left shift function for IA-32 +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMathLShiftU64) + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# InternalMathLShiftU64 ( +# IN UINT64 Operand, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMathLShiftU64): + movb 12(%esp), %cl + xorl %eax, %eax + movl 4(%esp), %edx + testb $32, %cl # Count >= 32? + cmovz %edx, %eax + cmovz 0x8(%esp), %edx + shld %cl, %eax, %edx + shl %cl, %eax + ret diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.S b/MdePkg/Library/BaseLib/Ia32/LongJump.S index 11f8bd0f99..ba22456512 100644 --- a/MdePkg/Library/BaseLib/Ia32/LongJump.S +++ b/MdePkg/Library/BaseLib/Ia32/LongJump.S @@ -1,41 +1,41 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# LongJump.S -# -# Abstract: -# -# Implementation of _LongJump() on IA-32. -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalLongJump) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalLongJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalLongJump): - pop %eax # skip return address - pop %edx # edx <- JumpBuffer - pop %eax # eax <- Value - movl (%edx), %ebx - movl 4(%edx), %esi - movl 8(%edx), %edi - movl 12(%edx), %ebp - movl 16(%edx), %esp - jmp *20(%edx) # restore "eip" +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# LongJump.S +# +# Abstract: +# +# Implementation of _LongJump() on IA-32. +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalLongJump) + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalLongJump ( +# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, +# IN UINTN Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalLongJump): + pop %eax # skip return address + pop %edx # edx <- JumpBuffer + pop %eax # eax <- Value + movl (%edx), %ebx + movl 4(%edx), %esi + movl 8(%edx), %edi + movl 12(%edx), %ebp + movl 16(%edx), %esp + jmp *20(%edx) # restore "eip" diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x32.S b/MdePkg/Library/BaseLib/Ia32/MultU64x32.S index 16cf86c0dc..857eeb27d7 100644 --- a/MdePkg/Library/BaseLib/Ia32/MultU64x32.S +++ b/MdePkg/Library/BaseLib/Ia32/MultU64x32.S @@ -1,41 +1,41 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# MultU64x32.S -# -# Abstract: -# -# Calculate the product of a 64-bit integer and a 32-bit integer -# -#------------------------------------------------------------------------------ - - .386: - .code: - -.globl ASM_PFX(InternalMathMultU64x32) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathMultU64x32 ( -# IN UINT64 Multiplicand, -# IN UINT32 Multiplier -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathMultU64x32): - movl 12(%esp), %ecx - movl %ecx, %eax - imull 8(%esp), %ecx # overflow not detectable - mull 0x4(%esp) - addl %ecx, %edx - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# MultU64x32.S +# +# Abstract: +# +# Calculate the product of a 64-bit integer and a 32-bit integer +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.globl ASM_PFX(InternalMathMultU64x32) + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# InternalMathMultU64x32 ( +# IN UINT64 Multiplicand, +# IN UINT32 Multiplier +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMathMultU64x32): + movl 12(%esp), %ecx + movl %ecx, %eax + imull 8(%esp), %ecx # overflow not detectable + mull 0x4(%esp) + addl %ecx, %edx + ret diff --git a/MdePkg/Library/BaseLib/Ia32/RShiftU64.S b/MdePkg/Library/BaseLib/Ia32/RShiftU64.S index ecb67e1552..1e747d43a0 100644 --- a/MdePkg/Library/BaseLib/Ia32/RShiftU64.S +++ b/MdePkg/Library/BaseLib/Ia32/RShiftU64.S @@ -1,44 +1,44 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# RShiftU64.S -# -# Abstract: -# -# 64-bit logical right shift function for IA-32 -# -#------------------------------------------------------------------------------ - - .686: - .code: - -.globl ASM_PFX(InternalMathRShiftU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathRShiftU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathRShiftU64): - movb 12(%esp), %cl # cl <- Count - xorl %edx, %edx - movl 8(%esp), %eax - testb $32, %cl # Count >= 32? - cmovz %eax, %edx - cmovz 0x4(%esp), %eax - shrdl %cl, %edx, %eax - shr %cl, %edx - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# RShiftU64.S +# +# Abstract: +# +# 64-bit logical right shift function for IA-32 +# +#------------------------------------------------------------------------------ + + .686: + .code: + +.globl ASM_PFX(InternalMathRShiftU64) + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# InternalMathRShiftU64 ( +# IN UINT64 Operand, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMathRShiftU64): + movb 12(%esp), %cl # cl <- Count + xorl %edx, %edx + movl 8(%esp), %eax + testb $32, %cl # Count >= 32? + cmovz %eax, %edx + cmovz 0x4(%esp), %eax + shrdl %cl, %edx, %eax + shr %cl, %edx + ret diff --git a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S index f08177d97b..31ff35f56d 100644 --- a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S +++ b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S @@ -1,38 +1,38 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# CpuId.S -# -# Abstract: -# -# AsmCpuid function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathSwapBytes64 ( -# IN UINT64 Operand -# ); -#------------------------------------------------------------------------------ -.globl ASM_PFX(InternalMathSwapBytes64) -ASM_PFX(InternalMathSwapBytes64): - movl 8(%esp), %eax # eax <- upper 32 bits - movl 4(%esp), %edx # edx <- lower 32 bits - bswapl %eax - bswapl %edx - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# CpuId.S +# +# Abstract: +# +# AsmCpuid function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# InternalMathSwapBytes64 ( +# IN UINT64 Operand +# ); +#------------------------------------------------------------------------------ +.globl ASM_PFX(InternalMathSwapBytes64) +ASM_PFX(InternalMathSwapBytes64): + movl 8(%esp), %eax # eax <- upper 32 bits + movl 4(%esp), %edx # edx <- lower 32 bits + bswapl %eax + bswapl %edx + ret diff --git a/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S b/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S index a4ac2f16f7..393488e5aa 100644 --- a/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S +++ b/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S @@ -1,25 +1,25 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# CpuBreakpoint.S -# -# Abstract: -# -# Implementation of CpuBreakpoint() on x86_64 -# -#------------------------------------------------------------------------------ - -.global ASM_PFX(CpuBreakpoint) -ASM_PFX(CpuBreakpoint): - int $0x3 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# CpuBreakpoint.S +# +# Abstract: +# +# Implementation of CpuBreakpoint() on x86_64 +# +#------------------------------------------------------------------------------ + +.global ASM_PFX(CpuBreakpoint) +ASM_PFX(CpuBreakpoint): + int $0x3 + ret diff --git a/MdePkg/Library/BaseLib/X64/CpuId.S b/MdePkg/Library/BaseLib/X64/CpuId.S index bd0d8d0ae3..d417d25963 100644 --- a/MdePkg/Library/BaseLib/X64/CpuId.S +++ b/MdePkg/Library/BaseLib/X64/CpuId.S @@ -1,60 +1,60 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# CpuId.S -# -# Abstract: -# -# AsmCpuid function -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmCpuid ( -# IN UINT32 RegisterInEax, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmCpuid) -ASM_PFX(AsmCpuid): - push %rbx - mov %ecx, %eax - push %rax # save Index on stack - push %rdx - cpuid - test %r9, %r9 - jz L1 - mov %ecx, (%r9) -L1: - pop %rcx - jrcxz L2 - mov %eax, (%rcx) -L2: - mov %r8, %rcx - jrcxz L3 - mov %ebx, (%rcx) -L3: - mov 0x38(%rsp), %rcx - jrcxz L4 - mov %edx, (%rcx) -L4: - pop %rax # restore Index to rax as return value - pop %rbx - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# CpuId.S +# +# Abstract: +# +# AsmCpuid function +# +# Notes: +# +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmCpuid ( +# IN UINT32 RegisterInEax, +# OUT UINT32 *RegisterOutEax OPTIONAL, +# OUT UINT32 *RegisterOutEbx OPTIONAL, +# OUT UINT32 *RegisterOutEcx OPTIONAL, +# OUT UINT32 *RegisterOutEdx OPTIONAL +# ) +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmCpuid) +ASM_PFX(AsmCpuid): + push %rbx + mov %ecx, %eax + push %rax # save Index on stack + push %rdx + cpuid + test %r9, %r9 + jz L1 + mov %ecx, (%r9) +L1: + pop %rcx + jrcxz L2 + mov %eax, (%rcx) +L2: + mov %r8, %rcx + jrcxz L3 + mov %ebx, (%rcx) +L3: + mov 0x38(%rsp), %rcx + jrcxz L4 + mov %edx, (%rcx) +L4: + pop %rax # restore Index to rax as return value + pop %rbx + ret diff --git a/MdePkg/Library/BaseLib/X64/CpuIdEx.S b/MdePkg/Library/BaseLib/X64/CpuIdEx.S index 32abf114db..8dd70b2539 100644 --- a/MdePkg/Library/BaseLib/X64/CpuIdEx.S +++ b/MdePkg/Library/BaseLib/X64/CpuIdEx.S @@ -1,62 +1,62 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# CpuIdEx.S -# -# Abstract: -# -# AsmCpuidEx function -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# AsmCpuidEx ( -# IN UINT32 RegisterInEax, -# IN UINT32 RegisterInEcx, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmCpuidEx) -ASM_PFX(AsmCpuidEx): - push %rbx - movl %ecx,%eax - movl %edx,%ecx - push %rax # save Index on stack - cpuid - mov 0x38(%rsp), %r10 - test %r10, %r10 - jz L1 - mov %ecx,(%r10) -L1: - mov %r8, %rcx - jrcxz L2 - movl %eax,(%rcx) -L2: - mov %r9, %rcx - jrcxz L3 - mov %ebx, (%rcx) -L3: - mov 0x40(%rsp), %rcx - jrcxz L4 - mov %edx, (%rcx) -L4: - pop %rax # restore Index to rax as return value - pop %rbx - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# CpuIdEx.S +# +# Abstract: +# +# AsmCpuidEx function +# +# Notes: +# +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# UINT32 +# EFIAPI +# AsmCpuidEx ( +# IN UINT32 RegisterInEax, +# IN UINT32 RegisterInEcx, +# OUT UINT32 *RegisterOutEax OPTIONAL, +# OUT UINT32 *RegisterOutEbx OPTIONAL, +# OUT UINT32 *RegisterOutEcx OPTIONAL, +# OUT UINT32 *RegisterOutEdx OPTIONAL +# ) +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmCpuidEx) +ASM_PFX(AsmCpuidEx): + push %rbx + movl %ecx,%eax + movl %edx,%ecx + push %rax # save Index on stack + cpuid + mov 0x38(%rsp), %r10 + test %r10, %r10 + jz L1 + mov %ecx,(%r10) +L1: + mov %r8, %rcx + jrcxz L2 + movl %eax,(%rcx) +L2: + mov %r9, %rcx + jrcxz L3 + mov %ebx, (%rcx) +L3: + mov 0x40(%rsp), %rcx + jrcxz L4 + mov %edx, (%rcx) +L4: + pop %rax # restore Index to rax as return value + pop %rbx + ret diff --git a/MdePkg/Library/BaseLib/X64/DisablePaging64.S b/MdePkg/Library/BaseLib/X64/DisablePaging64.S index e4f77970ed..a55059e3be 100644 --- a/MdePkg/Library/BaseLib/X64/DisablePaging64.S +++ b/MdePkg/Library/BaseLib/X64/DisablePaging64.S @@ -1,65 +1,65 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# DisablePaging64.S -# -# Abstract: -# -# AsmDisablePaging64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86DisablePaging64 ( -# IN UINT16 Cs, -# IN UINT64 EntryPoint, -# IN UINT64 Context1, OPTIONAL -# IN UINT32 Context2, OPTIONAL -# IN UINT64 NewStack -# ); -#------------------------------------------------------------------------------ - -.global ASM_PFX(InternalX86DisablePaging64) -ASM_PFX(InternalX86DisablePaging64): - cli - shl $0x20,%rcx # rcx[32..47] <- Cs - lea L1, %eax +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# DisablePaging64.S +# +# Abstract: +# +# AsmDisablePaging64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86DisablePaging64 ( +# IN UINT16 Cs, +# IN UINT64 EntryPoint, +# IN UINT64 Context1, OPTIONAL +# IN UINT32 Context2, OPTIONAL +# IN UINT64 NewStack +# ); +#------------------------------------------------------------------------------ + +.global ASM_PFX(InternalX86DisablePaging64) +ASM_PFX(InternalX86DisablePaging64): + cli + shl $0x20,%rcx # rcx[32..47] <- Cs + lea L1, %eax mov %r8d, %esi or %rax, %rcx # rcx[0..47] <- Cs:@F mov %r9d, %edi mov 0x28(%rsp), %eax # eax <- New Stack push %rcx ret # switch to compatibility mode -L1: - mov %eax,%esp # set up new stack - mov %cr0,%rax - btr $0x1f,%eax - mov %rax,%cr0 # disable paging - mov $0xc0000080,%ecx - rdmsr - and $0xfe,%ah # clear LME - wrmsr - mov %cr4,%rax - and $0xdf,%al # clear PAE - mov %rax,%cr4 - push %rdi # push Context2 - push %rsi # push Context1 - callq *%rdx # transfer control to EntryPoint - jmp . # no one should get here - +L1: + mov %eax,%esp # set up new stack + mov %cr0,%rax + btr $0x1f,%eax + mov %rax,%cr0 # disable paging + mov $0xc0000080,%ecx + rdmsr + and $0xfe,%ah # clear LME + wrmsr + mov %cr4,%rax + and $0xdf,%al # clear PAE + mov %rax,%cr4 + push %rdi # push Context2 + push %rsi # push Context1 + callq *%rdx # transfer control to EntryPoint + jmp . # no one should get here + diff --git a/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S b/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S index d87d778cd2..c5f0c05ff2 100644 --- a/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S +++ b/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# EnableDisableInterrupts.S -# -# Abstract: -# -# EnableDisableInterrupts function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# EnableDisableInterrupts ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(EnableDisableInterrupts) -.align 16 -ASM_PFX(EnableDisableInterrupts): - sti - cli - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# EnableDisableInterrupts.S +# +# Abstract: +# +# EnableDisableInterrupts function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# EnableDisableInterrupts ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(EnableDisableInterrupts) +.align 16 +ASM_PFX(EnableDisableInterrupts): + sti + cli + ret diff --git a/MdePkg/Library/BaseLib/X64/EnableInterrupts.S b/MdePkg/Library/BaseLib/X64/EnableInterrupts.S index 220976fe20..7d42ca306b 100644 --- a/MdePkg/Library/BaseLib/X64/EnableInterrupts.S +++ b/MdePkg/Library/BaseLib/X64/EnableInterrupts.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# EnableInterrupts.S -# -# Abstract: -# -# EnableInterrupts function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# EnableInterrupts ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(EnableInterrupts) -ASM_PFX(EnableInterrupts): - sti - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# EnableInterrupts.S +# +# Abstract: +# +# EnableInterrupts function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# EnableInterrupts ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(EnableInterrupts) +ASM_PFX(EnableInterrupts): + sti + ret diff --git a/MdePkg/Library/BaseLib/X64/EnablePaging64.S b/MdePkg/Library/BaseLib/X64/EnablePaging64.S index 6a66aba3f7..82c6eb75b4 100644 --- a/MdePkg/Library/BaseLib/X64/EnablePaging64.S +++ b/MdePkg/Library/BaseLib/X64/EnablePaging64.S @@ -1,61 +1,61 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# EnablePaging64.S -# -# Abstract: -# -# AsmEnablePaging64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86EnablePaging64 ( -# IN UINT16 Cs, -# IN UINT64 EntryPoint, -# IN UINT64 Context1, OPTIONAL -# IN UINT64 Context2, OPTIONAL -# IN UINT64 NewStack -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86EnablePaging64) -ASM_PFX(InternalX86EnablePaging64): - cli - pop %rax # skip the return address - callq Base -Base: - addl $(L1-Base),(%rsp) # offset for ret, seg is the 1st arg - mov %cr4,%rax - or $0x20,%al - mov %rax,%cr4 # enable PAE - mov $0xc0000080,%ecx - rdmsr - or $0x1,%ah # set LME - wrmsr - mov %cr0,%rax - bts $0x1f,%eax - mov %rax,%cr0 # enable paging - lret -L1: # long mode starts here - addr32 mov (%esp),%rbx - addr32 mov 0x8(%esp),%rcx - addr32 mov 0x10(%esp),%rdx - addr32 mov 0x18(%esp),%rsp - add $-0x20,%rsp - callq *%rbx - jmp . # dead loop if EntryPoint() returned +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# EnablePaging64.S +# +# Abstract: +# +# AsmEnablePaging64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86EnablePaging64 ( +# IN UINT16 Cs, +# IN UINT64 EntryPoint, +# IN UINT64 Context1, OPTIONAL +# IN UINT64 Context2, OPTIONAL +# IN UINT64 NewStack +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86EnablePaging64) +ASM_PFX(InternalX86EnablePaging64): + cli + pop %rax # skip the return address + callq Base +Base: + addl $(L1-Base),(%rsp) # offset for ret, seg is the 1st arg + mov %cr4,%rax + or $0x20,%al + mov %rax,%cr4 # enable PAE + mov $0xc0000080,%ecx + rdmsr + or $0x1,%ah # set LME + wrmsr + mov %cr0,%rax + bts $0x1f,%eax + mov %rax,%cr0 # enable paging + lret +L1: # long mode starts here + addr32 mov (%esp),%rbx + addr32 mov 0x8(%esp),%rcx + addr32 mov 0x10(%esp),%rdx + addr32 mov 0x18(%esp),%rsp + add $-0x20,%rsp + callq *%rbx + jmp . # dead loop if EntryPoint() returned diff --git a/MdePkg/Library/BaseLib/X64/FlushCacheLine.S b/MdePkg/Library/BaseLib/X64/FlushCacheLine.S index fa6cfb2e67..ad79ec1724 100644 --- a/MdePkg/Library/BaseLib/X64/FlushCacheLine.S +++ b/MdePkg/Library/BaseLib/X64/FlushCacheLine.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# FlushCacheLine.S -# -# Abstract: -# -# AsmFlushCacheLine function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# AsmFlushCacheLine ( -# IN VOID *LinearAddress -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmFlushCacheLine) -ASM_PFX(AsmFlushCacheLine): - clflush (%rcx) - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# FlushCacheLine.S +# +# Abstract: +# +# AsmFlushCacheLine function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# AsmFlushCacheLine ( +# IN VOID *LinearAddress +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmFlushCacheLine) +ASM_PFX(AsmFlushCacheLine): + clflush (%rcx) + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/FxRestore.S b/MdePkg/Library/BaseLib/X64/FxRestore.S index 4497fe6f48..6b5daaf917 100644 --- a/MdePkg/Library/BaseLib/X64/FxRestore.S +++ b/MdePkg/Library/BaseLib/X64/FxRestore.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# FxRestore.S -# -# Abstract: -# -# AsmFxRestore function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86FxRestore ( -# IN CONST IA32_FX_BUFFER *Buffer -# )# -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86FxRestore) -ASM_PFX(InternalX86FxRestore): - fxrstor (%rcx) - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# FxRestore.S +# +# Abstract: +# +# AsmFxRestore function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86FxRestore ( +# IN CONST IA32_FX_BUFFER *Buffer +# )# +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86FxRestore) +ASM_PFX(InternalX86FxRestore): + fxrstor (%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/FxSave.S b/MdePkg/Library/BaseLib/X64/FxSave.S index 0e8e1fc2d7..e0961e9808 100644 --- a/MdePkg/Library/BaseLib/X64/FxSave.S +++ b/MdePkg/Library/BaseLib/X64/FxSave.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# FxSave.S -# -# Abstract: -# -# AsmFxSave function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86FxSave ( -# OUT IA32_FX_BUFFER *Buffer -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86FxSave) -ASM_PFX(InternalX86FxSave): - fxsave (%rcx) - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# FxSave.S +# +# Abstract: +# +# AsmFxSave function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86FxSave ( +# OUT IA32_FX_BUFFER *Buffer +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86FxSave) +ASM_PFX(InternalX86FxSave): + fxsave (%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S b/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S index 2034b670f1..5e6e163527 100644 --- a/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S +++ b/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S @@ -1,39 +1,39 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# InterlockedCompareExchange64.S -# -# Abstract: -# -# InterlockedCompareExchange64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InterlockedCompareExchange64 ( -# IN UINT64 *Value, -# IN UINT64 CompareValue, -# IN UINT64 ExchangeValue -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalSyncCompareExchange64) -.align 16 -ASM_PFX(InternalSyncCompareExchange64): - mov %rdx, %rax - lock cmpxchg %r8,(%rcx) - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# InterlockedCompareExchange64.S +# +# Abstract: +# +# InterlockedCompareExchange64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# InterlockedCompareExchange64 ( +# IN UINT64 *Value, +# IN UINT64 CompareValue, +# IN UINT64 ExchangeValue +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalSyncCompareExchange64) +.align 16 +ASM_PFX(InternalSyncCompareExchange64): + mov %rdx, %rax + lock cmpxchg %r8,(%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S b/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S index c3075bf902..321529b9fd 100644 --- a/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S +++ b/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# InterlockedDecrement.S -# -# Abstract: -# -# InterlockedDecrement function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# InterlockedDecrement ( -# IN UINT32 *Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalSyncDecrement) -ASM_PFX(InternalSyncDecrement): - lock decl (%rcx) - mov (%rcx), %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# InterlockedDecrement.S +# +# Abstract: +# +# InterlockedDecrement function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT32 +# EFIAPI +# InterlockedDecrement ( +# IN UINT32 *Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalSyncDecrement) +ASM_PFX(InternalSyncDecrement): + lock decl (%rcx) + mov (%rcx), %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S b/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S index 6b95ed429f..5930101929 100644 --- a/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S +++ b/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# InterlockedIncrement.S -# -# Abstract: -# -# InterlockedIncrement function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# InterlockedIncrement ( -# IN UINT32 *Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalSyncIncrement) -ASM_PFX(InternalSyncIncrement): - lock incl (%rcx) - mov (%rcx), %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# InterlockedIncrement.S +# +# Abstract: +# +# InterlockedIncrement function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT32 +# EFIAPI +# InterlockedIncrement ( +# IN UINT32 *Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalSyncIncrement) +ASM_PFX(InternalSyncIncrement): + lock incl (%rcx) + mov (%rcx), %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/Invd.S b/MdePkg/Library/BaseLib/X64/Invd.S index fc1cad6e59..843cbf1fcc 100644 --- a/MdePkg/Library/BaseLib/X64/Invd.S +++ b/MdePkg/Library/BaseLib/X64/Invd.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# Invd.S -# -# Abstract: -# -# AsmInvd function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmInvd ( -# VOID -# )# -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmInvd) -ASM_PFX(AsmInvd): - invd - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# Invd.S +# +# Abstract: +# +# AsmInvd function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmInvd ( +# VOID +# )# +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmInvd) +ASM_PFX(AsmInvd): + invd + ret diff --git a/MdePkg/Library/BaseLib/X64/Monitor.S b/MdePkg/Library/BaseLib/X64/Monitor.S index f31cbeb7f7..0a8ad3ed9f 100644 --- a/MdePkg/Library/BaseLib/X64/Monitor.S +++ b/MdePkg/Library/BaseLib/X64/Monitor.S @@ -1,41 +1,41 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# Monitor.S -# -# Abstract: -# -# AsmMonitor function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmMonitor ( -# IN UINTN Eax, -# IN UINTN Ecx, -# IN UINTN Edx -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmMonitor) -.align 16 -ASM_PFX(AsmMonitor): - mov %ecx,%eax - mov %edx,%ecx - mov %r8d,%edx - monitor - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# Monitor.S +# +# Abstract: +# +# AsmMonitor function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmMonitor ( +# IN UINTN Eax, +# IN UINTN Ecx, +# IN UINTN Edx +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmMonitor) +.align 16 +ASM_PFX(AsmMonitor): + mov %ecx,%eax + mov %edx,%ecx + mov %r8d,%edx + monitor + ret diff --git a/MdePkg/Library/BaseLib/X64/Mwait.S b/MdePkg/Library/BaseLib/X64/Mwait.S index ac5f54900f..6967cb2d48 100644 --- a/MdePkg/Library/BaseLib/X64/Mwait.S +++ b/MdePkg/Library/BaseLib/X64/Mwait.S @@ -1,39 +1,39 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# Mwait.S -# -# Abstract: -# -# AsmMwait function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmMwait ( -# IN UINTN Eax, -# IN UINTN Ecx -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmMwait) -.align 16 -ASM_PFX(AsmMwait): - mov %ecx,%eax - mov %edx,%ecx - mwait %rax,%rcx - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# Mwait.S +# +# Abstract: +# +# AsmMwait function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmMwait ( +# IN UINTN Eax, +# IN UINTN Ecx +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmMwait) +.align 16 +ASM_PFX(AsmMwait): + mov %ecx,%eax + mov %edx,%ecx + mwait %rax,%rcx + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadCr0.S b/MdePkg/Library/BaseLib/X64/ReadCr0.S index 723869ad56..81824e0ca0 100644 --- a/MdePkg/Library/BaseLib/X64/ReadCr0.S +++ b/MdePkg/Library/BaseLib/X64/ReadCr0.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadCr0.S -# -# Abstract: -# -# AsmReadCr0 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadCr0 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadCr0) -.align 16 -ASM_PFX(AsmReadCr0): - mov %cr0, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadCr0.S +# +# Abstract: +# +# AsmReadCr0 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadCr0 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadCr0) +.align 16 +ASM_PFX(AsmReadCr0): + mov %cr0, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadCr2.S b/MdePkg/Library/BaseLib/X64/ReadCr2.S index e50a5a57b1..bf7446c99b 100644 --- a/MdePkg/Library/BaseLib/X64/ReadCr2.S +++ b/MdePkg/Library/BaseLib/X64/ReadCr2.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadCr2.S -# -# Abstract: -# -# AsmReadCr2 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadCr2 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadCr2) -.align 16 -ASM_PFX(AsmReadCr2): - mov %cr2, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadCr2.S +# +# Abstract: +# +# AsmReadCr2 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadCr2 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadCr2) +.align 16 +ASM_PFX(AsmReadCr2): + mov %cr2, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadCr3.S b/MdePkg/Library/BaseLib/X64/ReadCr3.S index 6de241b395..4fcdb04536 100644 --- a/MdePkg/Library/BaseLib/X64/ReadCr3.S +++ b/MdePkg/Library/BaseLib/X64/ReadCr3.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadCr3.S -# -# Abstract: -# -# AsmReadCr3 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadCr3 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadCr3) -.align 16 -ASM_PFX(AsmReadCr3): - mov %cr3, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadCr3.S +# +# Abstract: +# +# AsmReadCr3 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadCr3 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadCr3) +.align 16 +ASM_PFX(AsmReadCr3): + mov %cr3, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadCr4.S b/MdePkg/Library/BaseLib/X64/ReadCr4.S index 467ab14ee9..21fe62d993 100644 --- a/MdePkg/Library/BaseLib/X64/ReadCr4.S +++ b/MdePkg/Library/BaseLib/X64/ReadCr4.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadCr4.S -# -# Abstract: -# -# AsmReadCr4 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadCr4 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadCr4) -.align 16 -ASM_PFX(AsmReadCr4): - mov %cr4, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadCr4.S +# +# Abstract: +# +# AsmReadCr4 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadCr4 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadCr4) +.align 16 +ASM_PFX(AsmReadCr4): + mov %cr4, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadCs.S b/MdePkg/Library/BaseLib/X64/ReadCs.S index 88ad7da4f8..ee66f1e8a1 100644 --- a/MdePkg/Library/BaseLib/X64/ReadCs.S +++ b/MdePkg/Library/BaseLib/X64/ReadCs.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadCs.S -# -# Abstract: -# -# AsmReadCs function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadCs ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadCs) -.align 16 -ASM_PFX(AsmReadCs): - mov %cs, %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadCs.S +# +# Abstract: +# +# AsmReadCs function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadCs ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadCs) +.align 16 +ASM_PFX(AsmReadCs): + mov %cs, %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr0.S b/MdePkg/Library/BaseLib/X64/ReadDr0.S index 2e537a4da6..07f1766e9e 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr0.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr0.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr0.S -# -# Abstract: -# -# AsmReadDr0 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr0 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr0) -.align 16 -ASM_PFX(AsmReadDr0): - mov %dr0, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr0.S +# +# Abstract: +# +# AsmReadDr0 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr0 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr0) +.align 16 +ASM_PFX(AsmReadDr0): + mov %dr0, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr1.S b/MdePkg/Library/BaseLib/X64/ReadDr1.S index 6295c4bc02..400e193eda 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr1.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr1.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr1.S -# -# Abstract: -# -# AsmReadDr1 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr1 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr1) -.align 16 -ASM_PFX(AsmReadDr1): - mov %dr1, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr1.S +# +# Abstract: +# +# AsmReadDr1 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr1 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr1) +.align 16 +ASM_PFX(AsmReadDr1): + mov %dr1, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr2.S b/MdePkg/Library/BaseLib/X64/ReadDr2.S index 2942e5c775..677ec16801 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr2.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr2.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr2.S -# -# Abstract: -# -# AsmReadDr2 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr2 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr2) -.align 16 -ASM_PFX(AsmReadDr2): - mov %dr2, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr2.S +# +# Abstract: +# +# AsmReadDr2 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr2 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr2) +.align 16 +ASM_PFX(AsmReadDr2): + mov %dr2, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr3.S b/MdePkg/Library/BaseLib/X64/ReadDr3.S index 9907963414..8feb9c04b3 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr3.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr3.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr3.S -# -# Abstract: -# -# AsmReadDr3 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr3 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr3) -.align 16 -ASM_PFX(AsmReadDr3): - mov %dr3, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr3.S +# +# Abstract: +# +# AsmReadDr3 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr3 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr3) +.align 16 +ASM_PFX(AsmReadDr3): + mov %dr3, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr4.S b/MdePkg/Library/BaseLib/X64/ReadDr4.S index d1bd8ea34f..bc67bbe581 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr4.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr4.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr4.S -# -# Abstract: -# -# AsmReadDr4 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr4 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr4) -.align 16 -ASM_PFX(AsmReadDr4): - #DB 0fh, 21h, 0e0h - mov %dr4, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr4.S +# +# Abstract: +# +# AsmReadDr4 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr4 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr4) +.align 16 +ASM_PFX(AsmReadDr4): + #DB 0fh, 21h, 0e0h + mov %dr4, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr5.S b/MdePkg/Library/BaseLib/X64/ReadDr5.S index 94475addea..bf65b4e83d 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr5.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr5.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr5.S -# -# Abstract: -# -# AsmReadDr5 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr5 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr5) -.align 16 -ASM_PFX(AsmReadDr5): - mov %dr5, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr5.S +# +# Abstract: +# +# AsmReadDr5 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr5 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr5) +.align 16 +ASM_PFX(AsmReadDr5): + mov %dr5, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr6.S b/MdePkg/Library/BaseLib/X64/ReadDr6.S index ef0dc71697..f1d12aaa51 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr6.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr6.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr6.S -# -# Abstract: -# -# AsmReadDr6 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr6 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr6) -.align 16 -ASM_PFX(AsmReadDr6): - mov %dr6, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr6.S +# +# Abstract: +# +# AsmReadDr6 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr6 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr6) +.align 16 +ASM_PFX(AsmReadDr6): + mov %dr6, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDr7.S b/MdePkg/Library/BaseLib/X64/ReadDr7.S index 60c9ed9c53..34fdb67db6 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr7.S +++ b/MdePkg/Library/BaseLib/X64/ReadDr7.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDr7.S -# -# Abstract: -# -# AsmReadDr7 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadDr7 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDr7) -.align 16 -ASM_PFX(AsmReadDr7): - mov %dr7, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDr7.S +# +# Abstract: +# +# AsmReadDr7 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadDr7 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDr7) +.align 16 +ASM_PFX(AsmReadDr7): + mov %dr7, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadDs.S b/MdePkg/Library/BaseLib/X64/ReadDs.S index c9ef401efc..8f6576ab2d 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDs.S +++ b/MdePkg/Library/BaseLib/X64/ReadDs.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadDs.S -# -# Abstract: -# -# AsmReadDs function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadDs ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadDs) -.align 16 -ASM_PFX(AsmReadDs): - movl %ds, %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadDs.S +# +# Abstract: +# +# AsmReadDs function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadDs ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadDs) +.align 16 +ASM_PFX(AsmReadDs): + movl %ds, %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadEflags.S b/MdePkg/Library/BaseLib/X64/ReadEflags.S index e5bd4bde3e..88d467965a 100644 --- a/MdePkg/Library/BaseLib/X64/ReadEflags.S +++ b/MdePkg/Library/BaseLib/X64/ReadEflags.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadEflags.S -# -# Abstract: -# -# AsmReadEflags function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmReadEflags ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadEflags) -.align 16 -ASM_PFX(AsmReadEflags): - pushfq - pop %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadEflags.S +# +# Abstract: +# +# AsmReadEflags function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmReadEflags ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadEflags) +.align 16 +ASM_PFX(AsmReadEflags): + pushfq + pop %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadEs.S b/MdePkg/Library/BaseLib/X64/ReadEs.S index f98e577f9c..efdd65ec1c 100644 --- a/MdePkg/Library/BaseLib/X64/ReadEs.S +++ b/MdePkg/Library/BaseLib/X64/ReadEs.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadEs.S -# -# Abstract: -# -# AsmReadEs function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadEs ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadEs) -.align 16 -ASM_PFX(AsmReadEs): - mov %es, %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadEs.S +# +# Abstract: +# +# AsmReadEs function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadEs ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadEs) +.align 16 +ASM_PFX(AsmReadEs): + mov %es, %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadFs.S b/MdePkg/Library/BaseLib/X64/ReadFs.S index 28b288f2dd..6bd92a04ff 100644 --- a/MdePkg/Library/BaseLib/X64/ReadFs.S +++ b/MdePkg/Library/BaseLib/X64/ReadFs.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadFs.S -# -# Abstract: -# -# AsmReadFs function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadFs ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadFs) -.align 16 -ASM_PFX(AsmReadFs): - mov %fs, %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadFs.S +# +# Abstract: +# +# AsmReadFs function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadFs ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadFs) +.align 16 +ASM_PFX(AsmReadFs): + mov %fs, %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadGdtr.S b/MdePkg/Library/BaseLib/X64/ReadGdtr.S index 08f3fdf3b5..8da4f0c6e5 100644 --- a/MdePkg/Library/BaseLib/X64/ReadGdtr.S +++ b/MdePkg/Library/BaseLib/X64/ReadGdtr.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadGdtr.S -# -# Abstract: -# -# AsmReadGdtr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86ReadGdtr ( -# OUT IA32_DESCRIPTOR *Gdtr -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86ReadGdtr) -.align 16 -ASM_PFX(InternalX86ReadGdtr): - sgdt (%rcx) - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadGdtr.S +# +# Abstract: +# +# AsmReadGdtr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86ReadGdtr ( +# OUT IA32_DESCRIPTOR *Gdtr +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86ReadGdtr) +.align 16 +ASM_PFX(InternalX86ReadGdtr): + sgdt (%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadGs.S b/MdePkg/Library/BaseLib/X64/ReadGs.S index cb119e8989..691f0b7023 100644 --- a/MdePkg/Library/BaseLib/X64/ReadGs.S +++ b/MdePkg/Library/BaseLib/X64/ReadGs.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadGs.S -# -# Abstract: -# -# AsmReadGs function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadGs ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadGs) -.align 16 -ASM_PFX(AsmReadGs): - mov %gs, %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadGs.S +# +# Abstract: +# +# AsmReadGs function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadGs ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadGs) +.align 16 +ASM_PFX(AsmReadGs): + mov %gs, %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadIdtr.S b/MdePkg/Library/BaseLib/X64/ReadIdtr.S index 04f08e6f11..326d59e91b 100644 --- a/MdePkg/Library/BaseLib/X64/ReadIdtr.S +++ b/MdePkg/Library/BaseLib/X64/ReadIdtr.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadIdtr.AS -# -# Abstract: -# -# AsmReadIdtr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86ReadIdtr ( -# OUT IA32_DESCRIPTOR *Idtr -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86ReadIdtr) -.align 16 -ASM_PFX(InternalX86ReadIdtr): - sidt (%rcx) - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadIdtr.AS +# +# Abstract: +# +# AsmReadIdtr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86ReadIdtr ( +# OUT IA32_DESCRIPTOR *Idtr +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86ReadIdtr) +.align 16 +ASM_PFX(InternalX86ReadIdtr): + sidt (%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadLdtr.S b/MdePkg/Library/BaseLib/X64/ReadLdtr.S index ed53d8d845..9fdae8c4dc 100644 --- a/MdePkg/Library/BaseLib/X64/ReadLdtr.S +++ b/MdePkg/Library/BaseLib/X64/ReadLdtr.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadLdtr.AS -# -# Abstract: -# -# AsmReadLdtr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadLdtr ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadLdtr) -.align 16 -ASM_PFX(AsmReadLdtr): - sldt %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadLdtr.AS +# +# Abstract: +# +# AsmReadLdtr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadLdtr ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadLdtr) +.align 16 +ASM_PFX(AsmReadLdtr): + sldt %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm0.S b/MdePkg/Library/BaseLib/X64/ReadMm0.S index 1a2de9f536..83bc3a876b 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm0.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm0.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm0.S -# -# Abstract: -# -# AsmReadMm0 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm0 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm0) -.align 16 -ASM_PFX(AsmReadMm0): - movd %mm0, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm0.S +# +# Abstract: +# +# AsmReadMm0 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm0 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm0) +.align 16 +ASM_PFX(AsmReadMm0): + movd %mm0, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm1.S b/MdePkg/Library/BaseLib/X64/ReadMm1.S index a50e0c319c..1640aa8cca 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm1.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm1.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm1.S -# -# Abstract: -# -# AsmReadMm1 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm1 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm1) -.align 16 -ASM_PFX(AsmReadMm1): - movd %mm1, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm1.S +# +# Abstract: +# +# AsmReadMm1 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm1 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm1) +.align 16 +ASM_PFX(AsmReadMm1): + movd %mm1, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm2.S b/MdePkg/Library/BaseLib/X64/ReadMm2.S index 88d829e904..2c9166f09a 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm2.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm2.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm2.S -# -# Abstract: -# -# AsmReadMm2 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm2 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm2) -.align 16 -ASM_PFX(AsmReadMm2): - movd %mm2, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm2.S +# +# Abstract: +# +# AsmReadMm2 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm2 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm2) +.align 16 +ASM_PFX(AsmReadMm2): + movd %mm2, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm3.S b/MdePkg/Library/BaseLib/X64/ReadMm3.S index 4565741d2e..e13c14d8ae 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm3.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm3.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm3.S -# -# Abstract: -# -# AsmReadMm3 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm3 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm3) -.align 16 -ASM_PFX(AsmReadMm3): - movd %mm3, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm3.S +# +# Abstract: +# +# AsmReadMm3 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm3 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm3) +.align 16 +ASM_PFX(AsmReadMm3): + movd %mm3, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm4.S b/MdePkg/Library/BaseLib/X64/ReadMm4.S index 491a876b3f..9f7be77e22 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm4.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm4.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm4.AS -# -# Abstract: -# -# AsmReadMm4 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm4 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm4) -.align 16 -ASM_PFX(AsmReadMm4): - movd %mm4, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm4.AS +# +# Abstract: +# +# AsmReadMm4 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm4 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm4) +.align 16 +ASM_PFX(AsmReadMm4): + movd %mm4, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm5.S b/MdePkg/Library/BaseLib/X64/ReadMm5.S index ac2119d649..18fcbfce00 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm5.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm5.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm5.S -# -# Abstract: -# -# AsmReadMm5 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm5 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm5) -.align 16 -ASM_PFX(AsmReadMm5): - movd %mm5, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm5.S +# +# Abstract: +# +# AsmReadMm5 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm5 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm5) +.align 16 +ASM_PFX(AsmReadMm5): + movd %mm5, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm6.S b/MdePkg/Library/BaseLib/X64/ReadMm6.S index 1816c93301..7966c7b9b0 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm6.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm6.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm6.S -# -# Abstract: -# -# AsmReadMm6 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm6 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm6) -.align 16 -ASM_PFX(AsmReadMm6): - movd %mm6, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm6.S +# +# Abstract: +# +# AsmReadMm6 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm6 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm6) +.align 16 +ASM_PFX(AsmReadMm6): + movd %mm6, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm7.S b/MdePkg/Library/BaseLib/X64/ReadMm7.S index c5465769c4..9feba2023e 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm7.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm7.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# ReadMm7.S -# -# Abstract: -# -# AsmReadMm7 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMm7 ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMm7) -.align 16 -ASM_PFX(AsmReadMm7): - movd %mm7, %rax - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# ReadMm7.S +# +# Abstract: +# +# AsmReadMm7 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMm7 ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMm7) +.align 16 +ASM_PFX(AsmReadMm7): + movd %mm7, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.S b/MdePkg/Library/BaseLib/X64/ReadMsr64.S index bcb3836943..eecffd904d 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMsr64.S +++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.S @@ -1,38 +1,38 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadMsr64.S -# -# Abstract: -# -# AsmReadMsr64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadMsr64 ( -# IN UINT32 Index -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadMsr64) -.align 16 -ASM_PFX(AsmReadMsr64): - rdmsr # edx & eax are zero extended - shl $0x20, %rdx - or %rdx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadMsr64.S +# +# Abstract: +# +# AsmReadMsr64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadMsr64 ( +# IN UINT32 Index +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadMsr64) +.align 16 +ASM_PFX(AsmReadMsr64): + rdmsr # edx & eax are zero extended + shl $0x20, %rdx + or %rdx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadPmc.S b/MdePkg/Library/BaseLib/X64/ReadPmc.S index 3a75dbc543..f7c663381c 100644 --- a/MdePkg/Library/BaseLib/X64/ReadPmc.S +++ b/MdePkg/Library/BaseLib/X64/ReadPmc.S @@ -1,38 +1,38 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadPmc.S -# -# Abstract: -# -# AsmReadPmc function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadPmc ( -# IN UINT32 PmcIndex -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadPmc) -.align 16 -ASM_PFX(AsmReadPmc): - rdpmc - shl $0x20, %rdx - or %rdx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadPmc.S +# +# Abstract: +# +# AsmReadPmc function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadPmc ( +# IN UINT32 PmcIndex +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadPmc) +.align 16 +ASM_PFX(AsmReadPmc): + rdpmc + shl $0x20, %rdx + or %rdx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadSs.S b/MdePkg/Library/BaseLib/X64/ReadSs.S index 4e429ad396..2cb4090057 100644 --- a/MdePkg/Library/BaseLib/X64/ReadSs.S +++ b/MdePkg/Library/BaseLib/X64/ReadSs.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadSs.S -# -# Abstract: -# -# AsmReadSs function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadSs ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadSs) -.align 16 -ASM_PFX(AsmReadSs): - movl %ss, %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadSs.S +# +# Abstract: +# +# AsmReadSs function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadSs ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadSs) +.align 16 +ASM_PFX(AsmReadSs): + movl %ss, %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadTr.S b/MdePkg/Library/BaseLib/X64/ReadTr.S index ce463d2681..8fadc86867 100644 --- a/MdePkg/Library/BaseLib/X64/ReadTr.S +++ b/MdePkg/Library/BaseLib/X64/ReadTr.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadTr.S -# -# Abstract: -# -# AsmReadTr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT16 -# EFIAPI -# AsmReadTr ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadTr) -.align 16 -ASM_PFX(AsmReadTr): - str %eax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadTr.S +# +# Abstract: +# +# AsmReadTr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT16 +# EFIAPI +# AsmReadTr ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadTr) +.align 16 +ASM_PFX(AsmReadTr): + str %eax + ret diff --git a/MdePkg/Library/BaseLib/X64/ReadTsc.S b/MdePkg/Library/BaseLib/X64/ReadTsc.S index 2f47083674..65be5504ce 100644 --- a/MdePkg/Library/BaseLib/X64/ReadTsc.S +++ b/MdePkg/Library/BaseLib/X64/ReadTsc.S @@ -1,38 +1,38 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# ReadTsc.S -# -# Abstract: -# -# AsmReadTsc function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmReadTsc ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmReadTsc) -.align 16 -ASM_PFX(AsmReadTsc): - rdtsc - shl $0x20, %rdx - or %rdx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# ReadTsc.S +# +# Abstract: +# +# AsmReadTsc function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmReadTsc ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmReadTsc) +.align 16 +ASM_PFX(AsmReadTsc): + rdtsc + shl $0x20, %rdx + or %rdx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/SetJump.S b/MdePkg/Library/BaseLib/X64/SetJump.S index 727a2a5c86..245f940121 100644 --- a/MdePkg/Library/BaseLib/X64/SetJump.S +++ b/MdePkg/Library/BaseLib/X64/SetJump.S @@ -1,42 +1,42 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# SetJump.S -# -# Abstract: -# -# Implementation of SetJump() on x86_64 -# -#------------------------------------------------------------------------------ - -.extern ASM_PFX(InternalAssertJumpBuffer) -.global ASM_PFX(SetJump) -ASM_PFX(SetJump): - push %rcx - add $0xffffffffffffffe0,%rsp - call ASM_PFX(InternalAssertJumpBuffer) - add $0x20,%rsp - pop %rcx - pop %rdx - mov %rbx,(%rcx) - mov %rsp,0x8(%rcx) - mov %rbp,0x10(%rcx) - mov %rdi,0x18(%rcx) - mov %rsi,0x20(%rcx) - mov %r12,0x28(%rcx) - mov %r13,0x30(%rcx) - mov %r14,0x38(%rcx) - mov %r15,0x40(%rcx) - mov %rdx,0x48(%rcx) - xor %rax,%rax - jmpq *%rdx +#------------------------------------------------------------------------------ +# +# 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: +# +# SetJump.S +# +# Abstract: +# +# Implementation of SetJump() on x86_64 +# +#------------------------------------------------------------------------------ + +.extern ASM_PFX(InternalAssertJumpBuffer) +.global ASM_PFX(SetJump) +ASM_PFX(SetJump): + push %rcx + add $0xffffffffffffffe0,%rsp + call ASM_PFX(InternalAssertJumpBuffer) + add $0x20,%rsp + pop %rcx + pop %rdx + mov %rbx,(%rcx) + mov %rsp,0x8(%rcx) + mov %rbp,0x10(%rcx) + mov %rdi,0x18(%rcx) + mov %rsi,0x20(%rcx) + mov %r12,0x28(%rcx) + mov %r13,0x30(%rcx) + mov %r14,0x38(%rcx) + mov %r15,0x40(%rcx) + mov %rdx,0x48(%rcx) + xor %rax,%rax + jmpq *%rdx diff --git a/MdePkg/Library/BaseLib/X64/SwitchStack.S b/MdePkg/Library/BaseLib/X64/SwitchStack.S index 20c02d5b43..e75ddaf965 100644 --- a/MdePkg/Library/BaseLib/X64/SwitchStack.S +++ b/MdePkg/Library/BaseLib/X64/SwitchStack.S @@ -1,48 +1,48 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# SwitchStack.S -# -# Abstract: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Routine Description: -# -# Routine for switching stacks with 2 parameters -# -# Arguments: -# -# (rcx) EntryPoint - Entry point with new stack. -# (rdx) Context1 - Parameter1 for entry point. -# (r8) Context2 - Parameter2 for entry point. -# (r9) NewStack - Pointer to new stack. -# -# Returns: -# -# None -# -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalSwitchStack) -ASM_PFX(InternalSwitchStack): - mov %rcx, %rax - mov %rdx, %rcx - mov %r8, %rdx - # - # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack, - # in case the callee wishes to spill them. - # - lea -0x20(%r9), %rsp - call *%rax +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# SwitchStack.S +# +# Abstract: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# Routine Description: +# +# Routine for switching stacks with 2 parameters +# +# Arguments: +# +# (rcx) EntryPoint - Entry point with new stack. +# (rdx) Context1 - Parameter1 for entry point. +# (r8) Context2 - Parameter2 for entry point. +# (r9) NewStack - Pointer to new stack. +# +# Returns: +# +# None +# +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalSwitchStack) +ASM_PFX(InternalSwitchStack): + mov %rcx, %rax + mov %rdx, %rcx + mov %r8, %rdx + # + # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack, + # in case the callee wishes to spill them. + # + lea -0x20(%r9), %rsp + call *%rax diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.S b/MdePkg/Library/BaseLib/X64/Thunk16.S index 83c121f525..5885bb3a57 100644 --- a/MdePkg/Library/BaseLib/X64/Thunk16.S +++ b/MdePkg/Library/BaseLib/X64/Thunk16.S @@ -1,298 +1,298 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# Thunk16.S -# -# Abstract: -# -# Real mode thunk -# -#------------------------------------------------------------------------------ - -#include - -.globl ASM_PFX(m16Start) -.globl ASM_PFX(m16Size) -.globl ASM_PFX(mThunk16Attr) -.globl ASM_PFX(m16Gdt) -.globl ASM_PFX(m16GdtrBase) -.globl ASM_PFX(mTransition) -.globl ASM_PFX(InternalAsmThunk16) - -# define the structure of IA32_REGS -.equ _EDI, 0 #size 4 -.equ _ESI, 4 #size 4 -.equ _EBP, 8 #size 4 -.equ _ESP, 12 #size 4 -.equ _EBX, 16 #size 4 -.equ _EDX, 20 #size 4 -.equ _ECX, 24 #size 4 -.equ _EAX, 28 #size 4 -.equ _DS, 32 #size 2 -.equ _ES, 34 #size 2 -.equ _FS, 36 #size 2 -.equ _GS, 38 #size 2 -.equ _EFLAGS, 40 #size 8 -.equ _EIP, 48 #size 4 -.equ _CS, 52 #size 2 -.equ _SS, 54 #size 2 -.equ IA32_REGS_SIZE, 56 - - .data - -ASM_PFX(m16Size): .word ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start) -ASM_PFX(mThunk16Attr): .word _ThunkAttr - ASM_PFX(m16Start) -ASM_PFX(m16Gdt): .word _NullSeg - ASM_PFX(m16Start) -ASM_PFX(m16GdtrBase): .word _16GdtrBase - ASM_PFX(m16Start) -ASM_PFX(mTransition): .word _EntryPoint - ASM_PFX(m16Start) - - .text - -ASM_PFX(m16Start): - -SavedGdt: .space 10 - -#------------------------------------------------------------------------------ -# _BackFromUserCode() takes control in real mode after 'retf' has been executed -# by user code. It will be shadowed to somewhere in memory below 1MB. -#------------------------------------------------------------------------------ -.globl ASM_PFX(BackFromUserCode) -ASM_PFX(BackFromUserCode): - # - # The order of saved registers on the stack matches the order they appears - # in IA32_REGS structure. This facilitates wrapper function to extract them - # into that structure. - # - # Some instructions for manipulation of segment registers have to be written - # in opcode since 64-bit MASM prevents accesses to those registers. - # - .byte 0x16 # push ss - .byte 0xe # push cs - .byte 0x66 - call L_Base # push eip -L_Base: - .byte 0x66 - pushq $0 # reserved high order 32 bits of EFlags - .byte 0x66, 0x9c # pushfd actually - cli # disable interrupts - push %gs - push %fs - .byte 6 # push es - .byte 0x1e # push ds - .byte 0x66,0x60 # pushad - .byte 0x66,0xba # mov edx, imm32 -_ThunkAttr: .space 4 - testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl - jz L_1 - movl $0x15cd2401,%eax # mov ax, 2401h & int 15h - cli # disable interrupts - jnc L_2 -L_1: - testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl - jz L_2 - inb $0x92,%al - orb $2,%al - outb %al, $0x92 # deactivate A20M# -L_2: - movl %ss,%eax - lea IA32_REGS_SIZE(%esp), %bp - # - # rsi in the following 2 instructions is indeed bp in 16-bit code - # - movw %bp, (_ESP - IA32_REGS_SIZE)(%rsi) - .byte 0x66 - movl (_EIP - IA32_REGS_SIZE)(%rsi), %ebx - shlw $4,%ax # shl eax, 4 - addw %ax,%bp # add ebp, eax - movw %cs,%ax - shlw $4,%ax - lea (L_64BitCode - L_Base)(%ebx, %eax), %ax - .byte 0x66,0x2e,0x89,0x87 # mov cs:[bx + (L_64Eip - L_Base)], eax - .word L_64Eip - L_Base - .byte 0x66,0xb8 # mov eax, imm32 -SavedCr4: .space 4 - movq %rax, %cr4 - # - # rdi in the instruction below is indeed bx in 16-bit code - # - .byte 0x66,0x2e # 2eh is "cs:" segment override - lgdt (SavedGdt - L_Base)(%rdi) - .byte 0x66 - movl $0xc0000080,%ecx - rdmsr - orb $1,%ah - wrmsr - .byte 0x66,0xb8 # mov eax, imm32 -SavedCr0: .space 4 - movq %rax, %cr0 - .byte 0x66,0xea # jmp far cs:L_64Bit -L_64Eip: .space 4 -SavedCs: .space 2 -L_64BitCode: - movq %r8, %rsp - ret - -_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start) - .word CODE16 -_16Gdtr: .word GDT_SIZE - 1 -_16GdtrBase: .quad _NullSeg -_16Idtr: .word 0x3ff - .long 0 - -#------------------------------------------------------------------------------ -# _ToUserCode() takes control in real mode before passing control to user code. -# It will be shadowed to somewhere in memory below 1MB. -#------------------------------------------------------------------------------ -.globl ASM_PFX(ToUserCode) -ASM_PFX(ToUserCode): - movl %edx,%ss # set new segment selectors - movl %edx,%ds - movl %edx,%es - movl %edx,%fs - movl %edx,%gs - .byte 0x66 - movl $0xc0000080,%ecx - movq %rax, %cr0 - rdmsr - andb $0b11111110, %ah - wrmsr - movq %rbp, %cr4 - movl %esi,%ss # set up 16-bit stack segment - movw %bx,%sp # set up 16-bit stack pointer - .byte 0x66 # make the following call 32-bit - call L_Base1 # push eip -L_Base1: - popw %bp # ebp <- address of L_Base1 - pushq (IA32_REGS_SIZE + 2)(%esp) - lea 0x0c(%rsi), %eax - pushq %rax - lret # execution begins at next instruction -L_RealMode: - .byte 0x66,0x2e # CS and operand size override - lidt (_16Idtr - L_Base1)(%rsi) - .byte 0x66,0x61 # popad - .byte 0x1f # pop ds - .byte 0x7 # pop es - .byte 0x0f, 0xa1 # pop fs - .byte 0x0f, 0xa9 # pop gs - .byte 0x66, 0x9d # popfd - leaw 4(%esp),%sp # skip high order 32 bits of EFlags - .byte 0x66 # make the following retf 32-bit - lret # transfer control to user code - -.equ CODE16, ASM_PFX(16Code) - . -.equ DATA16, ASM_PFX(16Data) - . -.equ DATA32, ASM_PFX(32Data) - . - -_NullSeg: .quad 0 -ASM_PFX(16Code): - .word -1 - .word 0 - .byte 0 - .byte 0x9b - .byte 0x8f # 16-bit segment, 4GB limit - .byte 0 -ASM_PFX(16Data): - .word -1 - .word 0 - .byte 0 - .byte 0x93 - .byte 0x8f # 16-bit segment, 4GB limit - .byte 0 -ASM_PFX(32Data): - .word -1 - .word 0 - .byte 0 - .byte 0x93 - .byte 0xcf # 16-bit segment, 4GB limit - .byte 0 - -.equ GDT_SIZE, . - ASM_PFX(NullSeg) - -#------------------------------------------------------------------------------ -# IA32_REGISTER_SET * -# EFIAPI -# InternalAsmThunk16 ( -# IN IA32_REGISTER_SET *RegisterSet, -# IN OUT VOID *Transition -# ); -#------------------------------------------------------------------------------ -# MISMATCH: "InternalAsmThunk16 PROC USES rbp rbx rsi rdi" - -.globl ASM_PFX(InternalAsmThunk16) -ASM_PFX(InternalAsmThunk16): - pushq %rbp - pushq %rbx - pushq %rsi - pushq %rdi - - movl %ds, %r10d # r9 ~ r11 are not accessible in 16-bit - movl %es, %r11d # so use them for saving seg registers - movl %ss, %r9d - .byte 0x0f, 0xa0 #push fs - .byte 0x0f, 0xa8 #push gs - movq %rcx, %rsi - movzwl _SS(%rsi), %r8d - movl _ESP(%rsi), %edi - lea -(IA32_REGS_SIZE + 4)(%edi), %rdi - imul $16, %r8d, %eax - movl %edi,%ebx # ebx <- stack for 16-bit code - pushq $(IA32_REGS_SIZE / 4) - addl %eax,%edi # edi <- linear address of 16-bit stack - popq %rcx - rep - movsl # copy RegSet - lea (SavedCr4 - ASM_PFX(m16Start))(%rdx), %ecx - movl %edx,%eax # eax <- transition code address - andl $0xf,%edx - shll $12,%eax # segment address in high order 16 bits - lea (_BackFromUserCode - ASM_PFX(m16Start))(%rdx), %ax - stosl # [edi] <- return address of user code - sgdt (SavedGdt - SavedCr4)(%rcx) - sidt 0x38(%rsp) - movq %cr0, %rax - movl %eax, (SavedCr0 - SavedCr4)(%rcx) - andl $0x7ffffffe,%eax # clear PE, PG bits - movq %cr4, %rbp - movl %ebp, (%rcx) # save CR4 in SavedCr4 - andl $0x300,%ebp # clear all but PCE and OSFXSR bits - movl %r8d, %esi # esi <- 16-bit stack segment - .byte 0x6a, DATA32 - popq %rdx - lgdt (_16Gdtr - SavedCr4)(%rcx) - movl %edx,%ss - pushfq - lea -8(%rdx), %edx - lea L_RetFromRealMode, %r8 - pushq %r8 - movl %cs, %r8d - movw %r8w, (SavedCs - SavedCr4)(%rcx) - movq %rsp, %r8 - .byte 0xff, 0x69 # jmp (_EntryPoint - SavedCr4)(%rcx) - .byte _EntryPoint - SavedCr4 -L_RetFromRealMode: - popfq - lidt 0x38(%rsp) - lea -IA32_REGS_SIZE(%rbp), %eax - .byte 0x0f, 0xa9 # pop gs - .byte 0x0f, 0xa1 # pop fs - movl %r9d, %ss - movl %r11d, %es - movl %r10d, %ds - - popq %rdi - popq %rsi - popq %rbx - popq %rbp - - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# Thunk16.S +# +# Abstract: +# +# Real mode thunk +# +#------------------------------------------------------------------------------ + +#include + +.globl ASM_PFX(m16Start) +.globl ASM_PFX(m16Size) +.globl ASM_PFX(mThunk16Attr) +.globl ASM_PFX(m16Gdt) +.globl ASM_PFX(m16GdtrBase) +.globl ASM_PFX(mTransition) +.globl ASM_PFX(InternalAsmThunk16) + +# define the structure of IA32_REGS +.equ _EDI, 0 #size 4 +.equ _ESI, 4 #size 4 +.equ _EBP, 8 #size 4 +.equ _ESP, 12 #size 4 +.equ _EBX, 16 #size 4 +.equ _EDX, 20 #size 4 +.equ _ECX, 24 #size 4 +.equ _EAX, 28 #size 4 +.equ _DS, 32 #size 2 +.equ _ES, 34 #size 2 +.equ _FS, 36 #size 2 +.equ _GS, 38 #size 2 +.equ _EFLAGS, 40 #size 8 +.equ _EIP, 48 #size 4 +.equ _CS, 52 #size 2 +.equ _SS, 54 #size 2 +.equ IA32_REGS_SIZE, 56 + + .data + +ASM_PFX(m16Size): .word ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start) +ASM_PFX(mThunk16Attr): .word _ThunkAttr - ASM_PFX(m16Start) +ASM_PFX(m16Gdt): .word _NullSeg - ASM_PFX(m16Start) +ASM_PFX(m16GdtrBase): .word _16GdtrBase - ASM_PFX(m16Start) +ASM_PFX(mTransition): .word _EntryPoint - ASM_PFX(m16Start) + + .text + +ASM_PFX(m16Start): + +SavedGdt: .space 10 + +#------------------------------------------------------------------------------ +# _BackFromUserCode() takes control in real mode after 'retf' has been executed +# by user code. It will be shadowed to somewhere in memory below 1MB. +#------------------------------------------------------------------------------ +.globl ASM_PFX(BackFromUserCode) +ASM_PFX(BackFromUserCode): + # + # The order of saved registers on the stack matches the order they appears + # in IA32_REGS structure. This facilitates wrapper function to extract them + # into that structure. + # + # Some instructions for manipulation of segment registers have to be written + # in opcode since 64-bit MASM prevents accesses to those registers. + # + .byte 0x16 # push ss + .byte 0xe # push cs + .byte 0x66 + call L_Base # push eip +L_Base: + .byte 0x66 + pushq $0 # reserved high order 32 bits of EFlags + .byte 0x66, 0x9c # pushfd actually + cli # disable interrupts + push %gs + push %fs + .byte 6 # push es + .byte 0x1e # push ds + .byte 0x66,0x60 # pushad + .byte 0x66,0xba # mov edx, imm32 +_ThunkAttr: .space 4 + testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl + jz L_1 + movl $0x15cd2401,%eax # mov ax, 2401h & int 15h + cli # disable interrupts + jnc L_2 +L_1: + testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl + jz L_2 + inb $0x92,%al + orb $2,%al + outb %al, $0x92 # deactivate A20M# +L_2: + movl %ss,%eax + lea IA32_REGS_SIZE(%esp), %bp + # + # rsi in the following 2 instructions is indeed bp in 16-bit code + # + movw %bp, (_ESP - IA32_REGS_SIZE)(%rsi) + .byte 0x66 + movl (_EIP - IA32_REGS_SIZE)(%rsi), %ebx + shlw $4,%ax # shl eax, 4 + addw %ax,%bp # add ebp, eax + movw %cs,%ax + shlw $4,%ax + lea (L_64BitCode - L_Base)(%ebx, %eax), %ax + .byte 0x66,0x2e,0x89,0x87 # mov cs:[bx + (L_64Eip - L_Base)], eax + .word L_64Eip - L_Base + .byte 0x66,0xb8 # mov eax, imm32 +SavedCr4: .space 4 + movq %rax, %cr4 + # + # rdi in the instruction below is indeed bx in 16-bit code + # + .byte 0x66,0x2e # 2eh is "cs:" segment override + lgdt (SavedGdt - L_Base)(%rdi) + .byte 0x66 + movl $0xc0000080,%ecx + rdmsr + orb $1,%ah + wrmsr + .byte 0x66,0xb8 # mov eax, imm32 +SavedCr0: .space 4 + movq %rax, %cr0 + .byte 0x66,0xea # jmp far cs:L_64Bit +L_64Eip: .space 4 +SavedCs: .space 2 +L_64BitCode: + movq %r8, %rsp + ret + +_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start) + .word CODE16 +_16Gdtr: .word GDT_SIZE - 1 +_16GdtrBase: .quad _NullSeg +_16Idtr: .word 0x3ff + .long 0 + +#------------------------------------------------------------------------------ +# _ToUserCode() takes control in real mode before passing control to user code. +# It will be shadowed to somewhere in memory below 1MB. +#------------------------------------------------------------------------------ +.globl ASM_PFX(ToUserCode) +ASM_PFX(ToUserCode): + movl %edx,%ss # set new segment selectors + movl %edx,%ds + movl %edx,%es + movl %edx,%fs + movl %edx,%gs + .byte 0x66 + movl $0xc0000080,%ecx + movq %rax, %cr0 + rdmsr + andb $0b11111110, %ah + wrmsr + movq %rbp, %cr4 + movl %esi,%ss # set up 16-bit stack segment + movw %bx,%sp # set up 16-bit stack pointer + .byte 0x66 # make the following call 32-bit + call L_Base1 # push eip +L_Base1: + popw %bp # ebp <- address of L_Base1 + pushq (IA32_REGS_SIZE + 2)(%esp) + lea 0x0c(%rsi), %eax + pushq %rax + lret # execution begins at next instruction +L_RealMode: + .byte 0x66,0x2e # CS and operand size override + lidt (_16Idtr - L_Base1)(%rsi) + .byte 0x66,0x61 # popad + .byte 0x1f # pop ds + .byte 0x7 # pop es + .byte 0x0f, 0xa1 # pop fs + .byte 0x0f, 0xa9 # pop gs + .byte 0x66, 0x9d # popfd + leaw 4(%esp),%sp # skip high order 32 bits of EFlags + .byte 0x66 # make the following retf 32-bit + lret # transfer control to user code + +.equ CODE16, ASM_PFX(16Code) - . +.equ DATA16, ASM_PFX(16Data) - . +.equ DATA32, ASM_PFX(32Data) - . + +_NullSeg: .quad 0 +ASM_PFX(16Code): + .word -1 + .word 0 + .byte 0 + .byte 0x9b + .byte 0x8f # 16-bit segment, 4GB limit + .byte 0 +ASM_PFX(16Data): + .word -1 + .word 0 + .byte 0 + .byte 0x93 + .byte 0x8f # 16-bit segment, 4GB limit + .byte 0 +ASM_PFX(32Data): + .word -1 + .word 0 + .byte 0 + .byte 0x93 + .byte 0xcf # 16-bit segment, 4GB limit + .byte 0 + +.equ GDT_SIZE, . - ASM_PFX(NullSeg) + +#------------------------------------------------------------------------------ +# IA32_REGISTER_SET * +# EFIAPI +# InternalAsmThunk16 ( +# IN IA32_REGISTER_SET *RegisterSet, +# IN OUT VOID *Transition +# ); +#------------------------------------------------------------------------------ +# MISMATCH: "InternalAsmThunk16 PROC USES rbp rbx rsi rdi" + +.globl ASM_PFX(InternalAsmThunk16) +ASM_PFX(InternalAsmThunk16): + pushq %rbp + pushq %rbx + pushq %rsi + pushq %rdi + + movl %ds, %r10d # r9 ~ r11 are not accessible in 16-bit + movl %es, %r11d # so use them for saving seg registers + movl %ss, %r9d + .byte 0x0f, 0xa0 #push fs + .byte 0x0f, 0xa8 #push gs + movq %rcx, %rsi + movzwl _SS(%rsi), %r8d + movl _ESP(%rsi), %edi + lea -(IA32_REGS_SIZE + 4)(%edi), %rdi + imul $16, %r8d, %eax + movl %edi,%ebx # ebx <- stack for 16-bit code + pushq $(IA32_REGS_SIZE / 4) + addl %eax,%edi # edi <- linear address of 16-bit stack + popq %rcx + rep + movsl # copy RegSet + lea (SavedCr4 - ASM_PFX(m16Start))(%rdx), %ecx + movl %edx,%eax # eax <- transition code address + andl $0xf,%edx + shll $12,%eax # segment address in high order 16 bits + lea (_BackFromUserCode - ASM_PFX(m16Start))(%rdx), %ax + stosl # [edi] <- return address of user code + sgdt (SavedGdt - SavedCr4)(%rcx) + sidt 0x38(%rsp) + movq %cr0, %rax + movl %eax, (SavedCr0 - SavedCr4)(%rcx) + andl $0x7ffffffe,%eax # clear PE, PG bits + movq %cr4, %rbp + movl %ebp, (%rcx) # save CR4 in SavedCr4 + andl $0x300,%ebp # clear all but PCE and OSFXSR bits + movl %r8d, %esi # esi <- 16-bit stack segment + .byte 0x6a, DATA32 + popq %rdx + lgdt (_16Gdtr - SavedCr4)(%rcx) + movl %edx,%ss + pushfq + lea -8(%rdx), %edx + lea L_RetFromRealMode, %r8 + pushq %r8 + movl %cs, %r8d + movw %r8w, (SavedCs - SavedCr4)(%rcx) + movq %rsp, %r8 + .byte 0xff, 0x69 # jmp (_EntryPoint - SavedCr4)(%rcx) + .byte _EntryPoint - SavedCr4 +L_RetFromRealMode: + popfq + lidt 0x38(%rsp) + lea -IA32_REGS_SIZE(%rbp), %eax + .byte 0x0f, 0xa9 # pop gs + .byte 0x0f, 0xa1 # pop fs + movl %r9d, %ss + movl %r11d, %es + movl %r10d, %ds + + popq %rdi + popq %rsi + popq %rbx + popq %rbp + + ret diff --git a/MdePkg/Library/BaseLib/X64/Wbinvd.S b/MdePkg/Library/BaseLib/X64/Wbinvd.S index d21c8a7549..17c15384de 100644 --- a/MdePkg/Library/BaseLib/X64/Wbinvd.S +++ b/MdePkg/Library/BaseLib/X64/Wbinvd.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# Wbinvd.S -# -# Abstract: -# -# AsmWbinvd function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWbinvd ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWbinvd) -.align 16 -ASM_PFX(AsmWbinvd): - wbinvd - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# Wbinvd.S +# +# Abstract: +# +# AsmWbinvd function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWbinvd ( +# VOID +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWbinvd) +.align 16 +ASM_PFX(AsmWbinvd): + wbinvd + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteCr0.S b/MdePkg/Library/BaseLib/X64/WriteCr0.S index 91976fcfef..7a39fd32f8 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr0.S +++ b/MdePkg/Library/BaseLib/X64/WriteCr0.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteCr0.S -# -# Abstract: -# -# AsmWriteCr0 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteCr0 ( -# UINTN Cr0 -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteCr0) -ASM_PFX(AsmWriteCr0): - mov %rcx,%cr0 - mov %rcx,%rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteCr0.S +# +# Abstract: +# +# AsmWriteCr0 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteCr0 ( +# UINTN Cr0 +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteCr0) +ASM_PFX(AsmWriteCr0): + mov %rcx,%cr0 + mov %rcx,%rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteCr2.S b/MdePkg/Library/BaseLib/X64/WriteCr2.S index 3a8eac8556..667826edac 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr2.S +++ b/MdePkg/Library/BaseLib/X64/WriteCr2.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteCr2.S -# -# Abstract: -# -# AsmWriteCr2 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteCr2 ( -# UINTN Cr2 -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteCr2) -ASM_PFX(AsmWriteCr2): - mov %rcx,%cr2 - mov %rcx,%rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteCr2.S +# +# Abstract: +# +# AsmWriteCr2 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteCr2 ( +# UINTN Cr2 +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteCr2) +ASM_PFX(AsmWriteCr2): + mov %rcx,%cr2 + mov %rcx,%rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteCr3.S b/MdePkg/Library/BaseLib/X64/WriteCr3.S index 6c28ec649d..64ac43568e 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr3.S +++ b/MdePkg/Library/BaseLib/X64/WriteCr3.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteCr3.S -# -# Abstract: -# -# AsmWriteCr3 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteCr3 ( -# UINTN Cr3 -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteCr3) -ASM_PFX(AsmWriteCr3): - mov %rcx,%cr3 - mov %rcx,%rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteCr3.S +# +# Abstract: +# +# AsmWriteCr3 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteCr3 ( +# UINTN Cr3 +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteCr3) +ASM_PFX(AsmWriteCr3): + mov %rcx,%cr3 + mov %rcx,%rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteCr4.S b/MdePkg/Library/BaseLib/X64/WriteCr4.S index b25e178784..48d7e6f055 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr4.S +++ b/MdePkg/Library/BaseLib/X64/WriteCr4.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteCr4.S -# -# Abstract: -# -# AsmWriteCr4 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteCr4 ( -# UINTN Cr4 -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteCr4) -ASM_PFX(AsmWriteCr4): - mov %rcx,%cr4 - mov %rcx,%rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteCr4.S +# +# Abstract: +# +# AsmWriteCr4 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteCr4 ( +# UINTN Cr4 +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteCr4) +ASM_PFX(AsmWriteCr4): + mov %rcx,%cr4 + mov %rcx,%rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr0.S b/MdePkg/Library/BaseLib/X64/WriteDr0.S index 1fd9fca561..d2bca9baff 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr0.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr0.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr0.S -# -# Abstract: -# -# AsmWriteDr0 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr0 ( -# UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr0) -.align 16 -ASM_PFX(AsmWriteDr0): - mov %rcx, %dr0 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr0.S +# +# Abstract: +# +# AsmWriteDr0 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr0 ( +# UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr0) +.align 16 +ASM_PFX(AsmWriteDr0): + mov %rcx, %dr0 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr1.S b/MdePkg/Library/BaseLib/X64/WriteDr1.S index 5d75a97151..416102e532 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr1.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr1.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr1.S -# -# Abstract: -# -# AsmWriteDr1 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr1 ( -# UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr1) -.align 16 -ASM_PFX(AsmWriteDr1): - mov %rcx, %dr1 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr1.S +# +# Abstract: +# +# AsmWriteDr1 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr1 ( +# UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr1) +.align 16 +ASM_PFX(AsmWriteDr1): + mov %rcx, %dr1 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr2.S b/MdePkg/Library/BaseLib/X64/WriteDr2.S index bdbaa09d7c..298eea74f6 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr2.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr2.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr2.S -# -# Abstract: -# -# AsmWriteDr2 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr2 ( -# UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr2) -.align 16 -ASM_PFX(AsmWriteDr2): - mov %rcx, %dr2 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr2.S +# +# Abstract: +# +# AsmWriteDr2 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr2 ( +# UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr2) +.align 16 +ASM_PFX(AsmWriteDr2): + mov %rcx, %dr2 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr3.S b/MdePkg/Library/BaseLib/X64/WriteDr3.S index 555284e321..533f9a15f9 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr3.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr3.S @@ -1,37 +1,37 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr3.S -# -# Abstract: -# -# AsmWriteDr3 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr3 ( -# UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr3) -.align 16 -ASM_PFX(AsmWriteDr3): - mov %rcx, %dr3 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr3.S +# +# Abstract: +# +# AsmWriteDr3 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr3 ( +# UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr3) +.align 16 +ASM_PFX(AsmWriteDr3): + mov %rcx, %dr3 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr4.S b/MdePkg/Library/BaseLib/X64/WriteDr4.S index 116aef9a20..12db37f6fb 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr4.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr4.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr4.S -# -# Abstract: -# -# AsmWriteDr4 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr4 ( -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr4) -ASM_PFX(AsmWriteDr4): - mov %rcx, %dr4 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr4.S +# +# Abstract: +# +# AsmWriteDr4 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr4 ( +# IN UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr4) +ASM_PFX(AsmWriteDr4): + mov %rcx, %dr4 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr5.S b/MdePkg/Library/BaseLib/X64/WriteDr5.S index ccd7d209e5..5c1851128f 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr5.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr5.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr5.S -# -# Abstract: -# -# AsmWriteDr5 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr5 ( -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr5) -ASM_PFX(AsmWriteDr5): - mov %rcx, %dr5 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr5.S +# +# Abstract: +# +# AsmWriteDr5 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr5 ( +# IN UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr5) +ASM_PFX(AsmWriteDr5): + mov %rcx, %dr5 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr6.S b/MdePkg/Library/BaseLib/X64/WriteDr6.S index b4dddeefaf..e3bdc0dc44 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr6.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr6.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr6.S -# -# Abstract: -# -# AsmWriteDr6 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr6 ( -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr6) -ASM_PFX(AsmWriteDr6): - mov %rcx, %dr6 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr6.S +# +# Abstract: +# +# AsmWriteDr6 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr6 ( +# IN UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr6) +ASM_PFX(AsmWriteDr6): + mov %rcx, %dr6 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr7.S b/MdePkg/Library/BaseLib/X64/WriteDr7.S index 466fdef18c..cc0e2187ee 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr7.S +++ b/MdePkg/Library/BaseLib/X64/WriteDr7.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteDr7.S -# -# Abstract: -# -# AsmWriteDr7 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# AsmWriteDr7 ( -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteDr7) -ASM_PFX(AsmWriteDr7): - mov %rcx, %dr7 - mov %rcx, %rax - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteDr7.S +# +# Abstract: +# +# AsmWriteDr7 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINTN +# EFIAPI +# AsmWriteDr7 ( +# IN UINTN Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteDr7) +ASM_PFX(AsmWriteDr7): + mov %rcx, %dr7 + mov %rcx, %rax + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteGdtr.S b/MdePkg/Library/BaseLib/X64/WriteGdtr.S index d816df5441..a2c37bcbd4 100644 --- a/MdePkg/Library/BaseLib/X64/WriteGdtr.S +++ b/MdePkg/Library/BaseLib/X64/WriteGdtr.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteGdtr.S -# -# Abstract: -# -# AsmWriteGdtr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86WriteGdtr ( -# IN CONST IA32_DESCRIPTOR *Idtr -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86WriteGdtr) -ASM_PFX(InternalX86WriteGdtr): - lgdt (%rcx) - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteGdtr.S +# +# Abstract: +# +# AsmWriteGdtr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86WriteGdtr ( +# IN CONST IA32_DESCRIPTOR *Idtr +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86WriteGdtr) +ASM_PFX(InternalX86WriteGdtr): + lgdt (%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteIdtr.S b/MdePkg/Library/BaseLib/X64/WriteIdtr.S index d3b9018e32..a166da23ea 100644 --- a/MdePkg/Library/BaseLib/X64/WriteIdtr.S +++ b/MdePkg/Library/BaseLib/X64/WriteIdtr.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteIdtr.S -# -# Abstract: -# -# AsmWriteIdtr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86WriteIdtr ( -# IN CONST IA32_DESCRIPTOR *Idtr -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(InternalX86WriteIdtr) -.align 16 -ASM_PFX(InternalX86WriteIdtr): - lidt (%rcx) - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteIdtr.S +# +# Abstract: +# +# AsmWriteIdtr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# InternalX86WriteIdtr ( +# IN CONST IA32_DESCRIPTOR *Idtr +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(InternalX86WriteIdtr) +.align 16 +ASM_PFX(InternalX86WriteIdtr): + lidt (%rcx) + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteLdtr.S b/MdePkg/Library/BaseLib/X64/WriteLdtr.S index 82c74813fc..a8e397e3d1 100644 --- a/MdePkg/Library/BaseLib/X64/WriteLdtr.S +++ b/MdePkg/Library/BaseLib/X64/WriteLdtr.S @@ -1,36 +1,36 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteLdtr.S -# -# Abstract: -# -# AsmWriteLdtr function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteLdtr ( -# IN UINT16 Ldtr -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteLdtr) -.align 16 -ASM_PFX(AsmWriteLdtr): - lldt %cx - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteLdtr.S +# +# Abstract: +# +# AsmWriteLdtr function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteLdtr ( +# IN UINT16 Ldtr +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteLdtr) +.align 16 +ASM_PFX(AsmWriteLdtr): + lldt %cx + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm0.S b/MdePkg/Library/BaseLib/X64/WriteMm0.S index 40e0a56dc3..6ee0a9d8c9 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm0.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm0.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# WriteMm0.S -# -# Abstract: -# -# AsmWriteMm0 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm0 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm0) -ASM_PFX(AsmWriteMm0): - movd %rcx, %mm0 - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# WriteMm0.S +# +# Abstract: +# +# AsmWriteMm0 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm0 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm0) +ASM_PFX(AsmWriteMm0): + movd %rcx, %mm0 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm1.S b/MdePkg/Library/BaseLib/X64/WriteMm1.S index 1fe0711e3d..d5262df2c1 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm1.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm1.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm1.S -# -# Abstract: -# -# AsmWriteMm1 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm1 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm1) -ASM_PFX(AsmWriteMm1): - movd %rcx, %mm1 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm1.S +# +# Abstract: +# +# AsmWriteMm1 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm1 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm1) +ASM_PFX(AsmWriteMm1): + movd %rcx, %mm1 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm2.S b/MdePkg/Library/BaseLib/X64/WriteMm2.S index d71524e7ce..7efdffb90c 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm2.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm2.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm2.S -# -# Abstract: -# -# AsmWriteMm2 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm2 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm2) -ASM_PFX(AsmWriteMm2): - movd %rcx, %mm2 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm2.S +# +# Abstract: +# +# AsmWriteMm2 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm2 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm2) +ASM_PFX(AsmWriteMm2): + movd %rcx, %mm2 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm3.S b/MdePkg/Library/BaseLib/X64/WriteMm3.S index c5747e853b..0bf1ef24d9 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm3.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm3.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm3.S -# -# Abstract: -# -# AsmWriteMm3 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm3 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm3) -ASM_PFX(AsmWriteMm3): - movd %rcx, %mm3 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm3.S +# +# Abstract: +# +# AsmWriteMm3 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm3 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm3) +ASM_PFX(AsmWriteMm3): + movd %rcx, %mm3 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm4.S b/MdePkg/Library/BaseLib/X64/WriteMm4.S index fdeb1ebe90..3b5050fbb0 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm4.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm4.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm4.S -# -# Abstract: -# -# AsmWriteMm4 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm4 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm4) -ASM_PFX(AsmWriteMm4): - movd %rcx, %mm4 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm4.S +# +# Abstract: +# +# AsmWriteMm4 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm4 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm4) +ASM_PFX(AsmWriteMm4): + movd %rcx, %mm4 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm5.S b/MdePkg/Library/BaseLib/X64/WriteMm5.S index 78d4fcba3f..ecfc2d8ae2 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm5.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm5.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm5.S -# -# Abstract: -# -# AsmWriteMm5 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm5 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm5) -ASM_PFX(AsmWriteMm5): - movd %rcx, %mm5 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm5.S +# +# Abstract: +# +# AsmWriteMm5 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm5 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm5) +ASM_PFX(AsmWriteMm5): + movd %rcx, %mm5 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm6.S b/MdePkg/Library/BaseLib/X64/WriteMm6.S index 31bb40d422..57b1b499e7 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm6.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm6.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm6.S -# -# Abstract: -# -# AsmWriteMm6 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm6 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm6) -ASM_PFX(AsmWriteMm6): - movd %rcx, %mm6 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm6.S +# +# Abstract: +# +# AsmWriteMm6 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm6 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm6) +ASM_PFX(AsmWriteMm6): + movd %rcx, %mm6 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm7.S b/MdePkg/Library/BaseLib/X64/WriteMm7.S index cf4777bd0f..d4a00f8f4b 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm7.S +++ b/MdePkg/Library/BaseLib/X64/WriteMm7.S @@ -1,35 +1,35 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -# WriteMm7.S -# -# Abstract: -# -# AsmWriteMm7 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmWriteMm7 ( -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMm7) -ASM_PFX(AsmWriteMm7): - movd %rcx, %mm7 - ret +#------------------------------------------------------------------------------ +# +# 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: +# +# WriteMm7.S +# +# Abstract: +# +# AsmWriteMm7 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# AsmWriteMm7 ( +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMm7) +ASM_PFX(AsmWriteMm7): + movd %rcx, %mm7 + ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.S b/MdePkg/Library/BaseLib/X64/WriteMsr64.S index 4a06f85e8a..052ed3c3ed 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMsr64.S +++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.S @@ -1,39 +1,39 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 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: -# -# WriteMsr64.S -# -# Abstract: -# -# AsmWriteMsr64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmWriteMsr64 ( -# IN UINT32 Index, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(AsmWriteMsr64) -.align 16 -ASM_PFX(AsmWriteMsr64): - mov %rdx, %rax # meanwhile, rax <- return value - shr $0x20, %rdx # edx:eax contains the value to write - wrmsr - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 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: +# +# WriteMsr64.S +# +# Abstract: +# +# AsmWriteMsr64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# UINT64 +# EFIAPI +# AsmWriteMsr64 ( +# IN UINT32 Index, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.global ASM_PFX(AsmWriteMsr64) +.align 16 +ASM_PFX(AsmWriteMsr64): + mov %rdx, %rax # meanwhile, rax <- return value + shr $0x20, %rdx # edx:eax contains the value to write + wrmsr + ret diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S index 5580d6237a..61343d307d 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S @@ -1,60 +1,60 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CompareMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CompareMem.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCompareMem) +ASM_PFX(InternalMemCompareMem): + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 + repe cmpsb + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S index 426a602286..06a259584e 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S @@ -1,75 +1,75 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx # rsi <- Source - mov rdi, rcx # rdi <- Destination - lea r9, [rsi + r8 - 1] # r9 <- End of Source - cmp rsi, rdi - mov rax, rdi # rax <- Destination as return value - jae L0 - cmp r9, rdi - jae L_CopyBackward # Copy backward if overlapped -L0: - mov rcx, r8 - and r8, 7 - shr rcx, 3 # rcx <- # of Qwords to copy - jz L_CopyBytes - movd r10, mm0 # (Save mm0 in r10) -L1: - movq mm0, [rsi] - movntq [rdi], mm0 - add rsi, 8 - add rdi, 8 - loop L1 - mfence - movd mm0, r10 # (Restore mm0) - jmp L_CopyBytes -L_CopyBackward: - mov rsi, r9 # rsi <- End of Source - lea rdi, [rdi + r8 - 1] # rdi <- End of Destination - std # set direction flag -L_CopyBytes: - mov rcx, r8 - rep movsb # Copy bytes backward - cld - pop rdi - pop rsi - ret +# +# ConvertAsm.py: Automatically generated from CopyMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CopyMem.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCopyMem) +ASM_PFX(InternalMemCopyMem): + push rsi + push rdi + mov rsi, rdx # rsi <- Source + mov rdi, rcx # rdi <- Destination + lea r9, [rsi + r8 - 1] # r9 <- End of Source + cmp rsi, rdi + mov rax, rdi # rax <- Destination as return value + jae L0 + cmp r9, rdi + jae L_CopyBackward # Copy backward if overlapped +L0: + mov rcx, r8 + and r8, 7 + shr rcx, 3 # rcx <- # of Qwords to copy + jz L_CopyBytes + movd r10, mm0 # (Save mm0 in r10) +L1: + movq mm0, [rsi] + movntq [rdi], mm0 + add rsi, 8 + add rdi, 8 + loop L1 + mfence + movd mm0, r10 # (Restore mm0) + jmp L_CopyBytes +L_CopyBackward: + mov rsi, r9 # rsi <- End of Source + lea rdi, [rdi + r8 - 1] # rdi <- End of Destination + std # set direction flag +L_CopyBytes: + mov rcx, r8 + rep movsb # Copy bytes backward + cld + pop rdi + pop rsi + ret diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S index 9a94f5d936..b777aac426 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem16) +ASM_PFX(InternalMemScanMem16): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S index 86a6503fb3..8f1804ce06 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem32) +ASM_PFX(InternalMemScanMem32): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasd + lea rax, [rdi - 4] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S index bd1eee7852..573be8d369 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S @@ -1,56 +1,56 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret +# +# ConvertAsm.py: Automatically generated from ScanMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem64) +ASM_PFX(InternalMemScanMem64): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasq + lea rax, [rdi - 8] + cmovnz rax, rcx + pop rdi + ret diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S index 1d8b4e1b23..1bd944c791 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx # set rax to 0 if not found - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem8.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem8) +ASM_PFX(InternalMemScanMem8): + push rdi + mov rdi, rcx + mov rcx, rdx + mov rax, r8 + repne scasb + lea rax, [rdi - 1] + cmovnz rax, rcx # set rax to 0 if not found + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S index 87b1a308bc..5bfe9468b5 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S @@ -1,62 +1,62 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rax, r8 - mov ah, al - movq mm0, rax - mov r8, rcx - mov rdi, r8 # rdi <- Buffer - mov rcx, rdx - and edx, 7 - shr rcx, 3 - jz L_SetBytes - pshufw mm0, mm0, 0x0 -L0: - movntq [rdi], mm0 - add rdi, 8 - loop L0 - mfence -L_SetBytes: - mov ecx, edx - rep stosb - mov rax, r8 - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem) +ASM_PFX(InternalMemSetMem): + push rdi + mov rax, r8 + mov ah, al + movq mm0, rax + mov r8, rcx + mov rdi, r8 # rdi <- Buffer + mov rcx, rdx + and edx, 7 + shr rcx, 3 + jz L_SetBytes + pshufw mm0, mm0, 0x0 +L0: + movntq [rdi], mm0 + add rdi, 8 + loop L0 + mfence +L_SetBytes: + mov ecx, edx + rep stosb + mov rax, r8 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S index 834adb15c6..d2e743c168 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S @@ -1,61 +1,61 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rax, r8 - movq mm0, rax - mov r8, rcx - mov rdi, r8 - mov rcx, rdx - and edx, 3 - shr rcx, 2 - jz L_SetWords - pshufw mm0, mm0, 0x0 -L0: - movntq [rdi], mm0 - add rdi, 8 - loop L0 - mfence -L_SetWords: - mov ecx, edx - rep stosw - mov rax, r8 - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem16) +ASM_PFX(InternalMemSetMem16): + push rdi + mov rax, r8 + movq mm0, rax + mov r8, rcx + mov rdi, r8 + mov rcx, rdx + and edx, 3 + shr rcx, 2 + jz L_SetWords + pshufw mm0, mm0, 0x0 +L0: + movntq [rdi], mm0 + add rdi, 8 + loop L0 + mfence +L_SetWords: + mov ecx, edx + rep stosw + mov rax, r8 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S index 099e53d607..b4d26850d4 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S @@ -1,56 +1,56 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - movq mm0, r8 # mm0 <- Value - mov rax, rcx # rax <- Buffer - xchg rcx, rdx # rcx <- Count rdx <- Buffer - shr rcx, 1 # rcx <- # of qwords to set - jz L_SetDwords - pshufw mm0, mm0, 0x44 -L0: - movntq [rdx], mm0 - lea rdx, [rdx + 8] # use "lea" to avoid flag changes - loop L0 - mfence -L_SetDwords: - jnc L1 - movd [rdx], mm0 -L1: - ret - +# +# ConvertAsm.py: Automatically generated from SetMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem32) +ASM_PFX(InternalMemSetMem32): + movq mm0, r8 # mm0 <- Value + mov rax, rcx # rax <- Buffer + xchg rcx, rdx # rcx <- Count rdx <- Buffer + shr rcx, 1 # rcx <- # of qwords to set + jz L_SetDwords + pshufw mm0, mm0, 0x44 +L0: + movntq [rdx], mm0 + lea rdx, [rdx + 8] # use "lea" to avoid flag changes + loop L0 + mfence +L_SetDwords: + jnc L1 + movd [rdx], mm0 +L1: + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S index 76dbdf262f..14ddb873a9 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - movq mm0, r8 #Value - mov rax, rcx #rax <- Buffer - xchg rcx, rdx #rcx <- Count -L0: - movntq [rdx], mm0 - add rdx, 8 - loop L0 - mfence - ret - +# +# ConvertAsm.py: Automatically generated from SetMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem64) +ASM_PFX(InternalMemSetMem64): + movq mm0, r8 #Value + mov rax, rcx #rax <- Buffer + xchg rcx, rdx #rcx <- Count +L0: + movntq [rdx], mm0 + add rdx, 8 + loop L0 + mfence + ret + diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S index f8d24cc23e..4564306632 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S @@ -1,58 +1,58 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - mov rdi, rcx - mov rcx, rdx - mov r8, rdi - and edx, 7 - shr rcx, 3 - jz L_ZeroBytes - pxor mm0, mm0 -L0: - movntq [rdi], mm0 - add rdi, 8 - loop L0 - mfence -L_ZeroBytes: - xor eax, eax - mov ecx, edx - rep stosb - mov rax, r8 - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ZeroMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemZeroMem) +ASM_PFX(InternalMemZeroMem): + push rdi + mov rdi, rcx + mov rcx, rdx + mov r8, rdi + and edx, 7 + shr rcx, 3 + jz L_ZeroBytes + pxor mm0, mm0 +L0: + movntq [rdi], mm0 + add rdi, 8 + loop L0 + mfence +L_ZeroBytes: + xor eax, eax + mov ecx, edx + rep stosb + mov rax, r8 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S index d7ea0d1616..5d622f8708 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S @@ -1,55 +1,55 @@ -#------------------------------------------------------------------------------ -# -# 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.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemCompareMem) + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemCompareMem): + push %esi + push %edi + movl 12(%esp), %esi + movl 16(%esp), %edi + movl 20(%esp), %ecx + repe cmpsb + movzbl -1(%esi), %eax + movzbl -1(%edi), %edx + subl %edx, %eax + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S index 3355829560..a63b4ca9cc 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S @@ -1,85 +1,85 @@ -#------------------------------------------------------------------------------ -# -# 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.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi,%edx,), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - jz L1 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx # edx <- remaining bytes to copy - rep - movsb -L1: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx # ecx <- # of DQwords to copy - jz L_CopyBytes - addl $-16, %esp - movdqu %xmm0, (%esp) -L2: - movdqu (%esi), %xmm0 - movntdq %xmm0, (%edi) - addl $16, %esi - addl $16, %edi - loop L2 - mfence - movdqu (%esp),%xmm0 - addl $16, %esp # stack cleanup - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- Last byte in Source - leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb - cld - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemCopyMem) + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemCopyMem): + push %esi + push %edi + movl 16(%esp), %esi # esi <- Source + movl 12(%esp), %edi # edi <- Destination + movl 20(%esp), %edx # edx <- Count + leal -1(%esi,%edx,), %eax # eax <- End of Source + cmpl %edi, %esi + jae L0 + cmpl %edi, %eax # Overlapped? + jae L_CopyBackward # Copy backward if overlapped +L0: + xorl %ecx, %ecx + subl %edi, %ecx + andl $15, %ecx # ecx + edi aligns on 16-byte boundary + jz L1 + cmpl %edx, %ecx + cmova %edx, %ecx + subl %ecx, %edx # edx <- remaining bytes to copy + rep + movsb +L1: + movl %edx, %ecx + andl $15, %edx + shrl $4, %ecx # ecx <- # of DQwords to copy + jz L_CopyBytes + addl $-16, %esp + movdqu %xmm0, (%esp) +L2: + movdqu (%esi), %xmm0 + movntdq %xmm0, (%edi) + addl $16, %esi + addl $16, %edi + loop L2 + mfence + movdqu (%esp),%xmm0 + addl $16, %esp # stack cleanup + jmp L_CopyBytes +L_CopyBackward: + movl %eax, %esi # esi <- Last byte in Source + leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination + std +L_CopyBytes: + movl %edx, %ecx + rep + movsb + cld + movl 12(%esp), %eax # eax <- Destination as return value + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S index db66ade1e1..a72151376d 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S @@ -1,52 +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: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem16) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem16): + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasw + leal -2(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S index 30f5066486..df6f7c03e0 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S @@ -1,52 +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: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem32) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem32): + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasl + leal -4(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S index 5d58c0a56a..158f20973a 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S @@ -1,61 +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: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem64) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem64): + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + cmpl (%edi), %eax + leal 8(%edi), %edi + loopne L0 + jne L1 + cmpl -4(%edi), %edx + jecxz L1 + jne L0 +L1: + leal -8(%edi), %eax + cmovne %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S index 210292e105..34d8b12fab 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S @@ -1,52 +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: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem8) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem8): + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movb 16(%esp), %al + repne scasb + leal -1(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S index b8a60039bb..02c4b5719b 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S @@ -1,55 +1,55 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - .386: - .code: - -.globl ASM_PFX(InternalMemSetMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem): - push %edi - movl 12(%esp),%ecx - movb 16(%esp),%al - movb %ah, %al - shrd $16, %eax, %edx - shld $16, %edx, %eax - movl %edx, %ecx - movl 8(%esp),%edi - shrd $2, %ecx, %ecx - rep - stosl - movl %ecx, %edx - andl $3, %ecx - rep - stosb - movl 8(%esp),%eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.globl ASM_PFX(InternalMemSetMem) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem): + push %edi + movl 12(%esp),%ecx + movb 16(%esp),%al + movb %ah, %al + shrd $16, %eax, %edx + shld $16, %edx, %eax + movl %edx, %ecx + movl 8(%esp),%edi + shrd $2, %ecx, %ecx + rep + stosl + movl %ecx, %edx + andl $3, %ecx + rep + stosb + movl 8(%esp),%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S index 99b13261d4..6b4ab69a75 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S @@ -1,43 +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: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 16(%esp), %eax - movl 8(%esp), %edi - movl 12(%esp), %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem16) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem16): + push %edi + movl 16(%esp), %eax + movl 8(%esp), %edi + movl 12(%esp), %ecx + rep + stosw + movl 8(%esp), %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S index 8b2721573d..9f9b3c8082 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S @@ -1,43 +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: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosl - movl 8(%esp),%eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem32) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem32): + push %edi + movl 16(%esp),%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + rep + stosl + movl 8(%esp),%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S index e8deeb0fff..d6ab8cf9a2 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S @@ -1,46 +1,46 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - mov %eax, -8(%edi, %ecx, 8) - mov %edx, -4(%edi, %ecx, 8) - loop L0 - movl %edi, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem64) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem64): + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + mov %eax, -8(%edi, %ecx, 8) + mov %edx, -4(%edi, %ecx, 8) + loop L0 + movl %edi, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S index 500a5524f5..25c625b41b 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S @@ -1,49 +1,49 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - xorl %eax,%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - movl %ecx,%edx - shrl $2,%ecx - andl $3,%edx - pushl %edi - rep - stosl - movl %edx,%ecx - rep - stosb - popl %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemZeroMem) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemZeroMem): + push %edi + xorl %eax,%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + movl %ecx,%edx + shrl $2,%ecx + andl $3,%edx + pushl %edi + rep + stosl + movl %edx,%ecx + rep + stosb + popl %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S index 5580d6237a..61343d307d 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S @@ -1,60 +1,60 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CompareMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CompareMem.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCompareMem) +ASM_PFX(InternalMemCompareMem): + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 + repe cmpsb + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S index 8fbc90f0e4..273cd5adb4 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S @@ -1,37 +1,37 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) +# +# ConvertAsm.py: Automatically generated from CopyMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CopyMem.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ) #------------------------------------------------------------------------------ .intel_syntax noprefix .globl ASM_PFX(InternalMemCopyMem) diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S index 9a94f5d936..b777aac426 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem16) +ASM_PFX(InternalMemScanMem16): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S index 86a6503fb3..8f1804ce06 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem32) +ASM_PFX(InternalMemScanMem32): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasd + lea rax, [rdi - 4] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S index bd1eee7852..573be8d369 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S @@ -1,56 +1,56 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret +# +# ConvertAsm.py: Automatically generated from ScanMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem64) +ASM_PFX(InternalMemScanMem64): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasq + lea rax, [rdi - 8] + cmovnz rax, rcx + pop rdi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S index 1d8b4e1b23..1bd944c791 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx # set rax to 0 if not found - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem8.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem8) +ASM_PFX(InternalMemScanMem8): + push rdi + mov rdi, rcx + mov rcx, rdx + mov rax, r8 + repne scasb + lea rax, [rdi - 1] + cmovnz rax, rcx # set rax to 0 if not found + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S index 0fb9deeb75..822ec6cafc 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem16) +ASM_PFX(InternalMemSetMem16): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosw + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S index 00fec5c969..51d5a2f1fe 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem32) +ASM_PFX(InternalMemSetMem32): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosd + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S index 359cbb1633..c8e79c6fa3 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S @@ -1,47 +1,47 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem64) +ASM_PFX(InternalMemSetMem64): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosq + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S index 9c6be9c97e..5adf575146 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S @@ -1,52 +1,52 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - push rcx - xor rax, rax - mov rdi, rcx - mov rcx, rdx - shr rcx, 3 +# +# ConvertAsm.py: Automatically generated from ZeroMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemZeroMem) +ASM_PFX(InternalMemZeroMem): + push rdi + push rcx + xor rax, rax + mov rdi, rcx + mov rcx, rdx + shr rcx, 3 and rdx, 7 - cld - rep stosq - mov rcx, rdx - rep stosb - pop rax - pop rdi - ret - + cld + rep stosq + mov rcx, rdx + rep stosb + pop rax + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S index d7ea0d1616..5d622f8708 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S @@ -1,55 +1,55 @@ -#------------------------------------------------------------------------------ -# -# 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.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemCompareMem) + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemCompareMem): + push %esi + push %edi + movl 12(%esp), %esi + movl 16(%esp), %edi + movl 20(%esp), %ecx + repe cmpsb + movzbl -1(%esi), %eax + movzbl -1(%edi), %edx + subl %edx, %eax + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S index 318ae0ee54..d4f29c79fc 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S @@ -1,62 +1,62 @@ -#------------------------------------------------------------------------------ -# -# 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.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - cmpl %esi, %edi - je L_CopyDone - cmpl $0, %edx - je L_CopyDone - leal -1(%esi, %edx), %eax # eax <- End of Source - cmpl %edi, %esi - jae L_CopyBytes - cmpl %edi, %eax - jb L_CopyBytes # Copy backward if overlapped - movl %eax, %esi # esi <- End of Source - leal -1(%edi, %edx), %edi # edi <- End of Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb # Copy bytes backward - cld -L_CopyDone: - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemCopyMem) + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemCopyMem): + push %esi + push %edi + movl 16(%esp), %esi # esi <- Source + movl 12(%esp), %edi # edi <- Destination + movl 20(%esp), %edx # edx <- Count + cmpl %esi, %edi + je L_CopyDone + cmpl $0, %edx + je L_CopyDone + leal -1(%esi, %edx), %eax # eax <- End of Source + cmpl %edi, %esi + jae L_CopyBytes + cmpl %edi, %eax + jb L_CopyBytes # Copy backward if overlapped + movl %eax, %esi # esi <- End of Source + leal -1(%edi, %edx), %edi # edi <- End of Destination + std +L_CopyBytes: + movl %edx, %ecx + rep + movsb # Copy bytes backward + cld +L_CopyDone: + movl 12(%esp), %eax # eax <- Destination as return value + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S index d94ed42940..4d2b4a359c 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S @@ -1,52 +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: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem16) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem16): + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasw + leal -2(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S index 0cae5d3780..79a6cee9d0 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S @@ -1,52 +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: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem32) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem32): + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasl + leal -4(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S index 5d58c0a56a..158f20973a 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S @@ -1,61 +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: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem64) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem64): + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + cmpl (%edi), %eax + leal 8(%edi), %edi + loopne L0 + jne L1 + cmpl -4(%edi), %edx + jecxz L1 + jne L0 +L1: + leal -8(%edi), %eax + cmovne %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S index 210292e105..34d8b12fab 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S @@ -1,52 +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: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemScanMem8) + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemScanMem8): + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movb 16(%esp), %al + repne scasb + leal -1(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S index 1a1041b8e3..80d13187a6 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S @@ -1,50 +1,50 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem): - push %edi - movl 12(%esp),%ecx - movb 16(%esp),%al - movb %al, %ah - shrd $16, %eax, %edx - shld $16, %edx, %eax - movl %ecx, %edx - movl 8(%esp),%edi - shr $2, %ecx - rep stosl - movl %edx, %ecx - andl $3, %ecx - rep stosb - movl 8(%esp),%eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem): + push %edi + movl 12(%esp),%ecx + movb 16(%esp),%al + movb %al, %ah + shrd $16, %eax, %edx + shld $16, %edx, %eax + movl %ecx, %edx + movl 8(%esp),%edi + shr $2, %ecx + rep stosl + movl %edx, %ecx + andl $3, %ecx + rep stosb + movl 8(%esp),%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S index 99b13261d4..6b4ab69a75 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S @@ -1,43 +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: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 16(%esp), %eax - movl 8(%esp), %edi - movl 12(%esp), %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem16) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem16): + push %edi + movl 16(%esp), %eax + movl 8(%esp), %edi + movl 12(%esp), %ecx + rep + stosw + movl 8(%esp), %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S index 8b2721573d..9f9b3c8082 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S @@ -1,43 +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: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosl - movl 8(%esp),%eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem32) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem32): + push %edi + movl 16(%esp),%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + rep + stosl + movl 8(%esp),%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S index e8deeb0fff..d6ab8cf9a2 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S @@ -1,46 +1,46 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - mov %eax, -8(%edi, %ecx, 8) - mov %edx, -4(%edi, %ecx, 8) - loop L0 - movl %edi, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemSetMem64) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemSetMem64): + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + mov %eax, -8(%edi, %ecx, 8) + mov %edx, -4(%edi, %ecx, 8) + loop L0 + movl %edi, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S index 500a5524f5..25c625b41b 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S @@ -1,49 +1,49 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - xorl %eax,%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - movl %ecx,%edx - shrl $2,%ecx - andl $3,%edx - pushl %edi - rep - stosl - movl %edx,%ecx - rep - stosb - popl %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + +.globl ASM_PFX(InternalMemZeroMem) + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +ASM_PFX(InternalMemZeroMem): + push %edi + xorl %eax,%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + movl %ecx,%edx + shrl $2,%ecx + andl $3,%edx + pushl %edi + rep + stosl + movl %edx,%ecx + rep + stosb + popl %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S index 5580d6237a..61343d307d 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S @@ -1,60 +1,60 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CompareMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CompareMem.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCompareMem) +ASM_PFX(InternalMemCompareMem): + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 + repe cmpsb + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S index c75da2086f..afc79bc3ec 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S @@ -1,67 +1,67 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx # rsi <- Source - mov rdi, rcx # rdi <- Destination - lea r9, [rsi + r8 - 1] # r9 <- End of Source - cmp rsi, rdi - mov rax, rdi # rax <- Destination as return value - jae _InternalMemCopyMem_al_0000 - cmp r9, rdi - jae _atSym_CopyBackward # Copy backward if overlapped -_InternalMemCopyMem_al_0000: - mov rcx, r8 - and r8, 7 - shr rcx, 3 - rep movsq # Copy as many Qwords as possible - jmp _atSym_CopyBytes -_atSym_CopyBackward: - mov rsi, r9 # rsi <- End of Source - lea rdi, [rdi + r8 - 1] # esi <- End of Destination - std # set direction flag -_atSym_CopyBytes: - mov rcx, r8 - rep movsb # Copy bytes backward - cld - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CopyMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CopyMem.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCopyMem) +ASM_PFX(InternalMemCopyMem): + push rsi + push rdi + mov rsi, rdx # rsi <- Source + mov rdi, rcx # rdi <- Destination + lea r9, [rsi + r8 - 1] # r9 <- End of Source + cmp rsi, rdi + mov rax, rdi # rax <- Destination as return value + jae _InternalMemCopyMem_al_0000 + cmp r9, rdi + jae _atSym_CopyBackward # Copy backward if overlapped +_InternalMemCopyMem_al_0000: + mov rcx, r8 + and r8, 7 + shr rcx, 3 + rep movsq # Copy as many Qwords as possible + jmp _atSym_CopyBytes +_atSym_CopyBackward: + mov rsi, r9 # rsi <- End of Source + lea rdi, [rdi + r8 - 1] # esi <- End of Destination + std # set direction flag +_atSym_CopyBytes: + mov rcx, r8 + rep movsb # Copy bytes backward + cld + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S index 9a94f5d936..b777aac426 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem16) +ASM_PFX(InternalMemScanMem16): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S index 86a6503fb3..8f1804ce06 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem32) +ASM_PFX(InternalMemScanMem32): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasd + lea rax, [rdi - 4] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S index f05f7b2b2b..f2c4e1719a 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem64) +ASM_PFX(InternalMemScanMem64): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasq + lea rax, [rdi - 8] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S index 1d8b4e1b23..1bd944c791 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx # set rax to 0 if not found - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem8.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem8) +ASM_PFX(InternalMemScanMem8): + push rdi + mov rdi, rcx + mov rcx, rdx + mov rax, r8 + repne scasb + lea rax, [rdi - 1] + cmovnz rax, rcx # set rax to 0 if not found + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S index e252f1a995..f742498d42 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rax, r8 # rax = Value - mov rdi, rcx # rdi = Buffer - xchg rcx, rdx # rcx = Count, rdx = Buffer - rep stosb - mov rax, rdx # rax = Buffer - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem) +ASM_PFX(InternalMemSetMem): + push rdi + mov rax, r8 # rax = Value + mov rdi, rcx # rdi = Buffer + xchg rcx, rdx # rcx = Count, rdx = Buffer + rep stosb + mov rax, rdx # rax = Buffer + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S index 0fb9deeb75..822ec6cafc 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem16) +ASM_PFX(InternalMemSetMem16): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosw + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S index 00fec5c969..51d5a2f1fe 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem32) +ASM_PFX(InternalMemSetMem32): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosd + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S index 359cbb1633..c8e79c6fa3 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S @@ -1,47 +1,47 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem64) +ASM_PFX(InternalMemSetMem64): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosq + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S index 97c3130709..f3694d6413 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S @@ -1,51 +1,51 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - 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 - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ZeroMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemZeroMem) +ASM_PFX(InternalMemZeroMem): + push rdi + 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 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S index f0688f59cf..6b3f17bff2 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S @@ -1,55 +1,55 @@ -#------------------------------------------------------------------------------ -# -# 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 -# -#------------------------------------------------------------------------------ - -.globl _InternalMemCompareMem - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -_InternalMemCompareMem: - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemCompareMem + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +_InternalMemCompareMem: + push %esi + push %edi + movl 12(%esp), %esi + movl 16(%esp), %edi + movl 20(%esp), %ecx + repe cmpsb + movzbl -1(%esi), %eax + movzbl -1(%edi), %edx + subl %edx, %eax + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S index a95b33759c..93b7719cc1 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S @@ -1,65 +1,65 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemCopyMem - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -_InternalMemCopyMem: - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi, %edx), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax - jae L_CopyBackward # Copy backward if overlapped -L0: - movl %edx, %ecx - andl $3, %edx - shrl $2, %ecx - rep - movsl # Copy as many Dwords as possible - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- End of Source - leal -1(%edi, %edx), %edi # edi <- End of Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb # Copy bytes backward - cld - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemCopyMem + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +_InternalMemCopyMem: + push %esi + push %edi + movl 16(%esp), %esi # esi <- Source + movl 12(%esp), %edi # edi <- Destination + movl 20(%esp), %edx # edx <- Count + leal -1(%esi, %edx), %eax # eax <- End of Source + cmpl %edi, %esi + jae L0 + cmpl %edi, %eax + jae L_CopyBackward # Copy backward if overlapped +L0: + movl %edx, %ecx + andl $3, %edx + shrl $2, %ecx + rep + movsl # Copy as many Dwords as possible + jmp L_CopyBytes +L_CopyBackward: + movl %eax, %esi # esi <- End of Source + leal -1(%edi, %edx), %edi # edi <- End of Destination + std +L_CopyBytes: + movl %edx, %ecx + rep + movsb # Copy bytes backward + cld + movl 12(%esp), %eax # eax <- Destination as return value + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S index e5ca893fe5..a7ed192b8e 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S @@ -1,52 +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: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem16 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem16: - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem16 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem16: + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasw + leal -2(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S index ac2d877cf4..a0c786fcc4 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S @@ -1,52 +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: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem32 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem32: - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem32 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem32: + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasl + leal -4(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S index a6c5995e1b..3ac51f4466 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S @@ -1,61 +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: -# -# ScanMem64.Asm -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem64 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem64: - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem64 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem64: + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + cmpl (%edi), %eax + leal 8(%edi), %edi + loopne L0 + jne L1 + cmpl -4(%edi), %edx + jecxz L1 + jne L0 +L1: + leal -8(%edi), %eax + cmovne %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S index 79edc1dc2d..744b0578b1 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S @@ -1,52 +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: -# -# ScanMem8.Asm -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem8 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem8: - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem8 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem8: + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movb 16(%esp), %al + repne scasb + leal -1(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S index 4ddf6c490b..4336bbd1c0 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S @@ -1,46 +1,46 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - - .386: - .code: - -.globl _InternalMemSetMem - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -_InternalMemSetMem: - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosb - movl 8(%esp),%eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.globl _InternalMemSetMem + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +_InternalMemSetMem: + push %edi + movl 16(%esp),%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + rep + stosb + movl 8(%esp),%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S index 6e7c136222..c7dfc30c23 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S @@ -1,43 +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: -# -# SetMem16.Asm -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemSetMem16 - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -_InternalMemSetMem16: - push %edi - movl 16(%esp), %eax - movl 8(%esp), %edi - movl 12(%esp), %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemSetMem16 + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +_InternalMemSetMem16: + push %edi + movl 16(%esp), %eax + movl 8(%esp), %edi + movl 12(%esp), %ecx + rep + stosw + movl 8(%esp), %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S index 455af20573..d2f24374d1 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S @@ -1,43 +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: -# -# SetMem32.Asm -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemSetMem32 - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -_InternalMemSetMem32: - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosl - movl 8(%esp),%eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemSetMem32 + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ) +#------------------------------------------------------------------------------ +_InternalMemSetMem32: + push %edi + movl 16(%esp),%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + rep + stosl + movl 8(%esp),%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S index b4afff0fd4..cee7e536b6 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S @@ -1,46 +1,46 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemSetMem64 - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -_InternalMemSetMem64: - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - mov %eax, -8(%edi, %ecx, 8) - mov %edx, -4(%edi, %ecx, 8) - loop L0 - movl %edi, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemSetMem64 + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +_InternalMemSetMem64: + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + mov %eax, -8(%edi, %ecx, 8) + mov %edx, -4(%edi, %ecx, 8) + loop L0 + movl %edi, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S index 8465d7cf65..4d6f003bc2 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S @@ -1,49 +1,49 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemZeroMem - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -_InternalMemZeroMem: - push %edi - xorl %eax,%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - movl %ecx,%edx - shrl $2,%ecx - andl $3,%edx - pushl %edi - rep - stosl - movl %edx,%ecx - rep - stosb - popl %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemZeroMem + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +_InternalMemZeroMem: + push %edi + xorl %eax,%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + movl %ecx,%edx + shrl $2,%ecx + andl $3,%edx + pushl %edi + rep + stosl + movl %edx,%ecx + rep + stosb + popl %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S index 5580d6237a..61343d307d 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S @@ -1,60 +1,60 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CompareMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CompareMem.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCompareMem) +ASM_PFX(InternalMemCompareMem): + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 + repe cmpsb + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S index a9c4763483..6eeca6dcd0 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S @@ -1,67 +1,67 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx # rsi <- Source - mov rdi, rcx # rdi <- Destination - lea r9, [rsi + r8 - 1] # r9 <- End of Source - cmp rsi, rdi - mov rax, rdi # rax <- Destination as return value - jae L0 - cmp r9, rdi - jae L_CopyBackward # Copy backward if overlapped -L0: - mov rcx, r8 - and r8, 7 - shr rcx, 3 - rep movsq # Copy as many Qwords as possible - jmp L_CopyBytes -L_CopyBackward: - mov rsi, r9 # rsi <- End of Source - lea rdi, [rdi + r8 - 1] # esi <- End of Destination - std # set direction flag -L_CopyBytes: - mov rcx, r8 - rep movsb # Copy bytes backward - cld - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CopyMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CopyMem.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCopyMem) +ASM_PFX(InternalMemCopyMem): + push rsi + push rdi + mov rsi, rdx # rsi <- Source + mov rdi, rcx # rdi <- Destination + lea r9, [rsi + r8 - 1] # r9 <- End of Source + cmp rsi, rdi + mov rax, rdi # rax <- Destination as return value + jae L0 + cmp r9, rdi + jae L_CopyBackward # Copy backward if overlapped +L0: + mov rcx, r8 + and r8, 7 + shr rcx, 3 + rep movsq # Copy as many Qwords as possible + jmp L_CopyBytes +L_CopyBackward: + mov rsi, r9 # rsi <- End of Source + lea rdi, [rdi + r8 - 1] # esi <- End of Destination + std # set direction flag +L_CopyBytes: + mov rcx, r8 + rep movsb # Copy bytes backward + cld + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S index 9a94f5d936..b777aac426 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem16) +ASM_PFX(InternalMemScanMem16): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S index 86a6503fb3..8f1804ce06 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem32) +ASM_PFX(InternalMemScanMem32): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasd + lea rax, [rdi - 4] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S index f05f7b2b2b..f2c4e1719a 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem64) +ASM_PFX(InternalMemScanMem64): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasq + lea rax, [rdi - 8] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S index 1d8b4e1b23..1bd944c791 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx # set rax to 0 if not found - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem8.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem8) +ASM_PFX(InternalMemScanMem8): + push rdi + mov rdi, rcx + mov rcx, rdx + mov rax, r8 + repne scasb + lea rax, [rdi - 1] + cmovnz rax, rcx # set rax to 0 if not found + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S index e252f1a995..f742498d42 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rax, r8 # rax = Value - mov rdi, rcx # rdi = Buffer - xchg rcx, rdx # rcx = Count, rdx = Buffer - rep stosb - mov rax, rdx # rax = Buffer - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem) +ASM_PFX(InternalMemSetMem): + push rdi + mov rax, r8 # rax = Value + mov rdi, rcx # rdi = Buffer + xchg rcx, rdx # rcx = Count, rdx = Buffer + rep stosb + mov rax, rdx # rax = Buffer + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S index 0fb9deeb75..822ec6cafc 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem16) +ASM_PFX(InternalMemSetMem16): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosw + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S index 00fec5c969..51d5a2f1fe 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S @@ -1,48 +1,48 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem32) +ASM_PFX(InternalMemSetMem32): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosd + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S index 359cbb1633..c8e79c6fa3 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S @@ -1,47 +1,47 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - mov rax, rdx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from SetMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem64) +ASM_PFX(InternalMemSetMem64): + push rdi + mov rdi, rcx + mov rax, r8 + xchg rcx, rdx + rep stosq + mov rax, rdx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S index 97c3130709..f3694d6413 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S @@ -1,51 +1,51 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - 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 - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ZeroMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemZeroMem) +ASM_PFX(InternalMemZeroMem): + push rdi + 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 + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S index f0688f59cf..6b3f17bff2 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S @@ -1,55 +1,55 @@ -#------------------------------------------------------------------------------ -# -# 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 -# -#------------------------------------------------------------------------------ - -.globl _InternalMemCompareMem - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -_InternalMemCompareMem: - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemCompareMem + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +_InternalMemCompareMem: + push %esi + push %edi + movl 12(%esp), %esi + movl 16(%esp), %edi + movl 20(%esp), %ecx + repe cmpsb + movzbl -1(%esi), %eax + movzbl -1(%edi), %edx + subl %edx, %eax + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S index ddbcbaf1b1..99dd7a5099 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S @@ -1,85 +1,85 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemCopyMem - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -_InternalMemCopyMem: - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi,%edx,), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - jz L1 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx # edx <- remaining bytes to copy - rep - movsb -L1: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx # ecx <- # of DQwords to copy - jz L_CopyBytes - addl $-16, %esp - movdqu %xmm0, (%esp) -L2: - movdqu (%esi), %xmm0 - movntdq %xmm0, (%edi) - addl $16, %esi - addl $16, %edi - loop L2 - mfence - movdqu (%esp),%xmm0 - addl $16, %esp # stack cleanup - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- Last byte in Source - leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb - cld - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemCopyMem + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +_InternalMemCopyMem: + push %esi + push %edi + movl 16(%esp), %esi # esi <- Source + movl 12(%esp), %edi # edi <- Destination + movl 20(%esp), %edx # edx <- Count + leal -1(%esi,%edx,), %eax # eax <- End of Source + cmpl %edi, %esi + jae L0 + cmpl %edi, %eax # Overlapped? + jae L_CopyBackward # Copy backward if overlapped +L0: + xorl %ecx, %ecx + subl %edi, %ecx + andl $15, %ecx # ecx + edi aligns on 16-byte boundary + jz L1 + cmpl %edx, %ecx + cmova %edx, %ecx + subl %ecx, %edx # edx <- remaining bytes to copy + rep + movsb +L1: + movl %edx, %ecx + andl $15, %edx + shrl $4, %ecx # ecx <- # of DQwords to copy + jz L_CopyBytes + addl $-16, %esp + movdqu %xmm0, (%esp) +L2: + movdqu (%esi), %xmm0 + movntdq %xmm0, (%edi) + addl $16, %esi + addl $16, %edi + loop L2 + mfence + movdqu (%esp),%xmm0 + addl $16, %esp # stack cleanup + jmp L_CopyBytes +L_CopyBackward: + movl %eax, %esi # esi <- Last byte in Source + leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination + std +L_CopyBytes: + movl %edx, %ecx + rep + movsb + cld + movl 12(%esp), %eax # eax <- Destination as return value + pop %edi + pop %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S index e5ca893fe5..a7ed192b8e 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S @@ -1,52 +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: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem16 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem16: - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem16 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem16: + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasw + leal -2(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S index ac2d877cf4..a0c786fcc4 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S @@ -1,52 +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: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem32 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem32: - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem32 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem32: + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movl 16(%esp), %eax + repne scasl + leal -4(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S index a6c5995e1b..3ac51f4466 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S @@ -1,61 +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: -# -# ScanMem64.Asm -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem64 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem64: - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem64 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem64: + push %edi + movl 12(%esp), %ecx + movl 16(%esp), %eax + movl 20(%esp), %edx + movl 8(%esp), %edi +L0: + cmpl (%edi), %eax + leal 8(%edi), %edi + loopne L0 + jne L1 + cmpl -4(%edi), %edx + jecxz L1 + jne L0 +L1: + leal -8(%edi), %eax + cmovne %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S index 79edc1dc2d..744b0578b1 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S @@ -1,52 +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: -# -# ScanMem8.Asm -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -.globl _InternalMemScanMem8 - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemScanMem8: - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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 +# +#------------------------------------------------------------------------------ + +.globl _InternalMemScanMem8 + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemScanMem8: + push %edi + movl 12(%esp), %ecx + movl 8(%esp), %edi + movb 16(%esp), %al + repne scasb + leal -1(%edi), %eax + cmovnz %ecx, %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S index 86bba889f2..26305a7303 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S @@ -1,76 +1,76 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - - .686: - #.MODEL flat,C - .xmm: - .code: - -#------------------------------------------------------------------------------ -# VOID * -# _mem_SetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -.globl _InternalMemSetMem -_InternalMemSetMem: - push %edi - movl 12(%esp), %edx # edx <- Count - movl 8(%esp), %edi # edi <- Buffer - movb 16(%esp), %al # al <- Value - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - jz L0 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosb -L0: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx # ecx <- # of DQwords to set - jz L_SetBytes - movb %al, %ah # ax <- Value | (Value << 8) - addl $-16, %esp - movdqu %xmm0, (%esp) - movd %eax, %xmm0 - pshuflw $0, %xmm0, %xmm0 - movlhps %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence - movdqu (%esp), %xmm0 - addl $16, %esp # stack cleanup -L_SetBytes: - movl %edx, %ecx - rep - stosb - movl 8(%esp), %eax # eax <- Buffer as return value - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + + .686: + #.MODEL flat,C + .xmm: + .code: + +#------------------------------------------------------------------------------ +# VOID * +# _mem_SetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.globl _InternalMemSetMem +_InternalMemSetMem: + push %edi + movl 12(%esp), %edx # edx <- Count + movl 8(%esp), %edi # edi <- Buffer + movb 16(%esp), %al # al <- Value + xorl %ecx, %ecx + subl %edi, %ecx + andl $15, %ecx # ecx + edi aligns on 16-byte boundary + jz L0 + cmpl %edx, %ecx + cmova %edx, %ecx + subl %ecx, %edx + rep + stosb +L0: + movl %edx, %ecx + andl $15, %edx + shrl $4, %ecx # ecx <- # of DQwords to set + jz L_SetBytes + movb %al, %ah # ax <- Value | (Value << 8) + addl $-16, %esp + movdqu %xmm0, (%esp) + movd %eax, %xmm0 + pshuflw $0, %xmm0, %xmm0 + movlhps %xmm0, %xmm0 +L1: + movntdq %xmm0, (%edi) + addl $16, %edi + loop L1 + mfence + movdqu (%esp), %xmm0 + addl $16, %esp # stack cleanup +L_SetBytes: + movl %edx, %ecx + rep + stosb + movl 8(%esp), %eax # eax <- Buffer as return value + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S index 8ec96a9b6c..d81ebab4b9 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S @@ -1,69 +1,69 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemSetMem16 - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -_InternalMemSetMem16: - push %edi - movl 12(%esp), %edx - movl 8(%esp), %edi - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - movl 16(%esp), %eax - jz L0 - shrl %ecx - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosw -L0: - movl %edx, %ecx - andl $7, %edx - shrl $3, %ecx - jz L_SetWords - movd %eax, %xmm0 - pshuflw $0, %xmm0, %xmm0 - movlhps %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence -L_SetWords: - movl %edx, %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemSetMem16 + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +_InternalMemSetMem16: + push %edi + movl 12(%esp), %edx + movl 8(%esp), %edi + xorl %ecx, %ecx + subl %edi, %ecx + andl $15, %ecx # ecx + edi aligns on 16-byte boundary + movl 16(%esp), %eax + jz L0 + shrl %ecx + cmpl %edx, %ecx + cmova %edx, %ecx + subl %ecx, %edx + rep + stosw +L0: + movl %edx, %ecx + andl $7, %edx + shrl $3, %ecx + jz L_SetWords + movd %eax, %xmm0 + pshuflw $0, %xmm0, %xmm0 + movlhps %xmm0, %xmm0 +L1: + movntdq %xmm0, (%edi) + addl $16, %edi + loop L1 + mfence +L_SetWords: + movl %edx, %ecx + rep + stosw + movl 8(%esp), %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S index f91169a6e0..c068908821 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S @@ -1,68 +1,68 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemSetMem32 - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -_InternalMemSetMem32: - push %edi - movl 12(%esp), %edx - movl 8(%esp), %edi - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - movl 16(%esp), %eax - jz L0 - shrl $2, %ecx - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosl -L0: - movl %edx, %ecx - andl $3, %edx - shrl $2, %ecx - jz L_SetDwords - movd %eax, %xmm0 - pshufd $0, %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence -L_SetDwords: - movl %edx, %ecx - rep - stosl - movl 8(%esp), %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemSetMem32 + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +_InternalMemSetMem32: + push %edi + movl 12(%esp), %edx + movl 8(%esp), %edi + xorl %ecx, %ecx + subl %edi, %ecx + andl $15, %ecx # ecx + edi aligns on 16-byte boundary + movl 16(%esp), %eax + jz L0 + shrl $2, %ecx + cmpl %edx, %ecx + cmova %edx, %ecx + subl %ecx, %edx + rep + stosl +L0: + movl %edx, %ecx + andl $3, %edx + shrl $2, %ecx + jz L_SetDwords + movd %eax, %xmm0 + pshufd $0, %xmm0, %xmm0 +L1: + movntdq %xmm0, (%edi) + addl $16, %edi + loop L1 + mfence +L_SetDwords: + movl %edx, %ecx + rep + stosl + movl 8(%esp), %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S index 8b4157f741..b1b326f0fd 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S @@ -1,65 +1,65 @@ -#------------------------------------------------------------------------------ -# -# 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: -# -#------------------------------------------------------------------------------ - -.globl _InternalMemZeroMem - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -_InternalMemZeroMem: - push %edi - movl 8(%esp), %edi - movl 12(%esp), %edx - xorl %ecx, %ecx - subl %edi, %ecx - xorl %eax, %eax - andl $15, %ecx - jz L0 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosb -L0: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx - jz L_ZeroBytes - pxor %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence -L_ZeroBytes: - movl %edx, %ecx - rep - stosb - movl 8(%esp), %eax - pop %edi - ret +#------------------------------------------------------------------------------ +# +# 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: +# +#------------------------------------------------------------------------------ + +.globl _InternalMemZeroMem + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +_InternalMemZeroMem: + push %edi + movl 8(%esp), %edi + movl 12(%esp), %edx + xorl %ecx, %ecx + subl %edi, %ecx + xorl %eax, %eax + andl $15, %ecx + jz L0 + cmpl %edx, %ecx + cmova %edx, %ecx + subl %ecx, %edx + rep + stosb +L0: + movl %edx, %ecx + andl $15, %edx + shrl $4, %ecx + jz L_ZeroBytes + pxor %xmm0, %xmm0 +L1: + movntdq %xmm0, (%edi) + addl $16, %edi + loop L1 + mfence +L_ZeroBytes: + movl %edx, %ecx + rep + stosb + movl 8(%esp), %eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S index 5580d6237a..61343d307d 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S @@ -1,60 +1,60 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - +# +# ConvertAsm.py: Automatically generated from CompareMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CompareMem.S +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# INTN +# EFIAPI +# InternalMemCompareMem ( +# IN CONST VOID *DestinationBuffer, +# IN CONST VOID *SourceBuffer, +# IN UINTN Length +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCompareMem) +ASM_PFX(InternalMemCompareMem): + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov rcx, r8 + repe cmpsb + movzx rax, byte ptr [rsi - 1] + movzx rdx, byte ptr [rdi - 1] + sub rax, rdx + pop rdi + pop rsi + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S index 35db797677..553f53957e 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S @@ -1,84 +1,84 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx # rsi <- Source - mov rdi, rcx # rdi <- Destination - lea r9, [rsi + r8 - 1] # r9 <- Last byte of Source - cmp rsi, rdi - mov rax, rdi # rax <- Destination as return value - jae L0 # Copy forward if Source > Destination - cmp r9, rdi # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xor rcx, rcx - sub rcx, rdi # rcx <- -rdi - and rcx, 15 # rcx + rsi should be 16 bytes aligned - jz L1 # skip if rcx == 0 - cmp rcx, r8 - cmova rcx, r8 - sub r8, rcx - rep movsb -L1: - mov rcx, r8 - and r8, 15 - shr rcx, 4 # rcx <- # of DQwords to copy - jz L_CopyBytes - movdqa [rsp + 0x18], xmm0 # save xmm0 on stack -L2: - 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 L2 - mfence - movdqa xmm0, [rsp + 0x18] # restore xmm0 - jmp L_CopyBytes # copy remaining bytes -L_CopyBackward: - mov rsi, r9 # rsi <- Last byte of Source - lea rdi, [rdi + r8 - 1] # rdi <- Last byte of Destination - std -L_CopyBytes: - mov rcx, r8 - rep movsb - cld - pop rdi - pop rsi - ret +# +# ConvertAsm.py: Automatically generated from CopyMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# CopyMem.S +# +# Abstract: +# +# CopyMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemCopyMem ( +# IN VOID *Destination, +# IN VOID *Source, +# IN UINTN Count +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemCopyMem) +ASM_PFX(InternalMemCopyMem): + push rsi + push rdi + mov rsi, rdx # rsi <- Source + mov rdi, rcx # rdi <- Destination + lea r9, [rsi + r8 - 1] # r9 <- Last byte of Source + cmp rsi, rdi + mov rax, rdi # rax <- Destination as return value + jae L0 # Copy forward if Source > Destination + cmp r9, rdi # Overlapped? + jae L_CopyBackward # Copy backward if overlapped +L0: + xor rcx, rcx + sub rcx, rdi # rcx <- -rdi + and rcx, 15 # rcx + rsi should be 16 bytes aligned + jz L1 # skip if rcx == 0 + cmp rcx, r8 + cmova rcx, r8 + sub r8, rcx + rep movsb +L1: + mov rcx, r8 + and r8, 15 + shr rcx, 4 # rcx <- # of DQwords to copy + jz L_CopyBytes + movdqa [rsp + 0x18], xmm0 # save xmm0 on stack +L2: + 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 L2 + mfence + movdqa xmm0, [rsp + 0x18] # restore xmm0 + jmp L_CopyBytes # copy remaining bytes +L_CopyBackward: + mov rsi, r9 # rsi <- Last byte of Source + lea rdi, [rdi + r8 - 1] # rdi <- Last byte of Destination + std +L_CopyBytes: + mov rcx, r8 + rep movsb + cld + pop rdi + pop rsi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S index 9a94f5d936..b777aac426 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem16.S +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem16 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT16 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem16) +ASM_PFX(InternalMemScanMem16): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasw + lea rax, [rdi - 2] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S index 86a6503fb3..8f1804ce06 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem32.S +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem32 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem32) +ASM_PFX(InternalMemScanMem32): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasd + lea rax, [rdi - 4] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S index f05f7b2b2b..f2c4e1719a 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem64.S +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem64 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT64 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem64) +ASM_PFX(InternalMemScanMem64): + push rdi + mov rdi, rcx + mov rax, r8 + mov rcx, rdx + repne scasq + lea rax, [rdi - 8] + cmovnz rax, rcx + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S index 1d8b4e1b23..1bd944c791 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S @@ -1,57 +1,57 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx # set rax to 0 if not found - pop rdi - ret - +# +# ConvertAsm.py: Automatically generated from ScanMem8.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ScanMem8.S +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances contain the same copy of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# BaseMemoryLibOptDxe +# BaseMemoryLibOptPei +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# CONST VOID * +# EFIAPI +# InternalMemScanMem8 ( +# IN CONST VOID *Buffer, +# IN UINTN Length, +# IN UINT8 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemScanMem8) +ASM_PFX(InternalMemScanMem8): + push rdi + mov rdi, rcx + mov rcx, rdx + mov rax, r8 + repne scasb + lea rax, [rdi - 1] + cmovnz rax, rcx # set rax to 0 if not found + pop rdi + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S index 5d915d4a08..4410082078 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S @@ -1,73 +1,73 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rdi, rcx # rdi <- Buffer - mov al, r8b # al <- Value - mov r9, rdi # r9 <- Buffer as return value - xor rcx, rcx - sub rcx, rdi - and rcx, 15 # rcx + rdi aligns on 16-byte boundary - jz L0 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosb -L0: - mov rcx, rdx - and rdx, 15 - shr rcx, 4 - jz L_SetBytes - mov ah, al # ax <- Value repeats twice - movdqa [rsp + 0x10], xmm0 # save xmm0 - 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 -L1: - movntdq [rdi], xmm0 # rdi should be 16-byte aligned - add rdi, 16 - loop L1 - mfence - movdqa xmm0, [rsp + 0x10] # restore xmm0 -L_SetBytes: - mov ecx, edx # high 32 bits of rcx are always zero - rep stosb - mov rax, r9 # rax <- Return value - pop rdi - ret +# +# ConvertAsm.py: Automatically generated from SetMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem.S +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT8 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem) +ASM_PFX(InternalMemSetMem): + push rdi + mov rdi, rcx # rdi <- Buffer + mov al, r8b # al <- Value + mov r9, rdi # r9 <- Buffer as return value + xor rcx, rcx + sub rcx, rdi + and rcx, 15 # rcx + rdi aligns on 16-byte boundary + jz L0 + cmp rcx, rdx + cmova rcx, rdx + sub rdx, rcx + rep stosb +L0: + mov rcx, rdx + and rdx, 15 + shr rcx, 4 + jz L_SetBytes + mov ah, al # ax <- Value repeats twice + movdqa [rsp + 0x10], xmm0 # save xmm0 + 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 +L1: + movntdq [rdi], xmm0 # rdi should be 16-byte aligned + add rdi, 16 + loop L1 + mfence + movdqa xmm0, [rsp + 0x10] # restore xmm0 +L_SetBytes: + mov ecx, edx # high 32 bits of rcx are always zero + rep stosb + mov rax, r9 # rax <- Return value + pop rdi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S index 354222c1a9..8cf0710c90 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S @@ -1,71 +1,71 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov r9, rdi - xor rcx, rcx - sub rcx, rdi - and rcx, 15 - mov rax, r8 - jz L0 - shr rcx, 1 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosw -L0: - mov rcx, rdx - and edx, 7 - shr rcx, 3 - jz L_SetWords - movd xmm0, eax - pshuflw xmm0, xmm0, 0 - movlhps xmm0, xmm0 -L1: - movntdq [rdi], xmm0 - add rdi, 16 - loop L1 - mfence -L_SetWords: - mov ecx, edx - rep stosw - mov rax, r9 - pop rdi - ret +# +# ConvertAsm.py: Automatically generated from SetMem16.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem16.S +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem16 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT16 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem16) +ASM_PFX(InternalMemSetMem16): + push rdi + mov rdi, rcx + mov r9, rdi + xor rcx, rcx + sub rcx, rdi + and rcx, 15 + mov rax, r8 + jz L0 + shr rcx, 1 + cmp rcx, rdx + cmova rcx, rdx + sub rdx, rcx + rep stosw +L0: + mov rcx, rdx + and edx, 7 + shr rcx, 3 + jz L_SetWords + movd xmm0, eax + pshuflw xmm0, xmm0, 0 + movlhps xmm0, xmm0 +L1: + movntdq [rdi], xmm0 + add rdi, 16 + loop L1 + mfence +L_SetWords: + mov ecx, edx + rep stosw + mov rax, r9 + pop rdi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S index 2ace79ad96..c8f4065ec1 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S @@ -1,70 +1,70 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov r9, rdi - xor rcx, rcx - sub rcx, rdi - and rcx, 15 - mov rax, r8 - jz L0 - shr rcx, 2 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosd -L0: - mov rcx, rdx - and edx, 3 - shr rcx, 2 - jz L_SetDwords - movd xmm0, eax - pshufd xmm0, xmm0, 0 -L1: - movntdq [rdi], xmm0 - add rdi, 16 - loop L1 - mfence -L_SetDwords: - mov ecx, edx - rep stosd - mov rax, r9 - pop rdi - ret +# +# ConvertAsm.py: Automatically generated from SetMem32.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem32.S +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# EFIAPI +# InternalMemSetMem32 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT32 Value +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem32) +ASM_PFX(InternalMemSetMem32): + push rdi + mov rdi, rcx + mov r9, rdi + xor rcx, rcx + sub rcx, rdi + and rcx, 15 + mov rax, r8 + jz L0 + shr rcx, 2 + cmp rcx, rdx + cmova rcx, rdx + sub rdx, rcx + rep stosd +L0: + mov rcx, rdx + and edx, 3 + shr rcx, 2 + jz L_SetDwords + movd xmm0, eax + pshufd xmm0, xmm0, 0 +L1: + movntdq [rdi], xmm0 + add rdi, 16 + loop L1 + mfence +L_SetDwords: + mov ecx, edx + rep stosd + mov rax, r9 + pop rdi + ret diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S index 870f8c0ee9..32dce91da8 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S @@ -1,61 +1,61 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - mov rax, rcx # rax <- Buffer - xchg rcx, rdx # rcx <- Count & rdx <- Buffer - test dl, 8 - movq xmm0, r8 - jz L0 - mov [rdx], r8 - add rdx, 8 - dec rcx -L0: - shr rcx, 1 - jz L_SetQwords - movlhps xmm0, xmm0 -L1: - movntdq [rdx], xmm0 - lea rdx, [rdx + 16] - loop L1 - mfence -L_SetQwords: - jnc L2 - mov [rdx], r8 -L2: - ret - +# +# ConvertAsm.py: Automatically generated from SetMem64.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# SetMem64.S +# +# Abstract: +# +# SetMem64 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemSetMem64 ( +# IN VOID *Buffer, +# IN UINTN Count, +# IN UINT64 Value +# ) +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemSetMem64) +ASM_PFX(InternalMemSetMem64): + mov rax, rcx # rax <- Buffer + xchg rcx, rdx # rcx <- Count & rdx <- Buffer + test dl, 8 + movq xmm0, r8 + jz L0 + mov [rdx], r8 + add rdx, 8 + dec rcx +L0: + shr rcx, 1 + jz L_SetQwords + movlhps xmm0, xmm0 +L1: + movntdq [rdx], xmm0 + lea rdx, [rdx + 16] + loop L1 + mfence +L_SetQwords: + jnc L2 + mov [rdx], r8 +L2: + ret + diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S index f152d98a39..4f077943ba 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S +++ b/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S @@ -1,66 +1,66 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -.intel_syntax noprefix -.globl ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - mov rdi, rcx - xor rcx, rcx - xor eax, eax - sub rcx, rdi - and rcx, 15 - mov r8, rdi - jz L0 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosb -L0: - mov rcx, rdx - and edx, 15 - shr rcx, 4 - jz L_ZeroBytes - pxor xmm0, xmm0 -L1: - movntdq [rdi], xmm0 # rdi should be 16-byte aligned - add rdi, 16 - loop L1 - mfence -L_ZeroBytes: - mov ecx, edx - rep stosb - mov rax, r8 - pop rdi - ret +# +# ConvertAsm.py: Automatically generated from ZeroMem.asm +# +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# Module Name: +# +# ZeroMem.S +# +# Abstract: +# +# ZeroMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + +#------------------------------------------------------------------------------ +# VOID * +# InternalMemZeroMem ( +# IN VOID *Buffer, +# IN UINTN Count +# ); +#------------------------------------------------------------------------------ +.intel_syntax noprefix +.globl ASM_PFX(InternalMemZeroMem) +ASM_PFX(InternalMemZeroMem): + push rdi + mov rdi, rcx + xor rcx, rcx + xor eax, eax + sub rcx, rdi + and rcx, 15 + mov r8, rdi + jz L0 + cmp rcx, rdx + cmova rcx, rdx + sub rdx, rcx + rep stosb +L0: + mov rcx, rdx + and edx, 15 + shr rcx, 4 + jz L_ZeroBytes + pxor xmm0, xmm0 +L1: + movntdq [rdi], xmm0 # rdi should be 16-byte aligned + add rdi, 16 + loop L1 + mfence +L_ZeroBytes: + mov ecx, edx + rep stosb + mov rax, r8 + pop rdi + ret