]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Ported to GNU assembly.
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 17 May 2006 16:10:32 +0000 (16:10 +0000)
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 17 May 2006 16:10:32 +0000 (16:10 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@187 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.s [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.s [new file with mode: 0644]

diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.s
new file mode 100644 (file)
index 0000000..1ba0eda
--- /dev/null
@@ -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 (file)
index 0000000..f4df08b
--- /dev/null
@@ -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 (file)
index 0000000..33101c1
--- /dev/null
@@ -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 (file)
index 0000000..bd007fa
--- /dev/null
@@ -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 (file)
index 0000000..bfb4189
--- /dev/null
@@ -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 (file)
index 0000000..a9c8d93
--- /dev/null
@@ -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 (file)
index 0000000..fcbc1ab
--- /dev/null
@@ -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 (file)
index 0000000..c45ff67
--- /dev/null
@@ -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 (file)
index 0000000..9f31def
--- /dev/null
@@ -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 (file)
index 0000000..81f7068
--- /dev/null
@@ -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 (file)
index 0000000..d61cdff
--- /dev/null
@@ -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