]> git.proxmox.com Git - mirror_edk2.git/commitdiff
add corresponding .S files for BaseMemoryLibXXX X64 arch. Note that we use ".intel_sy...
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 22 Oct 2008 08:36:39 +0000 (08:36 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 22 Oct 2008 08:36:39 +0000 (08:36 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6184 6f19259b-4bc3-4df7-8a09-765794883524

36 files changed:
MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S
MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S
MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S
MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S
MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S
MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S
MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S
MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S
MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S
MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S
MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S
MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S [new file with mode: 0644]

index c8f5cedf95c596a05089404b8322cb478b5d25eb..67e461a0c6f67c9a8d73955a99780311da62eb51 100644 (file)
   X64/SetMem16.asm\r
   X64/SetMem.asm\r
   X64/CopyMem.asm\r
   X64/SetMem16.asm\r
   X64/SetMem.asm\r
   X64/CopyMem.asm\r
+  X64/ScanMem64.S\r
+  X64/ScanMem32.S\r
+  X64/ScanMem16.S\r
+  X64/ScanMem8.S\r
+  X64/CompareMem.S\r
+  X64/SetMem64.S\r
+  X64/SetMem32.S\r
+  X64/SetMem16.S\r
+  X64/ZeroMem.S\r
+  X64/SetMem.S\r
+  X64/CopyMem.S\r
 \r
 \r
 [LibraryClasses]\r
 \r
 \r
 [LibraryClasses]\r
index 2dc71b2b9a7bc2a44b148b41a57dbf4be7b0207d..5580d6237a64de2997a6068a7ffd640baedd59e0 100644 (file)
@@ -1,3 +1,6 @@
+#
+# ConvertAsm.py: Automatically generated from CompareMem.asm
+#
 #------------------------------------------------------------------------------
 #
 # Copyright (c) 2006, Intel Corporation
 #------------------------------------------------------------------------------
 #
 # Copyright (c) 2006, Intel Corporation
@@ -11,7 +14,7 @@
 #
 # Module Name:
 #
 #
 # Module Name:
 #
-#   CompareMem.Asm
+#   CompareMem.S
 #
 # Abstract:
 #
 #
 # Abstract:
 #
@@ -29,6 +32,7 @@
 #
 #------------------------------------------------------------------------------
 
 #
 #------------------------------------------------------------------------------
 
+
 #------------------------------------------------------------------------------
 # INTN
 # EFIAPI
 #------------------------------------------------------------------------------
 # INTN
 # EFIAPI
 #   IN      UINTN                     Length
 #   );
 #------------------------------------------------------------------------------
 #   IN      UINTN                     Length
 #   );
 #------------------------------------------------------------------------------
-.global _InternalMemCompareMem;
-_InternalMemCompareMem:
-    push    %rsi
-    push    %rdi
-    mov     %rcx, %rsi
-    mov     %rdx, %rdi
-    mov     %r8, %rcx
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemCompareMem)
+ASM_PFX(InternalMemCompareMem):
+    push    rsi
+    push    rdi
+    mov     rsi, rcx
+    mov     rdi, rdx
+    mov     rcx, r8
     repe    cmpsb
     repe    cmpsb
-    movzbq  -1(%rsi), %rax
-    movzbq  -1(%rdi), %rdx
-    sub     %rdx, %rax
-    pop     %rdi
-    pop     %rsi
+    movzx   rax, byte ptr [rsi - 1]
+    movzx   rdx, byte ptr [rdi - 1]
+    sub     rax, rdx
+    pop     rdi
+    pop     rsi
     ret
     ret
+
index c4ecdc70eb48584c261af9922f2d6d95fa8ac4a1..3e7a396b5b4feec8e31f857b03d526c0cd1b7b3a 100644 (file)
@@ -1,3 +1,6 @@
+#
+# ConvertAsm.py: Automatically generated from CopyMem.asm
+#
 #------------------------------------------------------------------------------
 #
 # Copyright (c) 2006, Intel Corporation
 #------------------------------------------------------------------------------
 #
 # Copyright (c) 2006, Intel Corporation
@@ -11,7 +14,7 @@
 #
 # Module Name:
 #
 #
 # Module Name:
 #
-#   CopyMem.asm
+#   CopyMem.S
 #
 # Abstract:
 #
 #
 # Abstract:
 #
 
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-#   OUT     VOID                      *DestinationBuffer,
-#   IN      CONST VOID                *SourceBuffer,
-#   IN      UINTN                     Length
-#   );
+#  VOID *
+#  EFIAPI
+#  InternalMemCopyMem (
+#    IN VOID   *Destination,
+#    IN VOID   *Source,
+#    IN UINTN  Count
+#    )
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-.global _InternalMemCopyMem;
-_InternalMemCopyMem:
-    push    %rsi
-    push    %rdi
-    mov     %rdi, %rsi
-    mov     %rcx, %rdi
-    lea     -1(%r8,%rsi,1),%r9
-    cmp     %rdi, %rsi
-    mov     %rdi, %rax
-    jae     L1
-    cmp     %rdi, %r9
-    jae     LCopyBackward               # Copy backward if overlapped
-L1: 
-    mov     %r8, %rcx
-    and     $7, %r8
-    shr     $3, %rcx
-    jz      LCopyBytes
-    movd    %mm0, %r10                  # (Save mm0 in r10)
-L2: 
-    movd    (%rsi), %mm0
-    movntq  %mm0, (%rdi)
-    add     $8, %rsi
-    add     $8, %rdi
-    loop    L2
-    mfence
-    movd    %r10, %mm0                  #(Restore mm0)
-    jmp     LCopyBytes
-LCopyBackward: 
-    mov     %r9, %rsi
-    lea     -1(%r8,%rdi,1),%rdi
+.intel_syntax noprefix
+.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
+    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
     std                                 # set direction flag
     std                                 # set direction flag
-LCopyBytes: 
-    mov     %r8, %rcx
-    rep
-    movsb                               # Copy bytes backward
+_atSym_CopyBytes:
+    mov     rcx, r8
+    rep     movsb                       # Copy bytes backward
     cld
     cld
-    pop     %rdi
-    pop     %rsi
+    pop     rdi
+    pop     rsi
     ret
     ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S
new file mode 100644 (file)
index 0000000..9a94f5d
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem16.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem16 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem16 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT16                    Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem16)
+ASM_PFX(InternalMemScanMem16):
+    push    rdi
+    mov     rdi, rcx
+    mov     rax, r8
+    mov     rcx, rdx
+    repne   scasw
+    lea     rax, [rdi - 2]
+    cmovnz  rax, rcx
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S
new file mode 100644 (file)
index 0000000..86a6503
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem32.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem32 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem32 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT32                    Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.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
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S
new file mode 100644 (file)
index 0000000..bd1eee7
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem64.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem64 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem64 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT64                    Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem64)
+ASM_PFX(InternalMemScanMem64):
+    push    rdi
+    mov     rdi, rcx
+    mov     rax, r8
+    mov     rcx, rdx
+    repne   scasq
+    lea     rax, [rdi - 8]
+    cmovnz  rax, rcx
+    pop     rdi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S
new file mode 100644 (file)
index 0000000..1d8b4e1
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem8.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem8 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem8 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT8                     Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem8)
+ASM_PFX(InternalMemScanMem8):
+    push    rdi
+    mov     rdi, rcx
+    mov     rcx, rdx
+    mov     rax, r8
+    repne   scasb
+    lea     rax, [rdi - 1]
+    cmovnz  rax, rcx                    # set rax to 0 if not found
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S
new file mode 100644 (file)
index 0000000..87b1a30
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemSetMem (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT8  Value
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem)
+ASM_PFX(InternalMemSetMem):
+    push    rdi
+    mov     rax, r8
+    mov     ah, al
+    movq    mm0, rax
+    mov     r8, rcx
+    mov     rdi, r8                     # rdi <- Buffer
+    mov     rcx, rdx
+    and     edx, 7
+    shr     rcx, 3
+    jz      L_SetBytes
+    pshufw  mm0, mm0, 0x0
+L0:
+    movntq  [rdi], mm0
+    add     rdi, 8
+    loop    L0
+    mfence
+L_SetBytes:
+    mov     ecx, edx
+    rep     stosb
+    mov     rax, r8
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S
new file mode 100644 (file)
index 0000000..834adb1
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem16.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem16 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemSetMem16 (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT16 Value
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem16)
+ASM_PFX(InternalMemSetMem16):
+    push    rdi
+    mov     rax, r8
+    movq    mm0, rax
+    mov     r8, rcx
+    mov     rdi, r8
+    mov     rcx, rdx
+    and     edx, 3
+    shr     rcx, 2
+    jz      L_SetWords
+    pshufw  mm0, mm0, 0x0
+L0:
+    movntq  [rdi], mm0
+    add     rdi, 8
+    loop    L0
+    mfence
+L_SetWords:
+    mov     ecx, edx
+    rep     stosw
+    mov     rax, r8
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S
new file mode 100644 (file)
index 0000000..099e53d
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem32.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem32 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemSetMem32 (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT32 Value
+#    );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem32)
+ASM_PFX(InternalMemSetMem32):
+    movq    mm0, r8                     # mm0 <- Value
+    mov     rax, rcx                    # rax <- Buffer
+    xchg    rcx, rdx                    # rcx <- Count  rdx <- Buffer
+    shr     rcx, 1                      # rcx <- # of qwords to set
+    jz      L_SetDwords
+    pshufw  mm0, mm0, 0x44
+L0:
+    movntq  [rdx], mm0
+    lea     rdx, [rdx + 8]              # use "lea" to avoid flag changes
+    loop    L0
+    mfence
+L_SetDwords:
+    jnc     L1
+    movd    [rdx], mm0
+L1:
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
new file mode 100644 (file)
index 0000000..76dbdf2
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem64.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  InternalMemSetMem64 (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT64 Value
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem64)
+ASM_PFX(InternalMemSetMem64):
+    movq    mm0, r8                     #Value
+    mov     rax, rcx                    #rax <- Buffer
+    xchg    rcx, rdx                    #rcx <- Count
+L0:
+    movntq  [rdx], mm0
+    add     rdx, 8
+    loop    L0
+    mfence
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S
new file mode 100644 (file)
index 0000000..f8d24cc
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# ConvertAsm.py: Automatically generated from ZeroMem.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ZeroMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  InternalMemZeroMem (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count
+#    );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemZeroMem)
+ASM_PFX(InternalMemZeroMem):
+    push    rdi
+    mov     rdi, rcx
+    mov     rcx, rdx
+    mov     r8, rdi
+    and     edx, 7
+    shr     rcx, 3
+    jz      L_ZeroBytes
+    pxor    mm0, mm0
+L0:
+    movntq  [rdi], mm0
+    add     rdi, 8
+    loop    L0
+    mfence
+L_ZeroBytes:
+    xor     eax, eax
+    mov     ecx, edx
+    rep     stosb
+    mov     rax, r8
+    pop     rdi
+    ret
+
index d88db0ff69c62dae241ba6abb473bd6c70e7b753..7841967821beb11207006ae6987cb687fc5e3400 100644 (file)
 \r
 [Sources.common]\r
   MemLibInternals.h\r
 \r
 [Sources.common]\r
   MemLibInternals.h\r
+  ScanMem64Wrapper.c\r
+  ScanMem32Wrapper.c\r
+  ScanMem16Wrapper.c\r
+  ScanMem8Wrapper.c\r
+  ZeroMemWrapper.c\r
+  CompareMemWrapper.c\r
+  SetMem64Wrapper.c\r
+  SetMem32Wrapper.c\r
+  SetMem16Wrapper.c\r
+  SetMemWrapper.c\r
+  CopyMemWrapper.c\r
+  MemLibGuid.c\r
 \r
 [Sources.Ia32]\r
   Ia32/ScanMem64.S\r
 \r
 [Sources.Ia32]\r
   Ia32/ScanMem64.S\r
   Ia32/SetMem16.asm\r
   Ia32/SetMem.asm\r
   Ia32/CopyMem.asm\r
   Ia32/SetMem16.asm\r
   Ia32/SetMem.asm\r
   Ia32/CopyMem.asm\r
-  ScanMem64Wrapper.c\r
-  ScanMem32Wrapper.c\r
-  ScanMem16Wrapper.c\r
-  ScanMem8Wrapper.c\r
-  ZeroMemWrapper.c\r
-  CompareMemWrapper.c\r
-  SetMem64Wrapper.c\r
-  SetMem32Wrapper.c\r
-  SetMem16Wrapper.c\r
-  SetMemWrapper.c\r
-  CopyMemWrapper.c\r
-  MemLibGuid.c\r
 \r
 [Sources.X64]\r
   X64/ScanMem64.S\r
 \r
 [Sources.X64]\r
   X64/ScanMem64.S\r
   X64/SetMem16.asm\r
   X64/SetMem.asm\r
   X64/CopyMem.asm\r
   X64/SetMem16.asm\r
   X64/SetMem.asm\r
   X64/CopyMem.asm\r
-  ScanMem64Wrapper.c\r
-  ScanMem32Wrapper.c\r
-  ScanMem16Wrapper.c\r
-  ScanMem8Wrapper.c\r
-  ZeroMemWrapper.c\r
-  CompareMemWrapper.c\r
-  SetMem64Wrapper.c\r
-  SetMem32Wrapper.c\r
-  SetMem16Wrapper.c\r
-  SetMemWrapper.c\r
-  CopyMemWrapper.c\r
-  MemLibGuid.c\r
-\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
index 46dfe0a23c25887fe0a67fb8c5b1cec50b7da352..5580d6237a64de2997a6068a7ffd640baedd59e0 100644 (file)
@@ -42,9 +42,9 @@
 #   IN      UINTN                     Length
 #   );
 #------------------------------------------------------------------------------
 #   IN      UINTN                     Length
 #   );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemCompareMem
-_InternalMemCompareMem:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemCompareMem)
+ASM_PFX(InternalMemCompareMem):
     push    rsi
     push    rdi
     mov     rsi, rcx
     push    rsi
     push    rdi
     mov     rsi, rcx
