]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Split wrapper functions into separate source files to reduce image code size
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 May 2006 03:26:32 +0000 (03:26 +0000)
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 May 2006 03:26:32 +0000 (03:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@168 6f19259b-4bc3-4df7-8a09-765794883524

86 files changed:
MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c
MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
MdePkg/Library/BaseMemoryLib/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/BaseMemoryLib/MemLibWrappers.h [deleted file]
MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c
MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c
MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c
MdePkg/Library/BaseMemoryLib/SetMemWrapper.c
MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.msa
MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibMmx/MemLibWrapper.c [deleted file]
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/ZeroMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.msa
MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/MemLibWrapper.c [deleted file]
MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.msa
MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/MemLibWrapper.c [deleted file]
MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c [new file with mode: 0644]
MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
MdePkg/Library/PeiMemoryLib/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/MemLibWrapper.c [deleted file]
MdePkg/Library/PeiMemoryLib/PeiMemoryLib.msa
MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/SetMemWrapper.c [new file with mode: 0644]
MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
MdePkg/Library/UefiMemoryLib/MemLibInternals.h [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/MemLibWrapper.c [deleted file]
MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/SetMemWrapper.c [new file with mode: 0644]
MdePkg/Library/UefiMemoryLib/UefiMemoryLib.msa
MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c [new file with mode: 0644]

index 4b2e1ac4b442a3bdcb085c9dde8e4f1ee5c11bb6..c8199d8dc31cb2badd25ee641ade2fb443fddf91 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Compares two memory buffers of a given length.\r
index 155877fdde2b9b55665382eba605959e3785e662..5ca62f50478428426398688c405bb399231eaa7b 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Copy Length bytes from Source to Destination.\r
@@ -51,8 +51,14 @@ CopyMem (
   IN      UINTN                     Length\r
   )\r
 {\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
+  ASSERT (\r
+    Destination == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Destination + 1\r
+    );\r
+  ASSERT (\r
+    Source == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Source + 1\r
+    );\r
   if (Destination == Source || Length == 0) {\r
     return Destination;\r
   }\r
index ef9f358a7950b5eef35877b349b822d3dd5355bf..bda1f4992f7945ffa063a3578651339e25a22711 100644 (file)
 \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
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Fills a target buffer with a 16-bit value, and returns the target buffer.\r
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibInternals.h b/MdePkg/Library/BaseMemoryLib/MemLibInternals.h
new file mode 100644 (file)
index 0000000..ca7311a
--- /dev/null
@@ -0,0 +1,230 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\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/BaseMemoryLib/MemLibWrappers.h b/MdePkg/Library/BaseMemoryLib/MemLibWrappers.h
deleted file mode 100644 (file)
index 927d593..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/** @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:  MemLibWrappers.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
-    UefiMemoryLib\r
-\r
-**/\r
-\r
-#ifndef __MEM_LIB_WRAPPERS__\r
-#define __MEM_LIB_WRAPPERS__\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
index d1e445f7cdc71fd30e9388f2d5e085d98b3778cc..a17705db1dc2511877bb3275d2632a19d317779f 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Scans a target buffer for a 16-bit value, and returns a pointer to the\r
index d860d60c4a0d51a47044fdcb32880925a92be09a..67eb84d8ef4486fc8b8fbb4bf7e44c14170422de 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Scans a target buffer for a 32-bit value, and returns a pointer to the\r
index 67981d13c0ca6461c37bc632caa693ace34e6bd2..c5f0762ebe69ee21eb757f9b5de19ca3a45a6c41 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Scans a target buffer for a 64-bit value, and returns a pointer to the\r
index e7471a5a87f3ed2ddc74660d2f9e88d967a4f987..9b817b1b0e96920b9d8092b4b610ed38d0b9c42d 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Scans a target buffer for an 8-bit value, and returns a pointer to the\r
index 1c72644d8299019697917bbf4bdb63fa25e3937a..827e6ecf6741541c8637e2a070f0d465e41ab4dd 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Fills a target buffer with a 16-bit value, and returns the target buffer.\r
index 7217b6ef9b126d5316b5a1fd6b31ef93f7b01878..4b9d2413ebe90dee80fd323c6ad265cb0c2be45e 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Fills a target buffer with a 32-bit value, and returns the target buffer.\r
index 846d1c2c33a1920a104f876afd922015693cb9f6..dbf3b627827e50851975d61e5bd3d9fa7a4a6703 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Fills a target buffer with a 64-bit value, and returns the target buffer.\r
index 255b84d836006148d155b5dabaa8f7b567a7d873..294a27a75362e6b9286b93e30c695e4cd93c33ba 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Set Buffer to Value for Size bytes.\r
index 316b21b8561c32ae6e2562d62b235484b9a87d6c..d7d7919ba26a46aa5dabfb8ff71eb0eb9bb0271b 100644 (file)
@@ -23,7 +23,7 @@
 \r
 **/\r
 \r
-#include "MemLibWrappers.h"\r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Set Buffer to 0 for Size bytes.\r
index 552c019cdf31ea364a2aa39065923c22c0912515..161f8e351a73ecd925fced6e90e356a517c17dd9 100644 (file)
@@ -38,7 +38,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   <SourceFiles>\r
     <Arch ArchType="IA32">\r
       <Filename>MemLibGuid.c</Filename>\r
-      <Filename>MemLibWrapper.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>Ia32/CopyMem.asm</Filename>\r
       <Filename>Ia32/SetMem.asm</Filename>\r
       <Filename>Ia32/ZeroMem.asm</Filename>\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c
new file mode 100644 (file)
index 0000000..c8199d8
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Compares two memory buffers of a given length.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of\r
+  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
+  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
+  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
+\r
+  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
+  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
+\r
+  @retval 0         if DestinationBuffer == SourceBuffer\r
+  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
+  ASSERT (DestinationBuffer != NULL);\r
+  ASSERT (SourceBuffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
+  if (Length == 0) {\r
+    return 0;\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..5ca62f5
--- /dev/null
@@ -0,0 +1,66 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copy Length bytes from Source to Destination.\r
+\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
+  returns DestinationBuffer. The implementation must be reentrant, and it must\r
+  handle the case where SourceBuffer overlaps DestinationBuffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
+CopyMem (\r
+  OUT     VOID                      *Destination,\r
+  IN      CONST VOID                *Source,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  ASSERT (\r
+    Destination == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Destination + 1\r
+    );\r
+  ASSERT (\r
+    Source == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Source + 1\r
+    );\r
+  if (Destination == Source || Length == 0) {\r
+    return Destination;\r
+  }\r
+  return InternalMemCopyMem (Destination, Source, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h
new file mode 100644 (file)
index 0000000..ca7311a
--- /dev/null
@@ -0,0 +1,230 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\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/MemLibWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/MemLibWrapper.c
deleted file mode 100644 (file)
index 2ef0766..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-/** @file\r
-  Wrapper 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:  MemLibWrapper.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
-    UefiMemoryLib\r
-\r
-**/\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
-/**\r
-  Copy Length bytes from Source to Destination.\r
-\r
-  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
-  returns DestinationBuffer. The implementation must be reentrant, and it must\r
-  handle the case where SourceBuffer overlaps DestinationBuffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
-CopyMem (\r
-  OUT     VOID                      *Destination,\r
-  IN      CONST VOID                *Source,\r
-  IN      UINTN                     Length\r
-  )\r
-{\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
-  return InternalMemCopyMem (Destination, Source, Length);\r
-}\r
-\r
-/**\r
-  Set Buffer to Value for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-SetMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  return InternalMemSetMem (Buffer, Size, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem16 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem32 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem64 (Buffer, Length, Value);\r
-}\r
-\r
-/**\r
-  Set Buffer to 0 for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
-\r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-ZeroMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  return InternalMemSetMem (Buffer, Size, 0);\r
-}\r
-\r
-/**\r
-  Compares two memory buffers of a given length.\r
-\r
-  This function compares Length bytes of SourceBuffer to Length bytes of\r
-  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
-  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
-  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
-\r
-  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
-  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
-\r
-  @retval 0         if DestinationBuffer == SourceBuffer\r
-  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
-  ASSERT (DestinationBuffer != NULL);\r
-  ASSERT (SourceBuffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
-  if (Length == 0) {\r
-    return 0;\r
-  }\r
-  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address for an 8-bit value that matches\r
-  Value. If a match is found, then a pointer to the matching byte in the target\r
-  buffer is returned. If no match is found, then NULL is returned. If Length is\r
-  0, then NULL is returned.\r
-\r
-  If 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem8 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem8 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 16-bit increments for a 16-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem16 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem16 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 32-bit increments for a 32-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem32 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem32 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 64-bit increments for a 64-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem64 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
-}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c
new file mode 100644 (file)
index 0000000..a17705d
--- /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
+    UefiMemoryLib\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\r
+  matching 16-bit value 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 16-bit increments for a 16-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem16 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c
new file mode 100644 (file)
index 0000000..67eb84d
--- /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
+    UefiMemoryLib\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\r
+  matching 32-bit value 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 32-bit increments for a 32-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem32 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c
new file mode 100644 (file)
index 0000000..c5f0762
--- /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
+    UefiMemoryLib\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\r
+  matching 64-bit value 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 64-bit increments for a 64-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem64 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c
new file mode 100644 (file)
index 0000000..9b817b1
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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\r
+  matching 8-bit value 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 for an 8-bit value that matches\r
+  Value. If a match is found, then a pointer to the matching byte in the target\r
+  buffer is returned. If no match is found, then NULL is returned. If Length is\r
+  0, then NULL is returned.\r
+\r
+  If 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem8 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\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..827e6ec
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c
new file mode 100644 (file)
index 0000000..4b9d241
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c
new file mode 100644 (file)
index 0000000..dbf3b62
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c
new file mode 100644 (file)
index 0000000..294a27a
--- /dev/null
@@ -0,0 +1,52 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to Value for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+SetMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  return InternalMemSetMem (Buffer, Size, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c
new file mode 100644 (file)
index 0000000..d7d7919
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to 0 for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+\r
+  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+ZeroMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  return InternalMemSetMem (Buffer, Size, 0);\r
+}\r
index 19c92471fafe5a9569967e25a6a9ce9f9f3eb482..1389bb1c48402ebd70bb2d158cb202fb3f68d4c1 100644 (file)
@@ -38,7 +38,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   <SourceFiles>\r
     <Arch ArchType="IA32">\r
       <Filename>MemLibGuid.c</Filename>\r
-      <Filename>MemLibWrapper.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>Ia32/CopyMem.asm</Filename>\r
       <Filename>Ia32/SetMem.asm</Filename>\r
       <Filename>Ia32/SetMem16.asm</Filename>\r
@@ -53,7 +63,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     </Arch>\r
     <Arch ArchType="X64">\r
       <Filename>MemLibGuid.c</Filename>\r
-      <Filename>MemLibWrapper.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>x64/CopyMem.asm</Filename>\r
       <Filename>x64/SetMem.asm</Filename>\r
       <Filename>x64/SetMem16.asm</Filename>\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c
new file mode 100644 (file)
index 0000000..c8199d8
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Compares two memory buffers of a given length.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of\r
+  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
+  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
+  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
+\r
+  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
+  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
+\r
+  @retval 0         if DestinationBuffer == SourceBuffer\r
+  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
+  ASSERT (DestinationBuffer != NULL);\r
+  ASSERT (SourceBuffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
+  if (Length == 0) {\r
+    return 0;\r
+  }\r
+  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c
new file mode 100644 (file)
index 0000000..5ca62f5
--- /dev/null
@@ -0,0 +1,66 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copy Length bytes from Source to Destination.\r
+\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
+  returns DestinationBuffer. The implementation must be reentrant, and it must\r
+  handle the case where SourceBuffer overlaps DestinationBuffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
+CopyMem (\r
+  OUT     VOID                      *Destination,\r
+  IN      CONST VOID                *Source,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  ASSERT (\r
+    Destination == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Destination + 1\r
+    );\r
+  ASSERT (\r
+    Source == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Source + 1\r
+    );\r
+  if (Destination == Source || Length == 0) {\r
+    return Destination;\r
+  }\r
+  return InternalMemCopyMem (Destination, Source, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h
new file mode 100644 (file)
index 0000000..ca7311a
--- /dev/null
@@ -0,0 +1,230 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\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/BaseMemoryLibRepStr/MemLibWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/MemLibWrapper.c
deleted file mode 100644 (file)
index 2ef0766..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-/** @file\r
-  Wrapper 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:  MemLibWrapper.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
-    UefiMemoryLib\r
-\r
-**/\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
-/**\r
-  Copy Length bytes from Source to Destination.\r
-\r
-  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
-  returns DestinationBuffer. The implementation must be reentrant, and it must\r
-  handle the case where SourceBuffer overlaps DestinationBuffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
-CopyMem (\r
-  OUT     VOID                      *Destination,\r
-  IN      CONST VOID                *Source,\r
-  IN      UINTN                     Length\r
-  )\r
-{\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
-  return InternalMemCopyMem (Destination, Source, Length);\r
-}\r
-\r
-/**\r
-  Set Buffer to Value for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-SetMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  return InternalMemSetMem (Buffer, Size, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem16 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem32 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem64 (Buffer, Length, Value);\r
-}\r
-\r
-/**\r
-  Set Buffer to 0 for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
-\r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-ZeroMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  return InternalMemSetMem (Buffer, Size, 0);\r
-}\r
-\r
-/**\r
-  Compares two memory buffers of a given length.\r
-\r
-  This function compares Length bytes of SourceBuffer to Length bytes of\r
-  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
-  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
-  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
-\r
-  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
-  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
-\r
-  @retval 0         if DestinationBuffer == SourceBuffer\r
-  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
-  ASSERT (DestinationBuffer != NULL);\r
-  ASSERT (SourceBuffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
-  if (Length == 0) {\r
-    return 0;\r
-  }\r
-  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address for an 8-bit value that matches\r
-  Value. If a match is found, then a pointer to the matching byte in the target\r
-  buffer is returned. If no match is found, then NULL is returned. If Length is\r
-  0, then NULL is returned.\r
-\r
-  If 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem8 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem8 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 16-bit increments for a 16-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem16 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem16 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 32-bit increments for a 32-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem32 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem32 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 64-bit increments for a 64-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem64 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
-}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c
new file mode 100644 (file)
index 0000000..a17705d
--- /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
+    UefiMemoryLib\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\r
+  matching 16-bit value 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 16-bit increments for a 16-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem16 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c
new file mode 100644 (file)
index 0000000..67eb84d
--- /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
+    UefiMemoryLib\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\r
+  matching 32-bit value 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 32-bit increments for a 32-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem32 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c
new file mode 100644 (file)
index 0000000..c5f0762
--- /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
+    UefiMemoryLib\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\r
+  matching 64-bit value 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 64-bit increments for a 64-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem64 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c
new file mode 100644 (file)
index 0000000..9b817b1
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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\r
+  matching 8-bit value 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 for an 8-bit value that matches\r
+  Value. If a match is found, then a pointer to the matching byte in the target\r
+  buffer is returned. If no match is found, then NULL is returned. If Length is\r
+  0, then NULL is returned.\r
+\r
+  If 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem8 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c
new file mode 100644 (file)
index 0000000..827e6ec
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c
new file mode 100644 (file)
index 0000000..4b9d241
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c
new file mode 100644 (file)
index 0000000..dbf3b62
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c
new file mode 100644 (file)
index 0000000..294a27a
--- /dev/null
@@ -0,0 +1,52 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to Value for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+SetMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  return InternalMemSetMem (Buffer, Size, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c
new file mode 100644 (file)
index 0000000..d7d7919
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to 0 for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+\r
+  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+ZeroMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  return InternalMemSetMem (Buffer, Size, 0);\r
+}\r
index a208b2c40c4a82c803174dfb69782dc196405d5a..5798a7711628fa371d32413820636b221b39de57 100644 (file)
@@ -38,7 +38,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   <SourceFiles>\r
     <Arch ArchType="IA32">\r
       <Filename>MemLibGuid.c</Filename>\r
-      <Filename>MemLibWrapper.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>Ia32/CopyMem.asm</Filename>\r
       <Filename>Ia32/SetMem.asm</Filename>\r
       <Filename>Ia32/SetMem16.asm</Filename>\r
@@ -53,7 +63,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     </Arch>\r
     <Arch ArchType="X64">\r
       <Filename>MemLibGuid.c</Filename>\r
-      <Filename>MemLibWrapper.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>x64/CopyMem.asm</Filename>\r
       <Filename>x64/SetMem.asm</Filename>\r
       <Filename>x64/SetMem16.asm</Filename>\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c
new file mode 100644 (file)
index 0000000..c8199d8
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Compares two memory buffers of a given length.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of\r
+  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
+  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
+  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
+\r
+  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
+  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
+\r
+  @retval 0         if DestinationBuffer == SourceBuffer\r
+  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
+  ASSERT (DestinationBuffer != NULL);\r
+  ASSERT (SourceBuffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
+  if (Length == 0) {\r
+    return 0;\r
+  }\r
+  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
new file mode 100644 (file)
index 0000000..5ca62f5
--- /dev/null
@@ -0,0 +1,66 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copy Length bytes from Source to Destination.\r
+\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
+  returns DestinationBuffer. The implementation must be reentrant, and it must\r
+  handle the case where SourceBuffer overlaps DestinationBuffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
+CopyMem (\r
+  OUT     VOID                      *Destination,\r
+  IN      CONST VOID                *Source,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  ASSERT (\r
+    Destination == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Destination + 1\r
+    );\r
+  ASSERT (\r
+    Source == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Source + 1\r
+    );\r
+  if (Destination == Source || Length == 0) {\r
+    return Destination;\r
+  }\r
+  return InternalMemCopyMem (Destination, Source, Length);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h
new file mode 100644 (file)
index 0000000..ca7311a
--- /dev/null
@@ -0,0 +1,230 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\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/BaseMemoryLibSse2/MemLibWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/MemLibWrapper.c
deleted file mode 100644 (file)
index 2ef0766..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-/** @file\r
-  Wrapper 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:  MemLibWrapper.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
-    UefiMemoryLib\r
-\r
-**/\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
-/**\r
-  Copy Length bytes from Source to Destination.\r
-\r
-  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
-  returns DestinationBuffer. The implementation must be reentrant, and it must\r
-  handle the case where SourceBuffer overlaps DestinationBuffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
-CopyMem (\r
-  OUT     VOID                      *Destination,\r
-  IN      CONST VOID                *Source,\r
-  IN      UINTN                     Length\r
-  )\r
-{\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
-  return InternalMemCopyMem (Destination, Source, Length);\r
-}\r
-\r
-/**\r
-  Set Buffer to Value for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-SetMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  return InternalMemSetMem (Buffer, Size, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem16 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem32 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem64 (Buffer, Length, Value);\r
-}\r
-\r
-/**\r
-  Set Buffer to 0 for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
-\r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-ZeroMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  return InternalMemSetMem (Buffer, Size, 0);\r
-}\r
-\r
-/**\r
-  Compares two memory buffers of a given length.\r
-\r
-  This function compares Length bytes of SourceBuffer to Length bytes of\r
-  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
-  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
-  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
-\r
-  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
-  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
-\r
-  @retval 0         if DestinationBuffer == SourceBuffer\r
-  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
-  ASSERT (DestinationBuffer != NULL);\r
-  ASSERT (SourceBuffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
-  if (Length == 0) {\r
-    return 0;\r
-  }\r
-  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address for an 8-bit value that matches\r
-  Value. If a match is found, then a pointer to the matching byte in the target\r
-  buffer is returned. If no match is found, then NULL is returned. If Length is\r
-  0, then NULL is returned.\r
-\r
-  If 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem8 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem8 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 16-bit increments for a 16-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem16 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem16 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 32-bit increments for a 32-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem32 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem32 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 64-bit increments for a 64-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem64 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
-}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c
new file mode 100644 (file)
index 0000000..a17705d
--- /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
+    UefiMemoryLib\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\r
+  matching 16-bit value 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 16-bit increments for a 16-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem16 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c
new file mode 100644 (file)
index 0000000..67eb84d
--- /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
+    UefiMemoryLib\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\r
+  matching 32-bit value 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 32-bit increments for a 32-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem32 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c
new file mode 100644 (file)
index 0000000..c5f0762
--- /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
+    UefiMemoryLib\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\r
+  matching 64-bit value 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 64-bit increments for a 64-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem64 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c
new file mode 100644 (file)
index 0000000..9b817b1
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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\r
+  matching 8-bit value 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 for an 8-bit value that matches\r
+  Value. If a match is found, then a pointer to the matching byte in the target\r
+  buffer is returned. If no match is found, then NULL is returned. If Length is\r
+  0, then NULL is returned.\r
+\r
+  If 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem8 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c
new file mode 100644 (file)
index 0000000..827e6ec
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c
new file mode 100644 (file)
index 0000000..4b9d241
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c
new file mode 100644 (file)
index 0000000..dbf3b62
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c
new file mode 100644 (file)
index 0000000..294a27a
--- /dev/null
@@ -0,0 +1,52 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to Value for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+SetMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  return InternalMemSetMem (Buffer, Size, Value);\r
+}\r
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c
new file mode 100644 (file)
index 0000000..d7d7919
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to 0 for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+\r
+  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+ZeroMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  return InternalMemSetMem (Buffer, Size, 0);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c b/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c
new file mode 100644 (file)
index 0000000..c8199d8
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Compares two memory buffers of a given length.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of\r
+  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
+  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
+  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
+\r
+  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
+  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
+\r
+  @retval 0         if DestinationBuffer == SourceBuffer\r
+  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
+  ASSERT (DestinationBuffer != NULL);\r
+  ASSERT (SourceBuffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
+  if (Length == 0) {\r
+    return 0;\r
+  }\r
+  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c b/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c
new file mode 100644 (file)
index 0000000..5ca62f5
--- /dev/null
@@ -0,0 +1,66 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copy Length bytes from Source to Destination.\r
+\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
+  returns DestinationBuffer. The implementation must be reentrant, and it must\r
+  handle the case where SourceBuffer overlaps DestinationBuffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
+CopyMem (\r
+  OUT     VOID                      *Destination,\r
+  IN      CONST VOID                *Source,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  ASSERT (\r
+    Destination == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Destination + 1\r
+    );\r
+  ASSERT (\r
+    Source == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Source + 1\r
+    );\r
+  if (Destination == Source || Length == 0) {\r
+    return Destination;\r
+  }\r
+  return InternalMemCopyMem (Destination, Source, Length);\r
+}\r
index ef9f358a7950b5eef35877b349b822d3dd5355bf..bda1f4992f7945ffa063a3578651339e25a22711 100644 (file)
 \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
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Fills a target buffer with a 16-bit value, and returns the target buffer.\r
diff --git a/MdePkg/Library/PeiMemoryLib/MemLibInternals.h b/MdePkg/Library/PeiMemoryLib/MemLibInternals.h
new file mode 100644 (file)
index 0000000..ca7311a
--- /dev/null
@@ -0,0 +1,230 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\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/PeiMemoryLib/MemLibWrapper.c b/MdePkg/Library/PeiMemoryLib/MemLibWrapper.c
deleted file mode 100644 (file)
index 2ef0766..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-/** @file\r
-  Wrapper 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:  MemLibWrapper.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
-    UefiMemoryLib\r
-\r
-**/\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
-/**\r
-  Copy Length bytes from Source to Destination.\r
-\r
-  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
-  returns DestinationBuffer. The implementation must be reentrant, and it must\r
-  handle the case where SourceBuffer overlaps DestinationBuffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
-CopyMem (\r
-  OUT     VOID                      *Destination,\r
-  IN      CONST VOID                *Source,\r
-  IN      UINTN                     Length\r
-  )\r
-{\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
-  return InternalMemCopyMem (Destination, Source, Length);\r
-}\r
-\r
-/**\r
-  Set Buffer to Value for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-SetMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  return InternalMemSetMem (Buffer, Size, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem16 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem32 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem64 (Buffer, Length, Value);\r
-}\r
-\r
-/**\r
-  Set Buffer to 0 for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
-\r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-ZeroMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  return InternalMemSetMem (Buffer, Size, 0);\r
-}\r
-\r
-/**\r
-  Compares two memory buffers of a given length.\r
-\r
-  This function compares Length bytes of SourceBuffer to Length bytes of\r
-  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
-  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
-  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
-\r
-  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
-  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
-\r
-  @retval 0         if DestinationBuffer == SourceBuffer\r
-  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
-  ASSERT (DestinationBuffer != NULL);\r
-  ASSERT (SourceBuffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
-  if (Length == 0) {\r
-    return 0;\r
-  }\r
-  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address for an 8-bit value that matches\r
-  Value. If a match is found, then a pointer to the matching byte in the target\r
-  buffer is returned. If no match is found, then NULL is returned. If Length is\r
-  0, then NULL is returned.\r
-\r
-  If 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem8 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem8 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 16-bit increments for a 16-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem16 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem16 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 32-bit increments for a 32-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem32 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem32 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 64-bit increments for a 64-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem64 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
-}\r
index 38a05fe7af9f2f4d29e9efb4b5a3cc366a868b30..06ed21e3037777066efda91eabb3e0956f7c5cd5 100644 (file)
@@ -40,7 +40,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename>MemLib.c</Filename>\r
     <Filename>MemLibGuid.c</Filename>\r
     <Filename>MemLibGeneric.c</Filename>\r
-    <Filename>MemLibWrapper.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
   </SourceFiles>\r
   <Includes>\r
     <PackageName>MdePkg</PackageName>\r
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c
new file mode 100644 (file)
index 0000000..a17705d
--- /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
+    UefiMemoryLib\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\r
+  matching 16-bit value 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 16-bit increments for a 16-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem16 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c
new file mode 100644 (file)
index 0000000..67eb84d
--- /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
+    UefiMemoryLib\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\r
+  matching 32-bit value 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 32-bit increments for a 32-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem32 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c
new file mode 100644 (file)
index 0000000..c5f0762
--- /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
+    UefiMemoryLib\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\r
+  matching 64-bit value 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 64-bit increments for a 64-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem64 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c
new file mode 100644 (file)
index 0000000..9b817b1
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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\r
+  matching 8-bit value 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 for an 8-bit value that matches\r
+  Value. If a match is found, then a pointer to the matching byte in the target\r
+  buffer is returned. If no match is found, then NULL is returned. If Length is\r
+  0, then NULL is returned.\r
+\r
+  If 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem8 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c b/MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c
new file mode 100644 (file)
index 0000000..827e6ec
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c b/MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c
new file mode 100644 (file)
index 0000000..4b9d241
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c b/MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c
new file mode 100644 (file)
index 0000000..dbf3b62
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c b/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c
new file mode 100644 (file)
index 0000000..294a27a
--- /dev/null
@@ -0,0 +1,52 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to Value for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+SetMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  return InternalMemSetMem (Buffer, Size, Value);\r
+}\r
diff --git a/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c b/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c
new file mode 100644 (file)
index 0000000..d7d7919
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to 0 for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+\r
+  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+ZeroMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  return InternalMemSetMem (Buffer, Size, 0);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c b/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c
new file mode 100644 (file)
index 0000000..c8199d8
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Compares two memory buffers of a given length.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of\r
+  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
+  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
+  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
+\r
+  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
+  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
+\r
+  @retval 0         if DestinationBuffer == SourceBuffer\r
+  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
+  ASSERT (DestinationBuffer != NULL);\r
+  ASSERT (SourceBuffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
+  if (Length == 0) {\r
+    return 0;\r
+  }\r
+  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c b/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c
new file mode 100644 (file)
index 0000000..5ca62f5
--- /dev/null
@@ -0,0 +1,66 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Copy Length bytes from Source to Destination.\r
+\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
+  returns DestinationBuffer. The implementation must be reentrant, and it must\r
+  handle the case where SourceBuffer overlaps DestinationBuffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
+  ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
+CopyMem (\r
+  OUT     VOID                      *Destination,\r
+  IN      CONST VOID                *Source,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  ASSERT (\r
+    Destination == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Destination + 1\r
+    );\r
+  ASSERT (\r
+    Source == NULL ||\r
+    Length <= MAX_ADDRESS - (UINTN)Source + 1\r
+    );\r
+  if (Destination == Source || Length == 0) {\r
+    return Destination;\r
+  }\r
+  return InternalMemCopyMem (Destination, Source, Length);\r
+}\r
index ef9f358a7950b5eef35877b349b822d3dd5355bf..bda1f4992f7945ffa063a3578651339e25a22711 100644 (file)
 \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
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Fills a target buffer with a 16-bit value, and returns the target buffer.\r
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibInternals.h b/MdePkg/Library/UefiMemoryLib/MemLibInternals.h
new file mode 100644 (file)
index 0000000..ca7311a
--- /dev/null
@@ -0,0 +1,230 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#ifndef __MEM_LIB_INTERNALS__\r
+#define __MEM_LIB_INTERNALS__\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/UefiMemoryLib/MemLibWrapper.c b/MdePkg/Library/UefiMemoryLib/MemLibWrapper.c
deleted file mode 100644 (file)
index 2ef0766..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-/** @file\r
-  Wrapper 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:  MemLibWrapper.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
-    UefiMemoryLib\r
-\r
-**/\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
-/**\r
-  Copy Length bytes from Source to Destination.\r
-\r
-  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
-  returns DestinationBuffer. The implementation must be reentrant, and it must\r
-  handle the case where SourceBuffer overlaps DestinationBuffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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
-CopyMem (\r
-  OUT     VOID                      *Destination,\r
-  IN      CONST VOID                *Source,\r
-  IN      UINTN                     Length\r
-  )\r
-{\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
-  return InternalMemCopyMem (Destination, Source, Length);\r
-}\r
-\r
-/**\r
-  Set Buffer to Value for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-SetMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  return InternalMemSetMem (Buffer, Size, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem16 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem32 (Buffer, Length, Value);\r
-}\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 Buffer is NULL and Length > 0, 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
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
-  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
-  ASSERT ((Length & 1) != 0);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return Buffer;\r
-  }\r
-  return InternalMemSetMem64 (Buffer, Length, Value);\r
-}\r
-\r
-/**\r
-  Set Buffer to 0 for Size bytes.\r
-\r
-  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
-\r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
-ZeroMem (\r
-  IN      VOID                      *Buffer,\r
-  IN      UINTN                     Size\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  return InternalMemSetMem (Buffer, Size, 0);\r
-}\r
-\r
-/**\r
-  Compares two memory buffers of a given length.\r
-\r
-  This function compares Length bytes of SourceBuffer to Length bytes of\r
-  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
-  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
-  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
-\r
-  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
-  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\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\r
-\r
-  @retval 0         if DestinationBuffer == SourceBuffer\r
-  @retval Non-zero  if DestinationBuffer != SourceBuffer\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
-  ASSERT (DestinationBuffer != NULL);\r
-  ASSERT (SourceBuffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)DestinationBuffer + 1);\r
-  ASSERT (Length <= MAX_ADDRESS - (UINTN)SourceBuffer + 1);\r
-  if (Length == 0) {\r
-    return 0;\r
-  }\r
-  return InternalMemCompareMem (DestinationBuffer, SourceBuffer, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address for an 8-bit value that matches\r
-  Value. If a match is found, then a pointer to the matching byte in the target\r
-  buffer is returned. If no match is found, then NULL is returned. If Length is\r
-  0, then NULL is returned.\r
-\r
-  If 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem8 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem8 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 16-bit increments for a 16-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem16 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem16 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 32-bit increments for a 32-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem32 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem32 (Buffer, Length, 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
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 64-bit increments for a 64-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-ScanMem64 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
-  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
-\r
-  if ((Length /= sizeof (Value)) == 0) {\r
-    return NULL;\r
-  }\r
-  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
-}\r
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c
new file mode 100644 (file)
index 0000000..a17705d
--- /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
+    UefiMemoryLib\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\r
+  matching 16-bit value 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 16-bit increments for a 16-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem16 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT16                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c
new file mode 100644 (file)
index 0000000..67eb84d
--- /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
+    UefiMemoryLib\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\r
+  matching 32-bit value 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 32-bit increments for a 32-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem32 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c
new file mode 100644 (file)
index 0000000..c5f0762
--- /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
+    UefiMemoryLib\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\r
+  matching 64-bit value 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 64-bit increments for a 64-bit\r
+  value that matches Value. If a match is found, then a pointer to the matching\r
+  value in the target buffer is returned. If no match is found, then NULL is\r
+  returned. If Length is 0, then NULL is returned.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem64 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT64                    Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c
new file mode 100644 (file)
index 0000000..9b817b1
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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\r
+  matching 8-bit value 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 for an 8-bit value that matches\r
+  Value. If a match is found, then a pointer to the matching byte in the target\r
+  buffer is returned. If no match is found, then NULL is returned. If Length is\r
+  0, then NULL is returned.\r
+\r
+  If 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 Pointer to the first occurrence or NULL if not found.\r
+  @retval NULL  if Length == 0 or Value was not found.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMem8 (\r
+  IN      CONST VOID                *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS + (UINTN)Buffer + 1);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return NULL;\r
+  }\r
+  return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c b/MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c
new file mode 100644 (file)
index 0000000..827e6ec
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem16 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c b/MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c
new file mode 100644 (file)
index 0000000..4b9d241
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem32 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c b/MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c
new file mode 100644 (file)
index 0000000..dbf3b62
--- /dev/null
@@ -0,0 +1,64 @@
+/** @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
+    UefiMemoryLib\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 Buffer is NULL and Length > 0, 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
+  ASSERT (Buffer != NULL);\r
+  ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  ASSERT ((((UINTN)Buffer) & 1) != 0);\r
+  ASSERT ((Length & 1) != 0);\r
+\r
+  if ((Length /= sizeof (Value)) == 0) {\r
+    return Buffer;\r
+  }\r
+  return InternalMemSetMem64 (Buffer, Length, Value);\r
+}\r
diff --git a/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c b/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c
new file mode 100644 (file)
index 0000000..294a27a
--- /dev/null
@@ -0,0 +1,52 @@
+/** @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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to Value for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with Value, and returns Buffer.\r
+\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+SetMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size,\r
+  IN      UINT8                     Value\r
+  )\r
+{\r
+  ASSERT (Size <= MAX_ADDRESS - (UINTN)Buffer + 1);\r
+  return InternalMemSetMem (Buffer, Size, Value);\r
+}\r
index 7ef511cb16332f47be00a18a6f0489cf4232f157..ca311f78ef4d2d1a03f8e3f095971291c601613a 100644 (file)
@@ -40,7 +40,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename>MemLib.c</Filename>\r
     <Filename>MemLibGuid.c</Filename>\r
     <Filename>MemLibGeneric.c</Filename>\r
-    <Filename>MemLibWrapper.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
   </SourceFiles>\r
   <Includes>\r
     <PackageName>MdePkg</PackageName>\r
diff --git a/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c b/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c
new file mode 100644 (file)
index 0000000..d7d7919
--- /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
+    UefiMemoryLib\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+/**\r
+  Set Buffer to 0 for Size bytes.\r
+\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+\r
+  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\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
+ZeroMem (\r
+  IN      VOID                      *Buffer,\r
+  IN      UINTN                     Size\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  return InternalMemSetMem (Buffer, Size, 0);\r
+}\r