Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> --- CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 2 +- CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 2 +- CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 2 +- CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 2 +- .../BaseCryptLib/SysCall/Ia32/MathRShiftU64.S | 66 ---------------------- .../BaseCryptLib/SysCall/Ia32/MathRShiftU64.nasm | 57 +++++++++++++++++++ 6 files changed, 61 insertions(+), 70 deletions(-) delete mode 100644 CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S create mode 100644 CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.nasm
diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf index 5cfe308..42b0b14 100644 --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf @@ -73,7 +73,7 @@ SysCall/Ia32/MathDivU64x64.nasm | GCC SysCall/Ia32/MathRemainderU64x64.nasm | GCC SysCall/Ia32/MathLShiftS64.nasm | GCC - SysCall/Ia32/MathRShiftU64.S | GCC + SysCall/Ia32/MathRShiftU64.nasm | GCC Rand/CryptRandTsc.c diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf index c39c7e5..ac0bc2a 100644 --- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf @@ -83,7 +83,7 @@ SysCall/Ia32/MathDivU64x64.nasm | GCC SysCall/Ia32/MathRemainderU64x64.nasm | GCC SysCall/Ia32/MathLShiftS64.nasm | GCC - SysCall/Ia32/MathRShiftU64.S | GCC + SysCall/Ia32/MathRShiftU64.nasm | GCC [Packages] MdePkg/MdePkg.dec diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf index 6903496..b5508a9 100644 --- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf @@ -78,7 +78,7 @@ SysCall/Ia32/MathDivU64x64.nasm | GCC SysCall/Ia32/MathRemainderU64x64.nasm | GCC SysCall/Ia32/MathLShiftS64.nasm | GCC - SysCall/Ia32/MathRShiftU64.S | GCC + SysCall/Ia32/MathRShiftU64.nasm | GCC Rand/CryptRandTsc.c diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf index ee8bf48..77c72bd 100644 --- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf @@ -78,7 +78,7 @@ SysCall/Ia32/MathDivU64x64.nasm | GCC SysCall/Ia32/MathRemainderU64x64.nasm | GCC SysCall/Ia32/MathLShiftS64.nasm | GCC - SysCall/Ia32/MathRShiftU64.S | GCC + SysCall/Ia32/MathRShiftU64.nasm | GCC Rand/CryptRandTsc.c diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S deleted file mode 100644 index bf05875..0000000 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S +++ /dev/null @@ -1,66 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# MathRShiftU64.S -# -# Abstract: -# -# 64-bit Math Worker Function. -# Shifts a 64-bit unsigned value right by a certain number of bits. -# -#------------------------------------------------------------------------------ - - - .686: - .code: - -ASM_GLOBAL ASM_PFX(__ashrdi3) - -#------------------------------------------------------------------------------ -# -# void __cdecl __ashrdi3 (void) -# -#------------------------------------------------------------------------------ -ASM_PFX(__ashrdi3): - # - # Checking: Only handle 64bit shifting or more - # - cmpb $64, %cl - jae _Exit - - # - # Handle shifting between 0 and 31 bits - # - cmpb $32, %cl - jae More32 - shrd %cl, %edx, %eax - shr %cl, %edx - ret - - # - # Handle shifting of 32-63 bits - # -More32: - movl %edx, %eax - xor %edx, %edx - and $31, %cl - shr %cl, %eax - ret - - # - # Invalid number (less then 32bits), return 0 - # -_Exit: - xor %eax, %eax - xor %edx, %edx - ret diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.nasm b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.nasm new file mode 100644 index 0000000..4f24819 --- /dev/null +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.nasm @@ -0,0 +1,57 @@ +;------------------------------------------------------------------------------ +; @file +; 64-bit Math Worker Function. +; Shifts a 64-bit unsigned value right by a certain number of bits. +; +; Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> +; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BSD License +; which accompanies this distribution. The full text of the license may be found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +; +;------------------------------------------------------------------------------ + +SECTION .text + +;------------------------------------------------------------------------------ +; +; void __cdecl __ashrdi3 (void) +; +;------------------------------------------------------------------------------ +global ASM_PFX(__ashrdi3) +ASM_PFX(__ashrdi3): + ; + ; Checking: Only handle 64bit shifting or more + ; + cmp cl, 64 + jae _Exit + + ; + ; Handle shifting between 0 and 31 bits + ; + cmp cl, 32 + jae More32 + shrd eax, edx, cl + shr edx, cl + ret + + ; + ; Handle shifting of 32-63 bits + ; +More32: + mov eax, edx + xor edx, edx + and cl, 31 + shr eax, cl + ret + + ; + ; Invalid number (less then 32bits), return 0 + ; +_Exit: + xor eax, eax + xor edx, edx + ret -- 2.1.1 ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel