diff options
author | bbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-17 16:10:32 +0000 |
---|---|---|
committer | bbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-17 16:10:32 +0000 |
commit | b6bd81d45f85be8e74abb5b0a4c0e1dfea803e71 (patch) | |
tree | 58ecedd192e48a83952e4f4177f820411e91c89f /MdePkg/Library | |
parent | b546c3ade256b53e19fac2b50ea2efc9a45c59f5 (diff) | |
download | edk2-platforms-b6bd81d45f85be8e74abb5b0a4c0e1dfea803e71.tar.xz |
Ported to GNU assembly.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@187 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s | 46 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.s | 58 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.s | 43 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.s | 43 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.s | 52 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.s | 42 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.s | 36 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.s | 37 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.s | 37 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.s | 40 | ||||
-rw-r--r-- | MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.s | 44 |
11 files changed, 478 insertions, 0 deletions
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s new file mode 100644 index 0000000000..1ba0edaaeb --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s @@ -0,0 +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: +# +# CompareMem.Asm +# +# Abstract: +# +# CompareMem function +# +# Notes: +# +# The following BaseMemoryLib instances share the same version of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# +#------------------------------------------------------------------------------ + + .686: + .code: + +.global InternalMemCompareMem +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 new file mode 100644 index 0000000000..f4df08b129 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.s @@ -0,0 +1,58 @@ +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM 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: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.global InternalMemCopyMem +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(%edi,%edx),%eax # eax <- End of Destination + cmpl %edi,%esi + jae L0 + cmpl %esi,%eax + jae @CopyBackward # Copy backward if overlapped +L0: + movl %edx,%ecx + andl $3,%edx + shrl $2,%ecx + rep + movsl # Copy as many Dwords as possible + jmp @CopyBytes +@CopyBackward: + movl %eax,%edi # edi <- End of Destination + leal -1(%esi,%edx),%esi # esi <- End of Source + std +@CopyBytes: + movl %edx,%ecx + rep + movsb # Copy bytes backward + cld + movl 12(%esp),%eax # eax <- Destination as return value + push %edi + push %esi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.s b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.s new file mode 100644 index 0000000000..33101c12ee --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.s @@ -0,0 +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: +# +# ScanMem16.Asm +# +# Abstract: +# +# ScanMem16 function +# +# Notes: +# +# The following BaseMemoryLib instances share the same version of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# +#------------------------------------------------------------------------------ + + .686: + .code: + +.global InternalMemScanMem16 +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 new file mode 100644 index 0000000000..bd007fa06b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.s @@ -0,0 +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: +# +# ScanMem32.Asm +# +# Abstract: +# +# ScanMem32 function +# +# Notes: +# +# The following BaseMemoryLib instances share the same version of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# +#------------------------------------------------------------------------------ + + .686: + .code: + +.global InternalMemScanMem32 +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 new file mode 100644 index 0000000000..bfb4189782 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.s @@ -0,0 +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: +# +# ScanMem64.Asm +# +# Abstract: +# +# ScanMem64 function +# +# Notes: +# +# The following BaseMemoryLib instances share the same version of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# +#------------------------------------------------------------------------------ + + .686: + .code: + +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 new file mode 100644 index 0000000000..a9c8d93f56 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.s @@ -0,0 +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: +# +# ScanMem8.Asm +# +# Abstract: +# +# ScanMem8 function +# +# Notes: +# +# The following BaseMemoryLib instances share the same version of this file: +# +# BaseMemoryLibRepStr +# BaseMemoryLibMmx +# BaseMemoryLibSse2 +# +#------------------------------------------------------------------------------ + + .686: + .code: + +.global InternalMemScanMem8 +InternalMemScanMem8: + push %edi + movl 12(%esp),%ecx + movl 8(%esp),%edi + movb 16(%esp),%al + repne scasb + leal -1(%edi),%eax + cmovnz %ecx, %eax + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.s b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.s new file mode 100644 index 0000000000..fcbc1ab1bc --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.s @@ -0,0 +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: +# +# SetMem.Asm +# +# Abstract: +# +# SetMem function +# +# Notes: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.global InternalMemSetMem +InternalMemSetMem: + push %edi + movl 16(%esp),%eax + movl 8(%esp),%edi + movl 12(%esp),%ecx + rep + stosb + movl 8(%esp),%eax + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.s b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.s new file mode 100644 index 0000000000..c45ff67972 --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.s @@ -0,0 +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: +# +# SetMem16.Asm +# +# Abstract: +# +# SetMem16 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.global InternalMemSetMem16 +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 new file mode 100644 index 0000000000..9f31def02c --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.s @@ -0,0 +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: +# +# SetMem32.Asm +# +# Abstract: +# +# SetMem32 function +# +# Notes: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.global InternalMemSetMem32 +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 new file mode 100644 index 0000000000..81f706841f --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.s @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM 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: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.global InternalMemSetMem64 +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,4) + mov %edx,-4(%edi,%ecx,4) + loop L0 + movl %edi,%eax + pop %edi + ret diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.s b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.s new file mode 100644 index 0000000000..d61cdff81a --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.s @@ -0,0 +1,44 @@ +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006, Intel Corporation +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM 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: +# +#------------------------------------------------------------------------------ + + .386: + .code: + +.global InternalMemZeroMem +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 |