index fe67040ff6d57983b6dd3dc8fe751faed7707cda..3e7a396b5b4feec8e31f857b03d526c0cd1b7b3a 100644 (file)
@@ -34,9 +34,9 @@
 #    IN UINTN  Count
 #    )
 #------------------------------------------------------------------------------
 #    IN UINTN  Count
 #    )
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemCopyMem
-_InternalMemCopyMem:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemCopyMem)
+ASM_PFX(InternalMemCopyMem):
     push    rsi
     push    rdi
     mov     rsi, rdx                    # rsi <- Source
     push    rsi
     push    rdi
     mov     rsi, rdx                    # rsi <- Source
index f56b9e96d849be6d9e17b2101c8719ac78d21a32..9a94f5d936d0240a711adf7eb5bd321a59c4b6f4 100644 (file)
@@ -42,9 +42,9 @@
 #   IN      UINT16                    Value
 #   );
 #------------------------------------------------------------------------------
 #   IN      UINT16                    Value
 #   );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemScanMem16
-_InternalMemScanMem16:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem16)
+ASM_PFX(InternalMemScanMem16):
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
index ef9cd758cf67752313e995289e3188a70838ff19..86a6503fb37c00c544a0d597f5921a66115102b1 100644 (file)
@@ -42,9 +42,9 @@
 #   IN      UINT32                    Value
 #   );
 #------------------------------------------------------------------------------
 #   IN      UINT32                    Value
 #   );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemScanMem32
