From 86345de537e0670a621fa0ce81aea52d28d1f998 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Thu, 20 Aug 2009 09:38:23 +0000 Subject: [PATCH] Update to remove .intel_syntax directives to improve portability since it is not supported by all GCC assembliers. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9165 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/BaseMemoryLib/X64/CompareMem.S | 23 +++++---- .../Library/BaseMemoryLib/X64/CopyMem.S | 47 +++++++++---------- .../Library/BaseMemoryLib/X64/ScanMem16.S | 17 ++++--- .../Library/BaseMemoryLib/X64/ScanMem32.S | 19 ++++---- .../Library/BaseMemoryLib/X64/ScanMem64.S | 17 ++++--- .../Library/BaseMemoryLib/X64/ScanMem8.S | 17 ++++--- .../Library/BaseMemoryLib/X64/SetMem.S | 15 +++--- .../Library/BaseMemoryLib/X64/SetMem16.S | 15 +++--- .../Library/BaseMemoryLib/X64/SetMem32.S | 17 ++++--- .../Library/BaseMemoryLib/X64/SetMem64.S | 15 +++--- .../Library/BaseMemoryLib/X64/ZeroMem.S | 23 +++++---- 11 files changed, 107 insertions(+), 118 deletions(-) diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.S index 011d2b00c1..c8d0ee90dc 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -40,19 +40,18 @@ # IN UINTN Length # ); #------------------------------------------------------------------------------ -.intel_syntax .globl ASM_PFX(InternalMemCompareMem) ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 + pushq %rsi + pushq %rdi + movq %rcx, %rsi + movq %rdx, %rdi + movq %r8, %rcx repe cmpsb - movzx rax, byte ptr [rsi - 1] - movzx rdx, byte ptr [rdi - 1] - sub rax, rdx - pop rdi - pop rsi + movzbq -1(%rsi) , %rax + movzbq -1(%rdi) , %rdx + subq %rdx, %rax + popq %rdi + popq %rsi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.S index 97a55206ec..143e4eafe9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -34,34 +34,33 @@ # IN UINTN Count # ) #------------------------------------------------------------------------------ -.intel_syntax .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 + pushq %rsi + pushq %rdi + movq %rdx, %rsi # rsi <- Source + movq %rcx, %rdi # rdi <- Destination + leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source + cmpq %rdi, %rsi + movq %rdi, %rax # rax <- Destination as return value + jae L0 + cmpq %rdi, %r9 + jae L_CopyBackward # Copy backward if overlapped +L0: + movq %r8, %rcx + andq $7, %r8 + shrq $3, %rcx 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 + jmp L_CopyBytes +L_CopyBackward: + movq %r9, %rsi # rsi <- End of Source + leaq -1(%rdi, %r8), %rdi # esi <- End of Destination std # set direction flag -_atSym_CopyBytes: - mov rcx, r8 +L_CopyBytes: + movq %r8, %rcx rep movsb # Copy bytes backward cld - pop rdi - pop rsi + popq %rdi + popq %rsi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.S index 2c049b588f..2b12f7a87a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -40,16 +40,15 @@ # IN UINT16 Value # ); #------------------------------------------------------------------------------ -.intel_syntax .globl ASM_PFX(InternalMemScanMem16) ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx + pushq %rdi + movq %rcx, %rdi + movq %rdx, %rcx + movq %r8, %rax repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi + leaq -2(%rdi), %rax + cmovnz %rcx, %rax # set rax to 0 if not found + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.S index c16ef8d4f8..f593088ff8 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -40,16 +40,15 @@ # IN UINT32 Value # ); #------------------------------------------------------------------------------ -.intel_syntax .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 + pushq %rdi + movq %rcx, %rdi + movq %rdx, %rcx + movq %r8, %rax + repne scasl + leaq -4(%rdi), %rax + cmovnz %rcx, %rax # set rax to 0 if not found + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.S index 4916520ed7..89ba3ea6c7 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -40,16 +40,15 @@ # IN UINT64 Value # ); #------------------------------------------------------------------------------ -.intel_syntax .globl ASM_PFX(InternalMemScanMem64) ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx + pushq %rdi + movq %rcx, %rdi + movq %rdx, %rcx + movq %r8, %rax repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi + leaq -8(%rdi), %rax + cmovnz %rcx, %rax # set rax to 0 if not found + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.S index 90a6b388c4..35161cefb1 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -40,16 +40,15 @@ # IN UINT8 Value # ); #------------------------------------------------------------------------------ -.intel_syntax .globl ASM_PFX(InternalMemScanMem8) ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 + pushq %rdi + movq %rcx, %rdi + movq %rdx, %rcx + movq %r8, %rax repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx # set rax to 0 if not found - pop rdi + leaq -1(%rdi), %rax + cmovnz %rcx, %rax # set rax to 0 if not found + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem.S index 6316d073e4..bea0afb17a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -34,15 +34,14 @@ # IN UINT8 Value # ) #------------------------------------------------------------------------------ -.intel_syntax .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 + pushq %rdi + movq %r8, %rax # rax = Value + movq %rcx, %rdi # rdi = Buffer + xchgq %rdx, %rcx # rcx = Count, rdx = Buffer rep stosb - mov rax, rdx # rax = Buffer - pop rdi + movq %rdx, %rax # rax = Buffer + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem16.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem16.S index 35551b78d3..edaa1e8275 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem16.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem16.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -34,15 +34,14 @@ # IN UINT16 Value # ) #------------------------------------------------------------------------------ -.intel_syntax .globl ASM_PFX(InternalMemSetMem16) ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx + pushq %rdi + movq %rcx, %rdi + movq %r8, %rax + xchgq %rdx, %rcx rep stosw - mov rax, rdx - pop rdi + movq %rdx, %rax + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem32.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem32.S index 86ae715b51..938f793792 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem32.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem32.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -34,15 +34,14 @@ # IN UINT32 Value # ); #------------------------------------------------------------------------------ -.intel_syntax .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 + pushq %rdi + movq %rcx, %rdi + movq %r8, %rax + xchgq %rdx, %rcx + rep stosl + movq %rdx, %rax + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.S index 929a9e738f..0eccff99fd 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -33,15 +33,14 @@ # IN UINT64 Value # ) #------------------------------------------------------------------------------ -.intel_syntax .globl ASM_PFX(InternalMemSetMem64) ASM_PFX(InternalMemSetMem64): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx + pushq %rdi + movq %rcx, %rdi + movq %r8, %rax + xchgq %rdx, %rcx rep stosq - mov rax, rdx - pop rdi + movq %rdx, %rax + popq %rdi ret diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.S index b2b08502c4..79016f74c3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.S @@ -3,7 +3,7 @@ # #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -32,20 +32,19 @@ # IN UINTN Count # ); #------------------------------------------------------------------------------ -.intel_syntax .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 + pushq %rdi + pushq %rcx + xorq %rax, %rax + movq %rcx, %rdi + movq %rdx, %rcx + shrq $3, %rcx + andq $7, %rdx rep stosq - mov ecx, edx + movl %edx, %ecx rep stosb - pop rax - pop rdi + popq %rax + popq %rdi ret