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
This commit is contained in:
qhuang8 2009-08-20 09:38:23 +00:00
parent 9811c39250
commit 86345de537
11 changed files with 107 additions and 118 deletions

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -40,19 +40,18 @@
# IN UINTN Length # IN UINTN Length
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemCompareMem) .globl ASM_PFX(InternalMemCompareMem)
ASM_PFX(InternalMemCompareMem): ASM_PFX(InternalMemCompareMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rcx movq %rcx, %rsi
mov rdi, rdx movq %rdx, %rdi
mov rcx, r8 movq %r8, %rcx
repe cmpsb repe cmpsb
movzx rax, byte ptr [rsi - 1] movzbq -1(%rsi) , %rax
movzx rdx, byte ptr [rdi - 1] movzbq -1(%rdi) , %rdx
sub rax, rdx subq %rdx, %rax
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -34,34 +34,33 @@
# IN UINTN Count # IN UINTN Count
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemCopyMem) .globl ASM_PFX(InternalMemCopyMem)
ASM_PFX(InternalMemCopyMem): ASM_PFX(InternalMemCopyMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rdx # rsi <- Source movq %rdx, %rsi # rsi <- Source
mov rdi, rcx # rdi <- Destination movq %rcx, %rdi # rdi <- Destination
lea r9, [rsi + r8 - 1] # r9 <- End of Source leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
cmp rsi, rdi cmpq %rdi, %rsi
mov rax, rdi # rax <- Destination as return value movq %rdi, %rax # rax <- Destination as return value
jae _InternalMemCopyMem_al_0000 jae L0
cmp r9, rdi cmpq %rdi, %r9
jae _atSym_CopyBackward # Copy backward if overlapped jae L_CopyBackward # Copy backward if overlapped
_InternalMemCopyMem_al_0000: L0:
mov rcx, r8 movq %r8, %rcx
and r8, 7 andq $7, %r8
shr rcx, 3 shrq $3, %rcx
rep movsq # Copy as many Qwords as possible rep movsq # Copy as many Qwords as possible
jmp _atSym_CopyBytes jmp L_CopyBytes
_atSym_CopyBackward: L_CopyBackward:
mov rsi, r9 # rsi <- End of Source movq %r9, %rsi # rsi <- End of Source
lea rdi, [rdi + r8 - 1] # esi <- End of Destination leaq -1(%rdi, %r8), %rdi # esi <- End of Destination
std # set direction flag std # set direction flag
_atSym_CopyBytes: L_CopyBytes:
mov rcx, r8 movq %r8, %rcx
rep movsb # Copy bytes backward rep movsb # Copy bytes backward
cld cld
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -40,16 +40,15 @@
# IN UINT16 Value # IN UINT16 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemScanMem16) .globl ASM_PFX(InternalMemScanMem16)
ASM_PFX(InternalMemScanMem16): ASM_PFX(InternalMemScanMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %rdx, %rcx
mov rcx, rdx movq %r8, %rax
repne scasw repne scasw
lea rax, [rdi - 2] leaq -2(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -40,16 +40,15 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemScanMem32) .globl ASM_PFX(InternalMemScanMem32)
ASM_PFX(InternalMemScanMem32): ASM_PFX(InternalMemScanMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %rdx, %rcx
mov rcx, rdx movq %r8, %rax
repne scasd repne scasl
lea rax, [rdi - 4] leaq -4(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -40,16 +40,15 @@
# IN UINT64 Value # IN UINT64 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemScanMem64) .globl ASM_PFX(InternalMemScanMem64)
ASM_PFX(InternalMemScanMem64): ASM_PFX(InternalMemScanMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %rdx, %rcx
mov rcx, rdx movq %r8, %rax
repne scasq repne scasq
lea rax, [rdi - 8] leaq -8(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -40,16 +40,15 @@
# IN UINT8 Value # IN UINT8 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemScanMem8) .globl ASM_PFX(InternalMemScanMem8)
ASM_PFX(InternalMemScanMem8): ASM_PFX(InternalMemScanMem8):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
mov rax, r8 movq %r8, %rax
repne scasb repne scasb
lea rax, [rdi - 1] leaq -1(%rdi), %rax
cmovnz rax, rcx # set rax to 0 if not found cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -34,15 +34,14 @@
# IN UINT8 Value # IN UINT8 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemSetMem) .globl ASM_PFX(InternalMemSetMem)
ASM_PFX(InternalMemSetMem): ASM_PFX(InternalMemSetMem):
push rdi pushq %rdi
mov rax, r8 # rax = Value movq %r8, %rax # rax = Value
mov rdi, rcx # rdi = Buffer movq %rcx, %rdi # rdi = Buffer
xchg rcx, rdx # rcx = Count, rdx = Buffer xchgq %rdx, %rcx # rcx = Count, rdx = Buffer
rep stosb rep stosb
mov rax, rdx # rax = Buffer movq %rdx, %rax # rax = Buffer
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -34,15 +34,14 @@
# IN UINT16 Value # IN UINT16 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemSetMem16) .globl ASM_PFX(InternalMemSetMem16)
ASM_PFX(InternalMemSetMem16): ASM_PFX(InternalMemSetMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosw rep stosw
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -34,15 +34,14 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemSetMem32) .globl ASM_PFX(InternalMemSetMem32)
ASM_PFX(InternalMemSetMem32): ASM_PFX(InternalMemSetMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosd rep stosl
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -33,15 +33,14 @@
# IN UINT64 Value # IN UINT64 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemSetMem64) .globl ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64): ASM_PFX(InternalMemSetMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosq rep stosq
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -32,20 +32,19 @@
# IN UINTN Count # IN UINTN Count
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax
.globl ASM_PFX(InternalMemZeroMem) .globl ASM_PFX(InternalMemZeroMem)
ASM_PFX(InternalMemZeroMem): ASM_PFX(InternalMemZeroMem):
push rdi pushq %rdi
push rcx pushq %rcx
xor rax, rax xorq %rax, %rax
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
shr rcx, 3 shrq $3, %rcx
and rdx, 7 andq $7, %rdx
rep stosq rep stosq
mov ecx, edx movl %edx, %ecx
rep stosb rep stosb
pop rax popq %rax
pop rdi popq %rdi
ret ret