-_InternalMemScanMem32:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem32)
+ASM_PFX(InternalMemScanMem32):
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
index ee2ce39ba1afb36b738abf77c2ae56658e3de039..f05f7b2b2b9c49510afa4c5884ddedda2c626def 100644 (file)
@@ -42,9 +42,9 @@
 #   IN      UINT64                    Value
 #   );
 #------------------------------------------------------------------------------
 #   IN      UINT64                    Value
 #   );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemScanMem64
-_InternalMemScanMem64:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem64)
+ASM_PFX(InternalMemScanMem64):
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
index 4ff3a959c8fd6a5eae5c9077be08866753dec026..1d8b4e1b23c509603cc8c7beb2718d17386e1f9c 100644 (file)
@@ -42,9 +42,9 @@
 #   IN      UINT8                     Value
 #   );
 #------------------------------------------------------------------------------
 #   IN      UINT8                     Value
 #   );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemScanMem8
-_InternalMemScanMem8:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem8)
+ASM_PFX(InternalMemScanMem8):
     push    rdi
     mov     rdi, rcx
     mov     rcx, rdx
     push    rdi
     mov     rdi, rcx
     mov     rcx, rdx
index d9f8b06e0c569dfec1935a54f973853a9b83751f..e252f1a9957dca6ffdae13808146d12ac35ca7d7 100644 (file)
@@ -34,9 +34,9 @@
 #    IN UINT8  Value
 #    )
 #------------------------------------------------------------------------------
 #    IN UINT8  Value
 #    )
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemSetMem
-_InternalMemSetMem:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem)
+ASM_PFX(InternalMemSetMem):
     push    rdi
     mov     rax, r8    # rax = Value
     mov     rdi, rcx   # rdi = Buffer
     push    rdi
     mov     rax, r8    # rax = Value
     mov     rdi, rcx   # rdi = Buffer
