]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Import BaseMemoryLibMmx.
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Jul 2007 09:54:31 +0000 (09:54 +0000)
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Jul 2007 09:54:31 +0000 (09:54 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3407 6f19259b-4bc3-4df7-8a09-765794883524

51 files changed:
MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.msa [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.asm [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c [new file with mode: 0644]
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
new file mode 100644 (file)
index 0000000..bc2840c
--- /dev/null
@@ -0,0 +1,89 @@
+#/** @file\r
+# Component description file for MMX Base Memory Library\r
+#\r
+# Base Memory Library that uses MMX registers for high performance.\r
+#  Optimized for use in DXE.\r
+# Copyright (c) 2006, Intel Corporation\r
+#\r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BaseMemoryLibMmx\r
+  FILE_GUID                      = d458a654-f64c-49db-b8d1-3821306bf1f6\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = BaseMemoryLib \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64\r
+#\r
+\r
+[Sources.common]\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
+  MemLibInternals.h\r
+\r
+[Sources.Ia32]\r
+  Ia32/ScanMem64.S\r
+  Ia32/ScanMem32.S\r
+  Ia32/ScanMem16.S\r
+  Ia32/ScanMem8.S\r
+  Ia32/CompareMem.S\r
+  Ia32/SetMem64.S\r
+  Ia32/SetMem32.S\r
+  Ia32/SetMem16.S\r
+  Ia32/ZeroMem.S\r
+  Ia32/SetMem.S\r
+  Ia32/CopyMem.S\r
+  Ia32/ScanMem64.asm\r
+  Ia32/ScanMem32.asm\r
+  Ia32/ScanMem16.asm\r
+  Ia32/ScanMem8.asm\r
+  Ia32/CompareMem.asm\r
+  Ia32/SetMem64.asm\r
+  Ia32/SetMem32.asm\r
+  Ia32/SetMem16.asm\r
+  Ia32/ZeroMem.asm\r
+  Ia32/SetMem.asm\r
+  Ia32/CopyMem.asm\r
+\r
+[Sources.X64]\r
+  X64/ZeroMem.asm\r
+  X64/ScanMem64.asm\r
+  X64/ScanMem32.asm\r
+  X64/ScanMem16.asm\r
+  X64/ScanMem8.asm\r
+  X64/CompareMem.asm\r
+  X64/SetMem64.asm\r
+  X64/SetMem32.asm\r
+  X64/SetMem16.asm\r
+  X64/SetMem.asm\r
+  X64/CopyMem.asm\r
+\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
+  BaseLib\r
+\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.msa b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.msa
new file mode 100644 (file)
index 0000000..8b071c9
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+  <MsaHeader>\r
+    <ModuleName>BaseMemoryLibMmx</ModuleName>\r
+    <ModuleType>BASE</ModuleType>\r
+    <GuidValue>d458a654-f64c-49db-b8d1-3821306bf1f6</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for MMX Base Memory Library</Abstract>\r
+    <Description>Base Memory Library that uses MMX registers for high performance.
+      Optimized for use in DXE.</Description>\r
+    <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>\r
+    <License>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.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32 X64</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>BaseMemoryLibMmx</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>MemLibInternals.h</Filename>\r
+    <Filename>MemLibGuid.c</Filename>\r
+    <Filename>CopyMemWrapper.c</Filename>\r
+    <Filename>SetMemWrapper.c</Filename>\r
+    <Filename>SetMem16Wrapper.c</Filename>\r
+    <Filename>SetMem32Wrapper.c</Filename>\r
+    <Filename>SetMem64Wrapper.c</Filename>\r
+    <Filename>CompareMemWrapper.c</Filename>\r
+    <Filename>ZeroMemWrapper.c</Filename>\r
+    <Filename>ScanMem8Wrapper.c</Filename>\r
+    <Filename>ScanMem16Wrapper.c</Filename>\r
+    <Filename>ScanMem32Wrapper.c</Filename>\r
+    <Filename>ScanMem64Wrapper.c</Filename>\r
+    <Filename SupArchList="IA32">Ia32/CopyMem.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ZeroMem.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem16.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem32.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem64.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/CompareMem.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem8.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem16.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem32.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem64.asm</Filename>\r
+    <Filename SupArchList="IA32">Ia32/CopyMem.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ZeroMem.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem16.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem32.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/SetMem64.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/CompareMem.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem8.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem16.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem32.S</Filename>\r
+    <Filename SupArchList="IA32">Ia32/ScanMem64.S</Filename>\r
+    <Filename SupArchList="X64">X64/CopyMem.asm</Filename>\r
+    <Filename SupArchList="X64">X64/SetMem.asm</Filename>\r
+    <Filename SupArchList="X64">X64/SetMem16.asm</Filename>\r
+    <Filename SupArchList="X64">X64/SetMem32.asm</Filename>\r
+    <Filename SupArchList="X64">X64/SetMem64.asm</Filename>\r
+    <Filename SupArchList="X64">X64/CompareMem.asm</Filename>\r
+    <Filename SupArchList="X64">X64/ScanMem8.asm</Filename>\r
+    <Filename SupArchList="X64">X64/ScanMem16.asm</Filename>\r
+    <Filename SupArchList="X64">X64/ScanMem32.asm</Filename>\r
+    <Filename SupArchList="X64">X64/ScanMem64.asm</Filename>\r
+    <Filename SupArchList="X64">X64/ZeroMem.asm</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+  </PackageDependencies>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c
new file mode 100644 (file)
index 0000000..4c0d3ea
--- /dev/null
@@ -0,0 +1,67 @@
+/** @file\r
+  CompareMem() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  CompareMemWrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Compares the contents of two buffers.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.\r
+  If all Length bytes of the two buffers are identical, then 0 is returned.  Otherwise, the\r
+  value returned is the first mismatched byte in SourceBuffer subtracted from the first\r
+  mismatched byte in DestinationBuffer.\r
+  If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). \r
+\r
+\r
+  @param  DestinationBuffer Pointer to the destination buffer to compare.\r
+  @param  SourceBuffer      Pointer to the source buffer to compare.\r
+  @param  Length            Number of bytes to compare.\r
+\r
+  @return 0                 All Length bytes of the two buffers are identical.\r
+  @retval Non-zero          The first mismatched byte in SourceBuffer subtracted from the first\r
+                            mismatched byte in DestinationBuffer.\r
+\r
+**/\r
+INTN\r
+EFIAPI\r
+CompareMem (\r
+  IN CONST VOID  *DestinationBuffer,\r
+  IN CONST VOID  *SourceBuffer,\r
+  IN UINTN       Length\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return 0;\r
+  }\r
+  ASSERT (DestinationBuffer != NULL);\r
+  ASSERT (SourceBuffer != NULL);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
+\r
+  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c
new file mode 100644 (file)
index 0000000..9e620e2
--- /dev/null
@@ -0,0 +1,62 @@
+/** @file\r
+  CopyMem() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  CopyMemWrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copies a source buffer to a destination buffer, and returns the destination buffer.\r
+\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns\r
+  DestinationBuffer.  The implementation must be reentrant, and it must handle the case\r
+  where SourceBuffer overlaps DestinationBuffer.\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). \r
+\r
+  @param  DestinationBuffer   Pointer to the destination buffer of the memory copy.\r
+  @param  SourceBuffer        Pointer to the source buffer of the memory copy.\r
+  @param  Length              Number of bytes to copy from SourceBuffer to DestinationBuffer.\r
+\r
+  @return DestinationBuffer.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+CopyMem (\r
+  OUT VOID       *DestinationBuffer,\r
+  IN CONST VOID  *SourceBuffer,\r
+  IN UINTN       Length\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return DestinationBuffer;\r
+  }\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
+\r
+  if (DestinationBuffer == SourceBuffer) {\r
+    return DestinationBuffer;\r
+  }\r
+  return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
new file mode 100644 (file)
index 0000000..e3ba611
--- /dev/null
@@ -0,0 +1,53 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   CompareMem.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   CompareMem function\r
+#\r
+# Notes:\r
+#\r
+#   The following BaseMemoryLib instances share the same version of this file:\r
+#\r
+#       BaseMemoryLibRepStr\r
+#       BaseMemoryLibMmx\r
+#       BaseMemoryLibSse2\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemCompareMem\r
+\r
+#------------------------------------------------------------------------------\r
+# INTN\r
+# EFIAPI\r
+# InternalMemCompareMem (\r
+#   IN      CONST VOID                *DestinationBuffer,\r
+#   IN      CONST VOID                *SourceBuffer,\r
+#   IN      UINTN                     Length\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMemCompareMem:\r
+    push    %esi\r
+    push    %edi\r
+    movl    12(%esp), %esi\r
+    movl    16(%esp), %edi\r
+    movl    20(%esp), %ecx\r
+    repe    cmpsb\r
+    movzbl  -1(%esi), %eax\r
+    movzbl  -1(%edi), %edx\r
+    subl    %edx, %eax\r
+    pop     %edi\r
+    pop     %esi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.asm
new file mode 100644 (file)
index 0000000..1d0e7fa
--- /dev/null
@@ -0,0 +1,54 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   CompareMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CompareMem function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; INTN\r
+; EFIAPI\r
+; InternalMemCompareMem (\r
+;   IN      CONST VOID                *DestinationBuffer,\r
+;   IN      CONST VOID                *SourceBuffer,\r
+;   IN      UINTN                     Length\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemCompareMem   PROC    USES    esi edi\r
+    mov     esi, [esp + 12]\r
+    mov     edi, [esp + 16]\r
+    mov     ecx, [esp + 20]\r
+    repe    cmpsb\r
+    movzx   eax, byte ptr [esi - 1]\r
+    movzx   edx, byte ptr [edi - 1]\r
+    sub     eax, edx\r
+    ret\r
+InternalMemCompareMem   ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
new file mode 100644 (file)
index 0000000..71d3d20
--- /dev/null
@@ -0,0 +1,86 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   CopyMem.asm\r
+#\r
+# Abstract:\r
+#\r
+#   CopyMem function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemCopyMem\r
+\r
+#------------------------------------------------------------------------------\r
+#  VOID *\r
+#  EFIAPI\r
+#  InternalMemCopyMem (\r
+#    IN VOID   *Destination,\r
+#    IN VOID   *Source,\r
+#    IN UINTN  Count\r
+#    );\r
+#------------------------------------------------------------------------------\r
+_InternalMemCopyMem:\r
+    push    %esi\r
+    push    %edi\r
+    movl    16(%esp), %esi              # esi <- Source\r
+    movl    12(%esp), %edi              # edi <- Destination\r
+    movl    20(%esp), %edx              # edx <- Count\r
+    leal    -1(%esi,%edx,), %eax        # eax <- End of Source\r
+    cmpl    %edi, %esi\r
+    jae     L0\r
+    cmpl    %edi, %eax                  # Overlapped?\r
+    jae     L_CopyBackward              # Copy backward if overlapped\r
+L0:\r
+    xorl    %ecx, %ecx\r
+    subl    %esi, %ecx\r
+    andl    $7, %ecx                    # ecx + esi aligns on 8-byte boundary\r
+    jz      L1\r
+    cmpl    %edx, %ecx\r
+    cmova   %edx, %ecx\r
+    subl    %ecx, %edx                  # edx <- remaining bytes to copy\r
+    rep\r
+    movsb\r
+L1:\r
+    movl    %edx, %ecx\r
+    andl    $7, %edx\r
+    shrl    $3, %ecx                    # ecx <- # of Qwords to copy\r
+    jz      L_CopyBytes\r
+    pushl   %eax\r
+    pushl   %eax\r
+    movq    %mm0, (%esp)                # save mm0\r
+L2:\r
+    movq    (%esi), %mm0\r
+    movq    %mm0, (%edi)\r
+    addl    $8, %esi\r
+    addl    $8, %edi\r
+    loop    L2\r
+    movq    (%esp), %mm0                # restore mm0\r
+    popl    %ecx                        # stack cleanup\r
+    popl    %ecx                        # stack cleanup\r
+    jmp     L_CopyBytes\r
+L_CopyBackward:\r
+    movl    %eax, %esi                  # esi <- Last byte in Source\r
+    leal    -1(%edi,%edx,), %edi        # edi <- Last byte in Destination\r
+    std\r
+L_CopyBytes:\r
+    movl    %edx, %ecx\r
+    rep\r
+    movsb\r
+    cld\r
+    movl    12(%esp), %eax\r
+    pop     %edi\r
+    pop     %esi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.asm
new file mode 100644 (file)
index 0000000..1b8b3c5
--- /dev/null
@@ -0,0 +1,77 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   CopyMem.asm\r
+;\r
+; Abstract:\r
+;\r
+;   CopyMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .mmx\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  EFIAPI\r
+;  InternalMemCopyMem (\r
+;    IN VOID   *Destination,\r
+;    IN VOID   *Source,\r
+;    IN UINTN  Count\r
+;    );\r
+;------------------------------------------------------------------------------\r
+InternalMemCopyMem  PROC    USES    esi edi\r
+    mov     esi, [esp + 16]             ; esi <- Source\r
+    mov     edi, [esp + 12]             ; edi <- Destination\r
+    mov     edx, [esp + 20]             ; edx <- Count\r
+    lea     eax, [esi + edx - 1]        ; eax <- End of Source\r
+    cmp     esi, edi\r
+    jae     @F\r
+    cmp     eax, edi                    ; Overlapped?\r
+    jae     @CopyBackward               ; Copy backward if overlapped\r
+@@:\r
+    mov     ecx, edx\r
+    and     edx, 7\r
+    shr     ecx, 3                      ; ecx <- # of Qwords to copy\r
+    jz      @CopyBytes\r
+    push    eax\r
+    push    eax\r
+    movq    [esp], mm0                  ; save mm0\r
+@@:\r
+    movq    mm0, [esi]\r
+    movq    [edi], mm0\r
+    add     esi, 8\r
+    add     edi, 8\r
+    loop    @B\r
+    movq    mm0, [esp]                  ; restore mm0\r
+    pop     ecx                         ; stack cleanup\r
+    pop     ecx                         ; stack cleanup\r
+    jmp     @CopyBytes\r
+@CopyBackward:\r
+    mov     esi, eax                    ; esi <- Last byte in Source\r
+    lea     edi, [edi + edx - 1]        ; edi <- Last byte in Destination\r
+    std\r
+@CopyBytes:\r
+    mov     ecx, edx\r
+    rep     movsb\r
+    cld\r
+    mov     eax, [esp + 12]\r
+    ret\r
+InternalMemCopyMem  ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S
new file mode 100644 (file)
index 0000000..a9ac4a1
--- /dev/null
@@ -0,0 +1,50 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   ScanMem16.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   ScanMem16 function\r
+#\r
+# Notes:\r
+#\r
+#   The following BaseMemoryLib instances share the same version of this file:\r
+#\r
+#       BaseMemoryLibRepStr\r
+#       BaseMemoryLibMmx\r
+#       BaseMemoryLibSse2\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemScanMem16\r
+\r
+#------------------------------------------------------------------------------\r
+# CONST VOID *\r
+# EFIAPI\r
+# InternalMemScanMem16 (\r
+#   IN      CONST VOID                *Buffer,\r
+#   IN      UINTN                     Length,\r
+#   IN      UINT16                    Value\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMemScanMem16:\r
+    push    %edi\r
+    movl    12(%esp), %ecx\r
+    movl    8(%esp), %edi\r
+    movl    16(%esp), %eax\r
+    repne   scasw\r
+    leal    -2(%edi), %eax\r
+    cmovnz  %ecx, %eax\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.asm
new file mode 100644 (file)
index 0000000..57fab61
--- /dev/null
@@ -0,0 +1,53 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem16.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem16 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem16 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT16                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem16    PROC    USES    edi\r
+    mov     ecx, [esp + 12]\r
+    mov     edi, [esp + 8]\r
+    mov     eax, [esp + 16]\r
+    repne   scasw\r
+    lea     eax, [edi - 2]\r
+    cmovnz  eax, ecx\r
+    ret\r
+InternalMemScanMem16    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S
new file mode 100644 (file)
index 0000000..be50f94
--- /dev/null
@@ -0,0 +1,50 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   ScanMem32.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   ScanMem32 function\r
+#\r
+# Notes:\r
+#\r
+#   The following BaseMemoryLib instances share the same version of this file:\r
+#\r
+#       BaseMemoryLibRepStr\r
+#       BaseMemoryLibMmx\r
+#       BaseMemoryLibSse2\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemScanMem32\r
+\r
+#------------------------------------------------------------------------------\r
+# CONST VOID *\r
+# EFIAPI\r
+# InternalMemScanMem32 (\r
+#   IN      CONST VOID                *Buffer,\r
+#   IN      UINTN                     Length,\r
+#   IN      UINT32                    Value\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMemScanMem32:\r
+    push    %edi\r
+    movl    12(%esp), %ecx\r
+    movl    8(%esp), %edi\r
+    movl    16(%esp), %eax\r
+    repne   scasl\r
+    leal    -4(%edi), %eax\r
+    cmovnz  %ecx, %eax\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.asm
new file mode 100644 (file)
index 0000000..6ac857c
--- /dev/null
@@ -0,0 +1,53 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem32.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem32 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem32 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT32                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem32    PROC    USES    edi\r
+    mov     ecx, [esp + 12]\r
+    mov     edi, [esp + 8]\r
+    mov     eax, [esp + 16]\r
+    repne   scasd\r
+    lea     eax, [edi - 4]\r
+    cmovnz  eax, ecx\r
+    ret\r
+InternalMemScanMem32    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S
new file mode 100644 (file)
index 0000000..b40f022
--- /dev/null
@@ -0,0 +1,59 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   ScanMem64.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   ScanMem64 function\r
+#\r
+# Notes:\r
+#\r
+#   The following BaseMemoryLib instances share the same version of this file:\r
+#\r
+#       BaseMemoryLibRepStr\r
+#       BaseMemoryLibMmx\r
+#       BaseMemoryLibSse2\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemScanMem64\r
+\r
+#------------------------------------------------------------------------------\r
+# CONST VOID *\r
+# EFIAPI\r
+# InternalMemScanMem64 (\r
+#   IN      CONST VOID                *Buffer,\r
+#   IN      UINTN                     Length,\r
+#   IN      UINT64                    Value\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMemScanMem64:\r
+    push    %edi\r
+    movl    12(%esp), %ecx\r
+    movl    16(%esp), %eax\r
+    movl    20(%esp), %edx\r
+    movl    8(%esp), %edi\r
+L0:\r
+    cmpl    (%edi), %eax\r
+    leal    8(%edi), %edi\r
+    loopne  L0\r
+    jne     L1\r
+    cmpl    -4(%edi), %edx\r
+    jecxz   L1\r
+    jne     L0\r
+L1:\r
+    leal    -8(%edi), %eax\r
+    cmovne  %ecx, %eax\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.asm
new file mode 100644 (file)
index 0000000..ca54f13
--- /dev/null
@@ -0,0 +1,62 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem64.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem64 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem64 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT64                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem64    PROC    USES    edi\r
+    mov     ecx, [esp + 12]\r
+    mov     eax, [esp + 16]\r
+    mov     edx, [esp + 20]\r
+    mov     edi, [esp + 8]\r
+@@:\r
+    cmp     eax, [edi]\r
+    lea     edi, [edi + 8]\r
+    loopne  @B\r
+    jne     @F\r
+    cmp     edx, [edi - 4]\r
+    jecxz   @F\r
+    jne     @B\r
+@@:\r
+    lea     eax, [edi - 8]\r
+    cmovne  eax, ecx\r
+    ret\r
+InternalMemScanMem64    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S
new file mode 100644 (file)
index 0000000..02298b9
--- /dev/null
@@ -0,0 +1,50 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   ScanMem8.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   ScanMem8 function\r
+#\r
+# Notes:\r
+#\r
+#   The following BaseMemoryLib instances share the same version of this file:\r
+#\r
+#       BaseMemoryLibRepStr\r
+#       BaseMemoryLibMmx\r
+#       BaseMemoryLibSse2\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemScanMem8\r
+\r
+#------------------------------------------------------------------------------\r
+# CONST VOID *\r
+# EFIAPI\r
+# InternalMemScanMem8 (\r
+#   IN      CONST VOID                *Buffer,\r
+#   IN      UINTN                     Length,\r
+#   IN      UINT8                     Value\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMemScanMem8:\r
+    push    %edi\r
+    movl    12(%esp), %ecx\r
+    movl    8(%esp), %edi\r
+    movb    16(%esp), %al\r
+    repne   scasb\r
+    leal    -1(%edi), %eax\r
+    cmovnz  %ecx, %eax\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.asm
new file mode 100644 (file)
index 0000000..a3f65b6
--- /dev/null
@@ -0,0 +1,53 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem8.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem8 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem8 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT8                     Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem8 PROC    USES    edi\r
+    mov     ecx, [esp + 12]\r
+    mov     edi, [esp + 8]\r
+    mov     al, [esp + 16]\r
+    repne   scasb\r
+    lea     eax, [edi - 1]\r
+    cmovnz  eax, ecx\r
+    ret\r
+InternalMemScanMem8 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
new file mode 100644 (file)
index 0000000..5606d27
--- /dev/null
@@ -0,0 +1,66 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   SetMem.asm\r
+#\r
+# Abstract:\r
+#\r
+#   SetMem function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemSetMem\r
+\r
+#------------------------------------------------------------------------------\r
+#  VOID *\r
+#  InternalMemSetMem (\r
+#    IN VOID   *Buffer,\r
+#    IN UINTN  Count,\r
+#    IN UINT8  Value\r
+#    )\r
+#------------------------------------------------------------------------------\r
+_InternalMemSetMem:\r
+    push    %edi\r
+    movb    16(%esp), %al\r
+    movb    %al, %ah\r
+    shrdl   $16, %eax, %edx\r
+    shldl   $16, %edx, %eax\r
+    movl    12(%esp), %ecx              # ecx <- Count\r
+    movl    8(%esp), %edi               # edi <- Buffer\r
+    movl    %ecx, %edx\r
+    andl    $7, %edx\r
+    shrl    $3, %ecx                    # # of Qwords to set\r
+    jz      L1\r
+    addl    $0x-10, %esp\r
+    movq    %mm0, (%esp)                # save mm0\r
+    movq    %mm1, 8(%esp)               # save mm1\r
+    movd    %eax, %mm0\r
+    movd    %eax, %mm1\r
+    psllq   $32, %mm0\r
+    por     %mm1, %mm0                  # fill mm0 with 8 Value's\r
+L0:\r
+    movq    %mm0, (%edi)\r
+    addl    $8, %edi\r
+    loopl   L0\r
+    movq    (%esp), %mm0                # restore mm0\r
+    movq    8(%esp), %mm1               # restore mm1\r
+    addl    $0x10, %esp                 # stack cleanup\r
+L1:\r
+    movl    %edx, %ecx\r
+    rep\r
+    stosb\r
+    movl    8(%esp), %eax               # eax <- Buffer as return value\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm
new file mode 100644 (file)
index 0000000..c9c48ec
--- /dev/null
@@ -0,0 +1,70 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .mmx\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  EFIAPI\r
+;  InternalMemSetMem (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT8  Value\r
+;    )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem   PROC    USES    edi\r
+    mov     al, [esp + 16]\r
+    mov     ah, al\r
+    shrd    edx, eax, 16\r
+    shld    eax, edx, 16\r
+    mov     ecx, [esp + 12]             ; ecx <- Count\r
+    mov     edi, [esp + 8]              ; edi <- Buffer\r
+    mov     edx, ecx\r
+    and     edx, 7\r
+    shr     ecx, 3                      ; # of Qwords to set\r
+    jz      @SetBytes\r
+    add     esp, -10h\r
+    movq    [esp], mm0                  ; save mm0\r
+    movq    [esp + 8], mm1              ; save mm1\r
+    movd    mm0, eax\r
+    movd    mm1, eax\r
+    psllq   mm0, 32\r
+    por     mm0, mm1                    ; fill mm0 with 8 Value's\r
+@@:\r
+    movq    [edi], mm0\r
+    add     edi, 8\r
+    loop    @B\r
+    movq    mm0, [esp]                  ; restore mm0\r
+    movq    mm1, [esp + 8]              ; restore mm1\r
+    add     esp, 10h                    ; stack cleanup\r
+@SetBytes:\r
+    mov     ecx, edx\r
+    rep     stosb\r
+    mov     eax, [esp + 8]              ; eax <- Buffer as return value\r
+    ret\r
+InternalMemSetMem   ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
new file mode 100644 (file)
index 0000000..e0a787a
--- /dev/null
@@ -0,0 +1,59 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   SetMem16.asm\r
+#\r
+# Abstract:\r
+#\r
+#   SetMem16 function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemSetMem16\r
+\r
+#------------------------------------------------------------------------------\r
+#  VOID *\r
+#  InternalMemSetMem16 (\r
+#    IN VOID   *Buffer,\r
+#    IN UINTN  Count,\r
+#    IN UINT16 Value\r
+#    )\r
+#------------------------------------------------------------------------------\r
+_InternalMemSetMem16:\r
+    push    %edi\r
+    movl    16(%esp), %eax\r
+    shrdl   $16, %eax, %edx\r
+    shldl   $16, %edx, %eax\r
+    movl    12(%esp), %edx\r
+    movl    8(%esp), %edi\r
+    movl    %edx, %ecx\r
+    andl    $3, %edx\r
+    shrl    $2, %ecx\r
+    jz      L1\r
+    movd    %eax, %mm0\r
+    movd    %eax, %mm1\r
+    psllq   $32, %mm0\r
+    por     %mm1, %mm0\r
+L0:\r
+    movq    %mm0, (%edi)\r
+    addl    $8, %edi\r
+    loopl   L0\r
+L1:\r
+    movl    %edx, %ecx\r
+    rep\r
+    stosw\r
+    movl    8(%esp), %eax\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.asm
new file mode 100644 (file)
index 0000000..e934226
--- /dev/null
@@ -0,0 +1,63 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem16.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem16 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .mmx\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  EFIAPI\r
+;  InternalMemSetMem16 (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT16 Value\r
+;    )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem16 PROC    USES    edi\r
+    mov     eax, [esp + 16]\r
+    shrd    edx, eax, 16\r
+    shld    eax, edx, 16\r
+    mov     edx, [esp + 12]\r
+    mov     edi, [esp + 8]\r
+    mov     ecx, edx\r
+    and     edx, 3\r
+    shr     ecx, 2\r
+    jz      @SetWords\r
+    movd    mm0, eax\r
+    movd    mm1, eax\r
+    psllq   mm0, 32\r
+    por     mm0, mm1\r
+@@:\r
+    movq    [edi], mm0\r
+    add     edi, 8\r
+    loop    @B\r
+@SetWords:\r
+    mov     ecx, edx\r
+    rep     stosw\r
+    mov     eax, [esp + 8]\r
+    ret\r
+InternalMemSetMem16 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
new file mode 100644 (file)
index 0000000..22b5065
--- /dev/null
@@ -0,0 +1,52 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   SetMem32.asm\r
+#\r
+# Abstract:\r
+#\r
+#   SetMem32 function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemSetMem32\r
+\r
+#------------------------------------------------------------------------------\r
+#  VOID *\r
+#  InternalMemSetMem32 (\r
+#    IN VOID   *Buffer,\r
+#    IN UINTN  Count,\r
+#    IN UINT32 Value\r
+#    )\r
+#------------------------------------------------------------------------------\r
+_InternalMemSetMem32:\r
+    movl    4(%esp), %eax\r
+    movl    8(%esp), %ecx\r
+    movd    12(%esp), %mm0\r
+    shrl    %ecx\r
+    movl    %eax, %edx\r
+    jz      L1\r
+    movq    %mm0, %mm1\r
+    psllq   $32, %mm1\r
+    por     %mm1, %mm0\r
+L0:\r
+    movq    %mm0, (%edx)\r
+    lea     8(%edx), %edx\r
+    loopl   L0\r
+L1:\r
+    jnc     L2\r
+    movd    %mm0, (%edx)\r
+L2:\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.asm
new file mode 100644 (file)
index 0000000..c2e4869
--- /dev/null
@@ -0,0 +1,59 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem32.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem32 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .mmx\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  EFIAPI\r
+;  InternalMemSetMem32 (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT32 Value\r
+;    );\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem32 PROC\r
+    mov     eax, [esp + 4]              ; eax <- Buffer as return value\r
+    mov     ecx, [esp + 8]              ; ecx <- Count\r
+    movd    mm0, [esp + 12]             ; mm0 <- Value\r
+    shr     ecx, 1                      ; ecx <- number of qwords to set\r
+    mov     edx, eax                    ; edx <- Buffer\r
+    jz      @SetDwords\r
+    movq    mm1, mm0\r
+    psllq   mm1, 32\r
+    por     mm0, mm1\r
+@@:\r
+    movq    [edx], mm0\r
+    lea     edx, [edx + 8]              ; use "lea" to avoid change in flags\r
+    loop    @B\r
+@SetDwords:\r
+    jnc     @F\r
+    movd    [edx], mm0\r
+@@:\r
+    ret\r
+InternalMemSetMem32 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
new file mode 100644 (file)
index 0000000..efd24ae
--- /dev/null
@@ -0,0 +1,43 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   SetMem64.asm\r
+#\r
+# Abstract:\r
+#\r
+#   SetMem64 function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemSetMem64\r
+\r
+#------------------------------------------------------------------------------\r
+#  VOID *\r
+#  InternalMemSetMem64 (\r
+#    IN VOID   *Buffer,\r
+#    IN UINTN  Count,\r
+#    IN UINT64 Value\r
+#    )\r
+#------------------------------------------------------------------------------\r
+_InternalMemSetMem64:\r
+    movl    4(%esp), %eax\r
+    movl    8(%esp), %ecx\r
+    movq    12(%esp), %mm0\r
+    movl    %eax, %edx\r
+L0:\r
+    movq    %mm0, (%edx)\r
+    lea     8(%edx), %edx\r
+    loopl   L0\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.asm
new file mode 100644 (file)
index 0000000..027483b
--- /dev/null
@@ -0,0 +1,50 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem64.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .mmx\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  EFIAPI\r
+;  InternalMemSetMem64 (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT64 Value\r
+;    )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem64 PROC\r
+    mov     eax, [esp + 4]\r
+    mov     ecx, [esp + 8]\r
+    movq    mm0, [esp + 12]\r
+    mov     edx, eax\r
+@@:\r
+    movq    [edx], mm0\r
+    add     edx, 8\r
+    loop    @B\r
+    ret\r
+InternalMemSetMem64 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S
new file mode 100644 (file)
index 0000000..999beba
--- /dev/null
@@ -0,0 +1,54 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   ZeroMem.asm\r
+#\r
+# Abstract:\r
+#\r
+#   ZeroMem function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl _InternalMemZeroMem\r
+\r
+#------------------------------------------------------------------------------\r
+#  VOID *\r
+#  EFIAPI\r
+#  InternalMemZeroMem (\r
+#    IN VOID   *Buffer,\r
+#    IN UINTN  Count\r
+#    );\r
+#------------------------------------------------------------------------------\r
+_InternalMemZeroMem:\r
+    push    %edi\r
+    movl    8(%esp), %edi\r
+    movl    12(%esp), %ecx\r
+    movl    %ecx, %edx\r
+    shrl    $3, %ecx\r
+    jz      L_ZeroBytes\r
+    pxor    %mm0, %mm0\r
+L0:\r
+    movq    %mm0, (%edi)\r
+    addl    $8, %edi\r
+    loop    L0\r
+L_ZeroBytes:\r
+    andl    $7, %edx\r
+    xorl    %eax, %eax\r
+    movl    %edx, %ecx\r
+    rep\r
+    stosb\r
+    movl    8(%esp), %eax\r
+    pop     %edi\r
+    ret\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.asm
new file mode 100644 (file)
index 0000000..a75480b
--- /dev/null
@@ -0,0 +1,56 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ZeroMem.asm\r
+;\r
+; Abstract:\r
+;\r
+;   ZeroMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .mmx\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  InternalMemZeroMem (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count\r
+;    );\r
+;------------------------------------------------------------------------------\r
+InternalMemZeroMem  PROC    USES    edi\r
+    mov     edi, [esp + 8]\r
+    mov     ecx, [esp + 12]\r
+    mov     edx, ecx\r
+    shr     ecx, 3\r
+    jz      @ZeroBytes\r
+    pxor    mm0, mm0\r
+@@:\r
+    movq    [edi], mm0\r
+    add     edi, 8\r
+    loop    @B\r
+@ZeroBytes:\r
+    and     edx, 7\r
+    xor     eax, eax\r
+    mov     ecx, edx\r
+    rep     stosb\r
+    mov     eax, [esp + 8]\r
+    ret\r
+InternalMemZeroMem  ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
new file mode 100644 (file)
index 0000000..15e5294
--- /dev/null
@@ -0,0 +1,139 @@
+/** @file\r
+  Implementation of GUID functions.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  MemLibGuid.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copies a source GUID to a destination GUID.\r
+\r
+  This function copies the contents of the 128-bit GUID specified by SourceGuid to\r
+  DestinationGuid, and returns DestinationGuid.\r
+  If DestinationGuid is NULL, then ASSERT().\r
+  If SourceGuid is NULL, then ASSERT().\r
+\r
+  @param  DestinationGuid   Pointer to the destination GUID.\r
+  @param  SourceGuid        Pointer to the source GUID.\r
+\r
+  @return DestinationGuid.\r
+\r
+**/\r
+GUID *\r
+EFIAPI\r
+CopyGuid (\r
+  OUT GUID       *DestinationGuid,\r
+  IN CONST GUID  *SourceGuid\r
+  )\r
+{\r
+  WriteUnaligned64 (\r
+    (UINT64*)DestinationGuid,\r
+    ReadUnaligned64 ((CONST UINT64*)SourceGuid)\r
+    );\r
+  WriteUnaligned64 (\r
+    (UINT64*)DestinationGuid + 1,\r
+    ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)\r
+    );\r
+  return DestinationGuid;\r
+}\r
+\r
+/**\r
+  Compares two GUIDs.\r
+\r
+  This function compares Guid1 to Guid2.  If the GUIDs are identical then TRUE is returned.\r
+  If there are any bit differences in the two GUIDs, then FALSE is returned.\r
+  If Guid1 is NULL, then ASSERT().\r
+  If Guid2 is NULL, then ASSERT().\r
+\r
+  @param  Guid1       A pointer to a 128 bit GUID.\r
+  @param  Guid2       A pointer to a 128 bit GUID.\r
+\r
+  @retval TRUE        Guid1 and Guid2 are identical.\r
+  @retval FALSE       Guid1 and Guid2 are not identical.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CompareGuid (\r
+  IN CONST GUID  *Guid1,\r
+  IN CONST GUID  *Guid2\r
+  )\r
+{\r
+  UINT64  LowPartOfGuid1;\r
+  UINT64  LowPartOfGuid2;\r
+  UINT64  HighPartOfGuid1;\r
+  UINT64  HighPartOfGuid2;\r
+\r
+  LowPartOfGuid1  = ReadUnaligned64 ((CONST UINT64*) Guid1);\r
+  LowPartOfGuid2  = ReadUnaligned64 ((CONST UINT64*) Guid2);\r
+  HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);\r
+  HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);\r
+\r
+  return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);\r
+}\r
+\r
+/**\r
+  Scans a target buffer for a GUID, and returns a pointer to the matching GUID\r
+  in the target buffer.\r
+\r
+  This function searches target the buffer specified by Buffer and Length from\r
+  the lowest address to the highest address at 128-bit increments for the 128-bit\r
+  GUID value that matches Guid.  If a match is found, then a pointer to the matching\r
+  GUID in the target buffer is returned.  If no match is found, then NULL is returned.\r
+  If Length is 0, then NULL is returned.\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 128-bit boundary, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  Buffer  Pointer to the target buffer to scan.\r
+  @param  Length  Number of bytes in Buffer to scan.\r
+  @param  Guid    Value to search for in the target buffer.\r
+\r
+  @return A pointer to the matching Guid in the target buffer or NULL otherwise.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanGuid (\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN CONST GUID  *Guid\r
+  )\r
+{\r
+  CONST GUID                        *GuidPtr;\r
+\r
+  ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);\r
+  ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));\r
+  ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);\r
+\r
+  GuidPtr = (GUID*)Buffer;\r
+  Buffer  = GuidPtr + Length / sizeof (*GuidPtr);\r
+  while (GuidPtr < (CONST GUID*)Buffer) {\r
+    if (CompareGuid (GuidPtr, Guid)) {\r
+      return (VOID*)GuidPtr;\r
+    }\r
+    GuidPtr++;\r
+  }\r
+  return NULL;\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h
new file mode 100644 (file)
index 0000000..da7c737
--- /dev/null
@@ -0,0 +1,234 @@
+/** @file\r
+  Declaration of internal functions for Base Memory Library.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  MemLibInternals.h\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\r
+\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+/**\r
+  Copy Length bytes from Source to Destination.\r
+\r
+  @param  Destination Target of copy\r
+  @param  Source Place to copy from\r
+  @param  Length Number of bytes to copy\r
+\r
+  @return Destination\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalMemCopyMem (\r
+  OUT     VOID                      *DestinationBuffer,\r
+  IN      CONST VOID                *SourceBuffer,\r
+  IN      UINTN                     Length\r
+  );\r
+\r
+/**\r
+  Set Buffer to Value for Size bytes.\r
+\r
+  @param  Buffer Memory to set.\r
+  @param  Size Number of bytes to set\r
+  @param  Value Value of the set operation.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalMemSetMem (\r
+  OUT     VOID                      *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  );\r
+\r
+/**\r
+  Fills a target buffer with a 16-bit value, and returns the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to fill.\r
+  @param  Length  Number of bytes in Buffer to fill.\r
+  @param  Value   Value with which to fill Length bytes of Buffer.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalMemSetMem16 (\r
+  OUT     VOID                      *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  );\r
+\r
+/**\r
+  Fills a target buffer with a 32-bit value, and returns the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to fill.\r
+  @param  Length  Number of bytes in Buffer to fill.\r
+  @param  Value   Value with which to fill Length bytes of Buffer.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalMemSetMem32 (\r
+  OUT     VOID                      *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  );\r
+\r
+/**\r
+  Fills a target buffer with a 64-bit value, and returns the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to fill.\r
+  @param  Length  Number of bytes in Buffer to fill.\r
+  @param  Value   Value with which to fill Length bytes of Buffer.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalMemSetMem64 (\r
+  OUT     VOID                      *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  );\r
+\r
+/**\r
+  Set Buffer to 0 for Size bytes.\r
+\r
+  @param  Buffer Memory to set.\r
+  @param  Size Number of bytes to set\r
+\r
+  @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalMemZeroMem (\r
+  OUT     VOID                      *Buffer,\r
+  IN      UINTN                     Length\r
+  );\r
+\r
+/**\r
+  Compares two memory buffers of a given length.\r
+\r
+  @param  DestinationBuffer First memory buffer\r
+  @param  SourceBuffer      Second memory buffer\r
+  @param  Length            Length of DestinationBuffer and SourceBuffer memory\r
+                            regions to compare. Must be non-zero.\r
+\r
+  @retval 0     if MemOne == MemTwo\r
+\r
+**/\r
+INTN\r
+EFIAPI\r
+InternalMemCompareMem (\r
+  IN      CONST VOID                *DestinationBuffer,\r
+  IN      CONST VOID                *SourceBuffer,\r
+  IN      UINTN                     Length\r
+  );\r
+\r
+/**\r
+  Scans a target buffer for an 8-bit value, and returns a pointer to the\r
+  matching 8-bit value in the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to scan.\r
+  @param  Length  Number of bytes in Buffer to scan. Must be non-zero.\r
+  @param  Value   Value to search for in the target buffer.\r
+\r
+  @return Pointer to the first occurrence or NULL if not found.\r
+\r
+**/\r
+CONST VOID *\r
+EFIAPI\r
+InternalMemScanMem8 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  );\r
+\r
+/**\r
+  Scans a target buffer for a 16-bit value, and returns a pointer to the\r
+  matching 16-bit value in the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to scan.\r
+  @param  Length  Number of bytes in Buffer to scan. Must be non-zero.\r
+  @param  Value   Value to search for in the target buffer.\r
+\r
+  @return Pointer to the first occurrence or NULL if not found.\r
+\r
+**/\r
+CONST VOID *\r
+EFIAPI\r
+InternalMemScanMem16 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  );\r
+\r
+/**\r
+  Scans a target buffer for a 32-bit value, and returns a pointer to the\r
+  matching 32-bit value in the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to scan.\r
+  @param  Length  Number of bytes in Buffer to scan. Must be non-zero.\r
+  @param  Value   Value to search for in the target buffer.\r
+\r
+  @return Pointer to the first occurrence or NULL if not found.\r
+\r
+**/\r
+CONST VOID *\r
+EFIAPI\r
+InternalMemScanMem32 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  );\r
+\r
+/**\r
+  Scans a target buffer for a 64-bit value, and returns a pointer to the\r
+  matching 64-bit value in the target buffer.\r
+\r
+  @param  Buffer  Pointer to the target buffer to scan.\r
+  @param  Length  Number of bytes in Buffer to scan. Must be non-zero.\r
+  @param  Value   Value to search for in the target buffer.\r
+\r
+  @return Pointer to the first occurrence or NULL if not found.\r
+\r
+**/\r
+CONST VOID *\r
+EFIAPI\r
+InternalMemScanMem64 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  );\r
+\r
+#endif\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c
new file mode 100644 (file)
index 0000000..95f134b
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  ScanMem16() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  ScanMem16Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value\r
+  in the target buffer.\r
+\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a 16-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 16-bit boundary, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  Buffer      Pointer to the target buffer to scan.\r
+  @param  Length      Number of bytes in Buffer to scan.\r
+  @param  Value       Value to search for in the target buffer.\r
+\r
+  @return A pointer to the matching byte in the target buffer or NULL otherwise.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem16 (\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT16      Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return NULL;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+  ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
+\r
+  return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c
new file mode 100644 (file)
index 0000000..6a3dcd7
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  ScanMem32() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  ScanMem32Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value\r
+  in the target buffer.\r
+\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a 32-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  Buffer      Pointer to the target buffer to scan.\r
+  @param  Length      Number of bytes in Buffer to scan.\r
+  @param  Value       Value to search for in the target buffer.\r
+\r
+  @return A pointer to the matching byte in the target buffer or NULL otherwise.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem32 (\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT32      Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return NULL;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+  ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
+\r
+  return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c
new file mode 100644 (file)
index 0000000..b355fe6
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  ScanMem64() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  ScanMem64Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value\r
+  in the target buffer.\r
+\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a 64-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 64-bit boundary, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  Buffer      Pointer to the target buffer to scan.\r
+  @param  Length      Number of bytes in Buffer to scan.\r
+  @param  Value       Value to search for in the target buffer.\r
+\r
+  @return A pointer to the matching byte in the target buffer or NULL otherwise.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem64 (\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT64      Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return NULL;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+  ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
+\r
+  return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c
new file mode 100644 (file)
index 0000000..2b21b22
--- /dev/null
@@ -0,0 +1,61 @@
+/** @file\r
+  ScanMem8() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  ScanMem8Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value\r
+  in the target buffer.\r
+\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for an 8-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  Buffer      Pointer to the target buffer to scan.\r
+  @param  Length      Number of bytes in Buffer to scan.\r
+  @param  Value       Value to search for in the target buffer.\r
+\r
+  @return A pointer to the matching byte in the target buffer or NULL otherwise.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem8 (\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT8       Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return NULL;\r
+  }\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
\r
+  return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c
new file mode 100644 (file)
index 0000000..889339c
--- /dev/null
@@ -0,0 +1,65 @@
+/** @file\r
+  SetMem16() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  SetMem16Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Fills a target buffer with a 16-bit value, and returns the target buffer.\r
+\r
+  This function fills Length bytes of Buffer with the 16-bit value specified by\r
+  Value, and returns Buffer. Value is repeated every 16-bits in for Length\r
+  bytes of Buffer.\r
+\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+  If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Buffer  Pointer to the target buffer to fill.\r
+  @param  Length  Number of bytes in Buffer to fill.\r
+  @param  Value   Value with which to fill Length bytes of Buffer.\r
+\r
+  @return Buffer.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+SetMem16 (\r
+  OUT VOID   *Buffer,\r
+  IN UINTN   Length,\r
+  IN UINT16  Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return Buffer;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+  ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);\r
+  ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
+\r
+  return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c
new file mode 100644 (file)
index 0000000..15f8205
--- /dev/null
@@ -0,0 +1,65 @@
+/** @file\r
+  SetMem32() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  SetMem32Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Fills a target buffer with a 32-bit value, and returns the target buffer.\r
+\r
+  This function fills Length bytes of Buffer with the 32-bit value specified by\r
+  Value, and returns Buffer. Value is repeated every 32-bits in for Length\r
+  bytes of Buffer.\r
+\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+  If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param  Buffer  Pointer to the target buffer to fill.\r
+  @param  Length  Number of bytes in Buffer to fill.\r
+  @param  Value   Value with which to fill Length bytes of Buffer.\r
+\r
+  @return Buffer.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+SetMem32 (\r
+  OUT VOID   *Buffer,\r
+  IN UINTN   Length,\r
+  IN UINT32  Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return Buffer;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+  ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);\r
+  ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
+\r
+  return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c
new file mode 100644 (file)
index 0000000..981a7d4
--- /dev/null
@@ -0,0 +1,65 @@
+/** @file\r
+  SetMem64() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  SetMem64Wrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Fills a target buffer with a 64-bit value, and returns the target buffer.\r
+\r
+  This function fills Length bytes of Buffer with the 64-bit value specified by\r
+  Value, and returns Buffer. Value is repeated every 64-bits in for Length\r
+  bytes of Buffer.\r
+\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+  If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Buffer  Pointer to the target buffer to fill.\r
+  @param  Length  Number of bytes in Buffer to fill.\r
+  @param  Value   Value with which to fill Length bytes of Buffer.\r
+\r
+  @return Buffer.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+SetMem64 (\r
+  OUT VOID   *Buffer,\r
+  IN UINTN   Length,\r
+  IN UINT64  Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return Buffer;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+  ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);\r
+  ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
+\r
+  return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c
new file mode 100644 (file)
index 0000000..e74ce8d
--- /dev/null
@@ -0,0 +1,56 @@
+/** @file\r
+  SetMem() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  SetMemWrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Fills a target buffer with a byte value, and returns the target buffer.\r
+\r
+  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  Buffer    Memory to set.\r
+  @param  Length    Number of bytes to set.\r
+  @param  Value     Value of the set operation.\r
+\r
+  @return Buffer.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+SetMem (\r
+  OUT VOID  *Buffer,\r
+  IN UINTN  Length,\r
+  IN UINT8  Value\r
+  )\r
+{\r
+  if (Length == 0) {\r
+    return Buffer;\r
+  }\r
+\r
+  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
+\r
+  return InternalMemSetMem (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
new file mode 100644 (file)
index 0000000..fb1dcce
--- /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:
+#
+#   CompareMem.Asm
+#
+# Abstract:
+#
+#   CompareMem function
+#
+# Notes:
+#
+#   The following BaseMemoryLib instances share the same version of this file:
+#
+#       BaseMemoryLibRepStr
+#       BaseMemoryLibMmx
+#       BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+# INTN
+# EFIAPI
+# InternalMemCompareMem (
+#   IN      CONST VOID                *DestinationBuffer,
+#   IN      CONST VOID                *SourceBuffer,
+#   IN      UINTN                     Length
+#   );
+#------------------------------------------------------------------------------
+.global _InternalMemCompareMem;
+_InternalMemCompareMem:
+    push    %rsi
+    push    %rdi
+    mov     %rcx, %rsi
+    mov     %rdx, %rdi
+    mov     %r8, %rcx
+    repe    cmpsb
+    movzbq  -1(%rsi), %rax
+    movzbq  -1(%rdi), %rdx
+    sub     %rdx, %rax
+    pop     %rdi
+    pop     %rsi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.asm
new file mode 100644 (file)
index 0000000..554bc07
--- /dev/null
@@ -0,0 +1,52 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   CompareMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CompareMem function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; INTN\r
+; EFIAPI\r
+; InternalMemCompareMem (\r
+;   IN      CONST VOID                *DestinationBuffer,\r
+;   IN      CONST VOID                *SourceBuffer,\r
+;   IN      UINTN                     Length\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemCompareMem   PROC    USES    rsi rdi\r
+    mov     rsi, rcx\r
+    mov     rdi, rdx\r
+    mov     rcx, r8\r
+    repe    cmpsb\r
+    movzx   rax, byte ptr [rsi - 1]\r
+    movzx   rdx, byte ptr [rdi - 1]\r
+    sub     rax, rdx\r
+    ret\r
+InternalMemCompareMem   ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
new file mode 100644 (file)
index 0000000..c4ecdc7
--- /dev/null
@@ -0,0 +1,72 @@
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI
+# InternalMemCopyMem (
+#   OUT     VOID                      *DestinationBuffer,
+#   IN      CONST VOID                *SourceBuffer,
+#   IN      UINTN                     Length
+#   );
+#------------------------------------------------------------------------------
+.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
+    std                                 # set direction flag
+LCopyBytes: 
+    mov     %r8, %rcx
+    rep
+    movsb                               # Copy bytes backward
+    cld
+    pop     %rdi
+    pop     %rsi
+    ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.asm
new file mode 100644 (file)
index 0000000..b57192e
--- /dev/null
@@ -0,0 +1,70 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   CopyMem.asm\r
+;\r
+; Abstract:\r
+;\r
+;   CopyMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemCopyMem (\r
+;   OUT     VOID                      *DestinationBuffer,\r
+;   IN      CONST VOID                *SourceBuffer,\r
+;   IN      UINTN                     Length\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemCopyMem  PROC    USES    rsi rdi\r
+    mov     rsi, rdx                    ; rsi <- Source\r
+    mov     rdi, rcx                    ; rdi <- Destination\r
+    lea     r9, [rsi + r8 - 1]          ; r9 <- End of Source\r
+    cmp     rsi, rdi\r
+    mov     rax, rdi                    ; rax <- Destination as return value\r
+    jae     @F\r
+    cmp     r9, rdi\r
+    jae     @CopyBackward               ; Copy backward if overlapped\r
+@@:\r
+    mov     rcx, r8\r
+    and     r8, 7\r
+    shr     rcx, 3                      ; rcx <- # of Qwords to copy\r
+    jz      @CopyBytes\r
+    DB      49h, 0fh, 7eh, 0c2h         ; movd r10, mm0 (Save mm0 in r10)\r
+@@:\r
+    DB      0fh, 6fh, 06h               ; movd mm0, [rsi]\r
+    DB      0fh, 0e7h, 07h              ; movntq [rdi], mm0\r
+    add     rsi, 8\r
+    add     rdi, 8\r
+    loop    @B\r
+    mfence\r
+    DB      49h, 0fh, 6eh, 0c2h         ; movd mm0, r10 (Restore mm0)\r
+    jmp     @CopyBytes\r
+@CopyBackward:\r
+    mov     rsi, r9                     ; rsi <- End of Source\r
+    lea     rdi, [rdi + r8 - 1]         ; rdi <- End of Destination\r
+    std                                 ; set direction flag\r
+@CopyBytes:\r
+    mov     rcx, r8\r
+    rep     movsb                       ; Copy bytes backward\r
+    cld\r
+    ret\r
+InternalMemCopyMem  ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.asm
new file mode 100644 (file)
index 0000000..a2538c2
--- /dev/null
@@ -0,0 +1,51 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem16.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem16 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem16 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT16                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem16    PROC    USES    rdi\r
+    mov     rdi, rcx\r
+    mov     rax, r8\r
+    mov     rcx, rdx\r
+    repne   scasw\r
+    lea     rax, [rdi - 2]\r
+    cmovnz  rax, rcx\r
+    ret\r
+InternalMemScanMem16    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.asm
new file mode 100644 (file)
index 0000000..e0523d8
--- /dev/null
@@ -0,0 +1,51 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem32.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem32 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem32 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT32                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem32    PROC    USES    rdi\r
+    mov     rdi, rcx\r
+    mov     rax, r8\r
+    mov     rcx, rdx\r
+    repne   scasd\r
+    lea     rax, [rdi - 4]\r
+    cmovnz  rax, rcx\r
+    ret\r
+InternalMemScanMem32    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.asm
new file mode 100644 (file)
index 0000000..0e7e9c7
--- /dev/null
@@ -0,0 +1,51 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem64.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem64 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem64 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT64                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem64    PROC    USES    rdi\r
+    mov     rdi, rcx\r
+    mov     rax, r8\r
+    mov     rcx, rdx\r
+    repne   scasq\r
+    lea     rax, [rdi - 8]\r
+    cmovnz  rax, rcx\r
+    ret\r
+InternalMemScanMem64    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.asm
new file mode 100644 (file)
index 0000000..879273f
--- /dev/null
@@ -0,0 +1,51 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ScanMem8.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   ScanMem8 function\r
+;\r
+; Notes:\r
+;\r
+;   The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+;       BaseMemoryLibRepStr\r
+;       BaseMemoryLibMmx\r
+;       BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem8 (\r
+;   IN      CONST VOID                *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT8                     Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem8 PROC    USES    rdi\r
+    mov     rdi, rcx\r
+    mov     rcx, rdx\r
+    mov     rax, r8\r
+    repne   scasb\r
+    lea     rax, [rdi - 1]\r
+    cmovnz  rax, rcx                    ; set rax to 0 if not found\r
+    ret\r
+InternalMemScanMem8 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.asm
new file mode 100644 (file)
index 0000000..923beef
--- /dev/null
@@ -0,0 +1,58 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemSetMem (\r
+;   OUT     VOID                      *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT8                     Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem   PROC    USES    rdi\r
+    mov     rax, r8\r
+    mov     ah, al\r
+    DB      48h, 0fh, 6eh, 0c0h         ; movd mm0, rax\r
+    mov     r8, rcx\r
+    mov     rdi, r8                     ; rdi <- Buffer\r
+    mov     rcx, rdx\r
+    and     edx, 7\r
+    shr     rcx, 3\r
+    jz      @SetBytes\r
+    DB      0fh, 70h, 0C0h, 00h         ; pshufw mm0, mm0, 0h\r
+@@:\r
+    DB      0fh, 0e7h, 07h              ; movntq [rdi], mm0\r
+    add     rdi, 8\r
+    loop    @B\r
+    mfence\r
+@SetBytes:\r
+    mov     ecx, edx\r
+    rep     stosb\r
+    mov     rax, r8\r
+    ret\r
+InternalMemSetMem   ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.asm
new file mode 100644 (file)
index 0000000..01b72c5
--- /dev/null
@@ -0,0 +1,57 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem16.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem16 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemSetMem16 (\r
+;   OUT     VOID                      *Buffer,\r
+;   IN      UINTN                     Length,\r
+;   IN      UINT16                    Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem16 PROC    USES    rdi\r
+    mov     rax, r8\r
+    DB      48h, 0fh, 6eh, 0c0h         ; movd mm0, rax\r
+    mov     r8, rcx\r
+    mov     rdi, r8\r
+    mov     rcx, rdx\r
+    and     edx, 3\r
+    shr     rcx, 2\r
+    jz      @SetWords\r
+    DB      0fh, 70h, 0C0h, 00h         ; pshufw mm0, mm0, 0h\r
+@@:\r
+    DB      0fh, 0e7h, 07h              ; movntq [rdi], mm0\r
+    add     rdi, 8\r
+    loop    @B\r
+    mfence\r
+@SetWords:\r
+    mov     ecx, edx\r
+    rep     stosw\r
+    mov     rax, r8\r
+    ret\r
+InternalMemSetMem16 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm
new file mode 100644 (file)
index 0000000..89cf175
--- /dev/null
@@ -0,0 +1,53 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem32.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem32 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  InternalMemSetMem32 (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT32 Value\r
+;    )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem32 PROC\r
+    DB      49h, 0fh, 6eh, 0c0h         ; movd mm0, r8 (Value)\r
+    mov     rax, rcx                    ; rax <- Buffer\r
+    xchg    rcx, rdx                    ; rcx <- Count  rdx <- Buffer\r
+    shr     rcx, 1                      ; rcx <- # of qwords to set\r
+    jz      @SetDwords\r
+    DB      0fh, 70h, 0C0h, 44h         ; pshufw mm0, mm0, 44h\r
+@@:\r
+    DB      0fh, 0e7h, 02h              ; movntq [rdx], mm0\r
+    lea     rdx, [rdx + 8]              ; use "lea" to avoid flag changes\r
+    loop    @B\r
+    mfence\r
+@SetDwords:\r
+    jnc     @F\r
+    DB      0fh, 7eh, 02h               ; movd [rdx], mm0\r
+@@:\r
+    ret\r
+InternalMemSetMem32 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.asm
new file mode 100644 (file)
index 0000000..454d623
--- /dev/null
@@ -0,0 +1,46 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetMem64.asm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  InternalMemSetMem64 (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT64 Value\r
+;    )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem64 PROC\r
+    DB      49h, 0fh, 6eh, 0c0h         ; movd mm0, r8 (Value)\r
+    mov     rax, rcx                    ; rax <- Buffer\r
+    xchg    rcx, rdx                    ; rcx <- Count\r
+@@:\r
+    DB      0fh, 0e7h, 02h              ; movntq  [rdx], mm0\r
+    add     rdx, 8\r
+    loop    @B\r
+    mfence\r
+    ret\r
+InternalMemSetMem64 ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.asm
new file mode 100644 (file)
index 0000000..e9035a3
--- /dev/null
@@ -0,0 +1,54 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   ZeroMem.asm\r
+;\r
+; Abstract:\r
+;\r
+;   ZeroMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  InternalMemZeroMem (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count\r
+;    );\r
+;------------------------------------------------------------------------------\r
+InternalMemZeroMem  PROC    USES    rdi\r
+    mov     rdi, rcx\r
+    mov     rcx, rdx\r
+    mov     r8, rdi\r
+    and     edx, 7\r
+    shr     rcx, 3\r
+    jz      @ZeroBytes\r
+    DB      0fh, 0efh, 0c0h             ; pxor mm0, mm0\r
+@@:\r
+    DB      0fh, 0e7h, 7                ; movntq [rdi], mm0\r
+    add     rdi, 8\r
+    loop    @B\r
+    DB      0fh, 0aeh, 0f0h             ; mfence\r
+@ZeroBytes:\r
+    xor     eax, eax\r
+    mov     ecx, edx\r
+    rep     stosb\r
+    mov     rax, r8\r
+    ret\r
+InternalMemZeroMem  ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c
new file mode 100644 (file)
index 0000000..90e607c
--- /dev/null
@@ -0,0 +1,51 @@
+/** @file\r
+  ZeroMem() implementation.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  ZeroMemWrapper.c\r
+\r
+  The following BaseMemoryLib instances share the same version of this file:\r
+\r
+    BaseMemoryLib\r
+    BaseMemoryLibMmx\r
+    BaseMemoryLibSse2\r
+    BaseMemoryLibRepStr\r
+    PeiMemoryLib\r
+    DxeMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Fills a target buffer with zeros, and returns the target buffer.\r
+\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+\r
+  @param  Buffer      Pointer to the target buffer to fill with zeros.\r
+  @param  Length      Number of bytes in Buffer to fill with zeros.\r
+\r
+  @return Buffer.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ZeroMem (\r
+  OUT VOID  *Buffer,\r
+  IN UINTN  Length\r
+  )\r
+{\r
+  ASSERT (!(Buffer == NULL && Length > 0));\r
+  ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));\r
+  return InternalMemZeroMem (Buffer, Length);\r
+}\r
index 36403d2ab71102ae34ab0c8e8a86b38b67cd723e..50cc89a1e6d509802c04aa98a2114bc384a67437 100644 (file)
 [Components.IA32]\r
   $(WORKSPACE)/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf\r
   $(WORKSPACE)/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
+  $(WORKSPACE)/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf\r
   $(WORKSPACE)/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
   $(WORKSPACE)/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
   $(WORKSPACE)/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf\r
 [Components.X64]\r
   $(WORKSPACE)/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf\r
   $(WORKSPACE)/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
+  $(WORKSPACE)/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf\r
   $(WORKSPACE)/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
   $(WORKSPACE)/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
   $(WORKSPACE)/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf\r