From cfe41b57abb8ba26e4bd1c0b09c8b3506a7c55df Mon Sep 17 00:00:00 2001 From: Michael Kinney Date: Mon, 27 Apr 2015 19:41:19 +0000 Subject: [PATCH] MdePkg/BaseMemoryLibRepStr: Support IA32 processors without CMOVx Remove use of CMOVx instruction from IA32 assembly files in BaseMemoryLibRepStr. This matches compiler flags for all supported C compilers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17214 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf | 4 ++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.asm | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.asm | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.asm | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S | 6 ++++-- MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.asm | 6 ++++-- 9 files changed, 34 insertions(+), 18 deletions(-) diff --git a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf index fd6324284e..44287d05dc 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf +++ b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf @@ -4,7 +4,7 @@ # Base Memory Library that uses REP string instructions for # high performance and small size. Optimized for use in PEI. # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -22,7 +22,7 @@ MODULE_UNI_FILE = BaseMemoryLibRepStr.uni FILE_GUID = e7884bf4-51a1-485b-982a-ff89129983bc MODULE_TYPE = BASE - VERSION_STRING = 1.0 + VERSION_STRING = 1.1 LIBRARY_CLASS = BaseMemoryLib diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S index e247d4ad09..585cda6f8c 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -47,6 +47,8 @@ ASM_PFX(InternalMemScanMem16): movl 16(%esp), %eax repne scasw leal -2(%edi), %eax - cmovnz %ecx, %eax + jz L0 + movl %ecx, %eax +L0: pop %edi ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.asm b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.asm index 0ee190e46a..c12eaff27a 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.asm +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.asm @@ -1,6 +1,6 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at @@ -48,7 +48,9 @@ InternalMemScanMem16 PROC USES edi mov eax, [esp + 16] repne scasw lea eax, [edi - 2] - cmovnz eax, ecx + jz @F + mov eax, ecx +@@: ret InternalMemScanMem16 ENDP diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S index 066fde42ce..91f04fa800 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -47,6 +47,8 @@ ASM_PFX(InternalMemScanMem32): movl 16(%esp), %eax repne scasl leal -4(%edi), %eax - cmovnz %ecx, %eax + jz L0 + movl %ecx, %eax +L0: pop %edi ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.asm b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.asm index adbf295621..b065620594 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.asm +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.asm @@ -1,6 +1,6 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at @@ -48,7 +48,9 @@ InternalMemScanMem32 PROC USES edi mov eax, [esp + 16] repne scasd lea eax, [edi - 4] - cmovnz eax, ecx + jz @F + mov eax, ecx +@@: ret InternalMemScanMem32 ENDP diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S index b3435d7fc3..5224cf7153 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -56,6 +56,8 @@ L0: jne L0 L1: leal -8(%edi), %eax - cmovne %ecx, %eax + jz L2 + movl %ecx, %eax +L2: pop %edi ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.asm b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.asm index 0a0f5d0468..96e3b99f72 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.asm +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.asm @@ -1,6 +1,6 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at @@ -57,7 +57,9 @@ InternalMemScanMem64 PROC USES edi jne @B @@: lea eax, [edi - 8] - cmovne eax, ecx + jz @F + mov eax, ecx +@@: ret InternalMemScanMem64 ENDP diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S index 5e451fd7b9..d490ee7fd0 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -47,6 +47,8 @@ ASM_PFX(InternalMemScanMem8): movb 16(%esp), %al repne scasb leal -1(%edi), %eax - cmovnz %ecx, %eax + jz L0 + movl %ecx, %eax +L0: pop %edi ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.asm b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.asm index c64d41d6c1..202d58f790 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.asm +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.asm @@ -1,6 +1,6 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at @@ -48,7 +48,9 @@ InternalMemScanMem8 PROC USES edi mov al, [esp + 16] repne scasb lea eax, [edi - 1] - cmovnz eax, ecx + jz @F + mov eax, ecx +@@: ret InternalMemScanMem8 ENDP -- 2.39.2