index 5f196462c6b06791a361e569eaeff8e5f667d89a..0fb9deeb750dc2b36b7a7755e964d0a294a93c1f 100644 (file)
@@ -34,9 +34,9 @@
 #    IN UINT16 Value
 #    )
 #------------------------------------------------------------------------------
 #    IN UINT16 Value
 #    )
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemSetMem16
-_InternalMemSetMem16:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem16)
+ASM_PFX(InternalMemSetMem16):
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
index 72243ae8c269631354f7efc42c1084ac21e1a1e3..00fec5c96905dcaca4c2354aa3d9d8aca92d737b 100644 (file)
@@ -34,9 +34,9 @@
 #    IN UINT32 Value
 #    );
 #------------------------------------------------------------------------------
 #    IN UINT32 Value
 #    );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemSetMem32
-_InternalMemSetMem32:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem32)
+ASM_PFX(InternalMemSetMem32):
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
index a8a4a0b5a0e9f2930e47a6ca83302042a907ef6d..359cbb1633bf01f10e6bd6930c1bad2e10943de6 100644 (file)
@@ -33,9 +33,9 @@
 #    IN UINT64 Value
 #    )
 #------------------------------------------------------------------------------
 #    IN UINT64 Value
 #    )
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemSetMem64
-_InternalMemSetMem64:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem64)
+ASM_PFX(InternalMemSetMem64):
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
     push    rdi
     mov     rdi, rcx
     mov     rax, r8
