<Filename>CopyMem.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
<Filename>SetMem.c</Filename>\r
</SourceFiles>\r
<Includes>\r
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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 (Length <= MAX_ADDRESS - (UINTN)Destination + 1);\r
+ ASSERT (Length <= MAX_ADDRESS - (UINTN)Source + 1);\r
+ if (Destination == Source || Length == 0) {\r
+ return Destination;\r
+ }\r
+ return InternalMemCopyMem (Destination, Source, Length);\r
+}\r
+++ /dev/null
-/** @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
--- /dev/null
+/** @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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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
--- /dev/null
+/** @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 "MemLibWrappers.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