index 6233b0632a524d188e606e9863b3f8109a922367..97c3130709dfb27a608d0a1577c0efbe0dc8a2ff 100644 (file)
@@ -32,9 +32,9 @@
 #    IN UINTN  Count
 #    );
 #------------------------------------------------------------------------------
 #    IN UINTN  Count
 #    );
 #------------------------------------------------------------------------------
-.intel_syntax
-.globl _InternalMemZeroMem
-_InternalMemZeroMem:
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemZeroMem)
+ASM_PFX(InternalMemZeroMem):
     push    rdi
     push    rcx
     xor     rax, rax
     push    rdi
     push    rcx
     xor     rax, rax
index 8de0fffc7e9228370a196ac1657765d31123ee03..37171a84c0155ddb26c6b229434f084ca02cbc3b 100644 (file)
 \r
 [Sources.common]\r
   MemLibInternals.h\r
 \r
 [Sources.common]\r
   MemLibInternals.h\r
+  ScanMem64Wrapper.c\r
+  ScanMem32Wrapper.c\r
+  ScanMem16Wrapper.c\r
+  ScanMem8Wrapper.c\r
+  ZeroMemWrapper.c\r
+  CompareMemWrapper.c\r
+  SetMem64Wrapper.c\r
+  SetMem32Wrapper.c\r
+  SetMem16Wrapper.c\r
+  SetMemWrapper.c\r
+  CopyMemWrapper.c\r
+  MemLibGuid.c\r
 \r
 [Sources.Ia32]\r
   Ia32/ScanMem64.S\r
 \r
 [Sources.Ia32]\r
   Ia32/ScanMem64.S\r
   Ia32/SetMem16.asm\r
   Ia32/SetMem.asm\r
   Ia32/CopyMem.asm\r
   Ia32/SetMem16.asm\r
   Ia32/SetMem.asm\r
   Ia32/CopyMem.asm\r
-  ScanMem64Wrapper.c\r
-  ScanMem32Wrapper.c\r
-  ScanMem16Wrapper.c\r
-  ScanMem8Wrapper.c\r
-  ZeroMemWrapper.c\r
-  CompareMemWrapper.c\r
-  SetMem64Wrapper.c\r
-  SetMem32Wrapper.c\r
-  SetMem16Wrapper.c\r
-  SetMemWrapper.c\r
-  CopyMemWrapper.c\r
-  MemLibGuid.c\r
 \r
 [Sources.X64]\r
   X64/ScanMem64.asm\r
 \r
 [Sources.X64]\r
   X64/ScanMem64.asm\r
   X64/SetMem16.asm\r
   X64/SetMem.asm\r
   X64/CopyMem.asm\r
   X64/SetMem16.asm\r
   X64/SetMem.asm\r
   X64/CopyMem.asm\r
-  ScanMem64Wrapper.c\r
-  ScanMem32Wrapper.c\r
-  ScanMem16Wrapper.c\r
-  ScanMem8Wrapper.c\r
-  ZeroMemWrapper.c\r
-  CompareMemWrapper.c\r
-  SetMem64Wrapper.c\r
-  SetMem32Wrapper.c\r
-  SetMem16Wrapper.c\r
-  SetMemWrapper.c\r
-  CopyMemWrapper.c\r
-  MemLibGuid.c\r
+  X64/ScanMem64.S\r
+  X64/ScanMem32.S\r
+  X64/ScanMem16.S\r
+  X64/ScanMem8.S\r
+  X64/CompareMem.S\r
+  X64/ZeroMem.S\r
+  X64/SetMem64.S\r
+  X64/SetMem32.S\r
+  X64/SetMem16.S\r
+  X64/SetMem.S\r
+  X64/CopyMem.S\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S
new file mode 100644 (file)
index 0000000..5580d62
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# ConvertAsm.py: Automatically generated from CompareMem.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   CompareMem function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# INTN
+# EFIAPI
+# InternalMemCompareMem (
+#   IN      CONST VOID                *DestinationBuffer,
+#   IN      CONST VOID                *SourceBuffer,
+#   IN      UINTN                     Length
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemCompareMem)
+ASM_PFX(InternalMemCompareMem):
+    push    rsi
+    push    rdi
+    mov     rsi, rcx
+    mov     rdi, rdx
+    mov     rcx, r8
+    repe    cmpsb
+    movzx   rax, byte ptr [rsi - 1]
+    movzx   rdx, byte ptr [rdi - 1]
+    sub     rax, rdx
+    pop     rdi
+    pop     rsi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S
new file mode 100644 (file)
index 0000000..dc47510
--- /dev/null
@@ -0,0 +1,84 @@
+#
+# ConvertAsm.py: Automatically generated from CopyMem.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   CopyMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemCopyMem (
+#    IN VOID   *Destination,
+#    IN VOID   *Source,
+#    IN UINTN  Count
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.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 <- Last byte of Source
+    cmp     rsi, rdi                    
+    mov     rax, rdi                    # rax <- Destination as return value
+    jae     _InternalMemCopyMem_al_0000 # Copy forward if Source > Destination
+    cmp     r9, rdi                     # Overlapped?
+    jae     _atSym_CopyBackward         # Copy backward if overlapped
+_InternalMemCopyMem_al_0000:            
+    xor     rcx, rcx                    
+    sub     rcx, rdi                    # rcx <- -rdi
+    and     rcx, 15                     # rcx + rsi should be 16 bytes aligned
+    jz      _InternalMemCopyMem_al_0001 # skip if rcx == 0
+    cmp     rcx, r8
+    cmova   rcx, r8
+    sub     r8, rcx
+    rep     movsb
+_InternalMemCopyMem_al_0001:
+    mov     rcx, r8
+    and     r8, 15
+    shr     rcx, 4                      # rcx <- # of DQwords to copy
+    jz      _atSym_CopyBytes
+    movdqa  [rsp + 0x18], xmm0           # save xmm0 on stack
+_InternalMemCopyMem_al_0002:
+    movdqu  xmm0, [rsi]                 # rsi may not be 16-byte aligned
+    movntdq [rdi], xmm0                 # rdi should be 16-byte aligned
+    add     rsi, 16
+    add     rdi, 16
+    loop    _InternalMemCopyMem_al_0002
+    mfence
+    movdqa  xmm0, [rsp + 0x18]           # restore xmm0
+    jmp     _atSym_CopyBytes            # copy remaining bytes
+_atSym_CopyBackward:
+    mov     rsi, r9                     # rsi <- Last byte of Source
+    lea     rdi, [rdi + r8 - 1]         # rdi <- Last byte of Destination
+    std
+_atSym_CopyBytes:
+    mov     rcx, r8
+    rep     movsb
+    cld
+    pop     rdi
+    pop     rsi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S
new file mode 100644 (file)
index 0000000..9a94f5d
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem16.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem16 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem16 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT16                    Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem16)
+ASM_PFX(InternalMemScanMem16):
+    push    rdi
+    mov     rdi, rcx
+    mov     rax, r8
+    mov     rcx, rdx
+    repne   scasw
+    lea     rax, [rdi - 2]
+    cmovnz  rax, rcx
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S
new file mode 100644 (file)
index 0000000..86a6503
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem32.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem32 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem32 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT32                    Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.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
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S
new file mode 100644 (file)
index 0000000..f05f7b2
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem64.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem64 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem64 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT64                    Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem64)
+ASM_PFX(InternalMemScanMem64):
+    push    rdi
+    mov     rdi, rcx
+    mov     rax, r8
+    mov     rcx, rdx
+    repne   scasq
+    lea     rax, [rdi - 8]
+    cmovnz  rax, rcx
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S
new file mode 100644 (file)
index 0000000..1d8b4e1
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# ConvertAsm.py: Automatically generated from ScanMem8.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ScanMem8 function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances contain the same copy of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#       BaseMemoryLibOptDxe
+#       BaseMemoryLibOptPei
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem8 (
+#   IN      CONST VOID                *Buffer,
+#   IN      UINTN                     Length,
+#   IN      UINT8                     Value
+#   );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemScanMem8)
+ASM_PFX(InternalMemScanMem8):
+    push    rdi
+    mov     rdi, rcx
+    mov     rcx, rdx
+    mov     rax, r8
+    repne   scasb
+    lea     rax, [rdi - 1]
+    cmovnz  rax, rcx                    # set rax to 0 if not found
+    pop     rdi
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
new file mode 100644 (file)
index 0000000..50f6d19
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemSetMem (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT8  Value
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem)
+ASM_PFX(InternalMemSetMem):
+    push    rdi
+    mov     rdi, rcx                    # rdi <- Buffer
+    mov     al, r8b                     # al <- Value
+    mov     r9, rdi                     # r9 <- Buffer as return value
+    xor     rcx, rcx
+    sub     rcx, rdi
+    and     rcx, 15                     # rcx + rdi aligns on 16-byte boundary
+    jz      L0
+    cmp     rcx, rdx
+    cmova   rcx, rdx
+    sub     rdx, rcx
+    rep     stosb
+L0:
+    mov     rcx, rdx
+    and     rdx, 15
+    shr     rcx, 4
+    jz      _SetBytes_L2
+    mov     ah, al                      # ax <- Value repeats twice
+    movdqa  [rsp + 0x10], xmm0           # save xmm0
+    movd    xmm0, eax                   # xmm0[0..16] <- Value repeats twice
+    pshuflw xmm0, xmm0, 0               # xmm0[0..63] <- Value repeats 8 times
+    movlhps xmm0, xmm0                  # xmm0 <- Value repeats 16 times
+L1:
+    movntdq [rdi], xmm0                 # rdi should be 16-byte aligned
+    add     rdi, 16
+    loop    L1
+    mfence
+    movdqa  xmm0, [rsp + 0x10]           # restore xmm0
+_SetBytes_L2:
+    mov     ecx, edx                    # high 32 bits of rcx are always zero
+    rep     stosb
+    mov     rax, r9                     # rax <- Return value
+    pop     rdi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S
new file mode 100644 (file)
index 0000000..5678fcd
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem16.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem16 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemSetMem16 (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT16 Value
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem16)
+ASM_PFX(InternalMemSetMem16):
+    push    rdi
+    mov     rdi, rcx
+    mov     r9, rdi
+    xor     rcx, rcx
+    sub     rcx, rdi
+    and     rcx, 15
+    mov     rax, r8
+    jz      L0
+    shr     rcx, 1
+    cmp     rcx, rdx
+    cmova   rcx, rdx
+    sub     rdx, rcx
+    rep     stosw
+L0:
+    mov     rcx, rdx
+    and     edx, 7
+    shr     rcx, 3
+    jz      _SetWords_L2
+    movd    xmm0, eax
+    pshuflw xmm0, xmm0, 0
+    movlhps xmm0, xmm0
+L1:
+    movntdq [rdi], xmm0
+    add     rdi, 16
+    loop    L1
+    mfence
+_SetWords_L2:
+    mov     ecx, edx
+    rep     stosw
+    mov     rax, r9
+    pop     rdi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S
new file mode 100644 (file)
index 0000000..06ffe76
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem32.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem32 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  EFIAPI
+#  InternalMemSetMem32 (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT32 Value
+#    );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem32)
+ASM_PFX(InternalMemSetMem32):
+    push    rdi
+    mov     rdi, rcx
+    mov     r9, rdi
+    xor     rcx, rcx
+    sub     rcx, rdi
+    and     rcx, 15
+    mov     rax, r8
+    jz      L0
+    shr     rcx, 2
+    cmp     rcx, rdx
+    cmova   rcx, rdx
+    sub     rdx, rcx
+    rep     stosd
+L0:
+    mov     rcx, rdx
+    and     edx, 3
+    shr     rcx, 2
+    jz      _SetDwords_L2
+    movd    xmm0, eax
+    pshufd  xmm0, xmm0, 0
+L1:
+    movntdq [rdi], xmm0
+    add     rdi, 16
+    loop    L1
+    mfence
+_SetDwords_L2:
+    mov     ecx, edx
+    rep     stosd
+    mov     rax, r9
+    pop     rdi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S
new file mode 100644 (file)
index 0000000..e0aa176
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# ConvertAsm.py: Automatically generated from SetMem64.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   SetMem64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  InternalMemSetMem64 (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count,
+#    IN UINT64 Value
+#    )
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemSetMem64)
+ASM_PFX(InternalMemSetMem64):
+    mov     rax, rcx                    # rax <- Buffer
+    xchg    rcx, rdx                    # rcx <- Count & rdx <- Buffer
+    test    dl, 8
+    movq    xmm0, r8
+    jz      L0
+    mov     [rdx], r8
+    add     rdx, 8
+    dec     rcx
+L0:
+    shr     rcx, 1
+    jz      _SetQwords_L2
+    movlhps xmm0, xmm0
+L1:
+    movntdq [rdx], xmm0
+    lea     rdx, [rdx + 16]
+    loop    L1
+    mfence
+_SetQwords_L2:
+    jnc     L2
+    mov     [rdx], r8
+L2:
+    ret
+
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S
new file mode 100644 (file)
index 0000000..2712579
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# ConvertAsm.py: Automatically generated from ZeroMem.asm
+#
+#------------------------------------------------------------------------------
+#
+# 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.S
+#
+# Abstract:
+#
+#   ZeroMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+#  VOID *
+#  InternalMemZeroMem (
+#    IN VOID   *Buffer,
+#    IN UINTN  Count
+#    );
+#------------------------------------------------------------------------------
+.intel_syntax noprefix
+.globl ASM_PFX(InternalMemZeroMem)
+ASM_PFX(InternalMemZeroMem):
+    push    rdi
+    mov     rdi, rcx
+    xor     rcx, rcx
+    xor     eax, eax
+    sub     rcx, rdi
+    and     rcx, 15
+    mov     r8, rdi
+    jz      L0
+    cmp     rcx, rdx
+    cmova   rcx, rdx
+    sub     rdx, rcx
+    rep     stosb
+L0:
+    mov     rcx, rdx
+    and     edx, 15
+    shr     rcx, 4
+    jz      _ZeroBytes_L2
+    pxor    xmm0, xmm0
+L1:
+    movntdq [rdi], xmm0                 # rdi should be 16-byte aligned
+    add     rdi, 16
+    loop    L1
+    mfence
+_ZeroBytes_L2:
+    mov     ecx, edx
+    rep     stosb
+    mov     rax, r8
+    pop     rdi
+    ret