13eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/*++
23eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
32c7e5c2febd407ed1849c06da50734dd6f751956hhtianCopyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
42c7e5c2febd407ed1849c06da50734dd6f751956hhtianThis program and the accompanying materials
53eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangare licensed and made available under the terms and conditions of the BSD License
63eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangwhich accompanies this distribution.  The full text of the license may be found at
73eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwanghttp://opensource.org/licenses/bsd-license.php
83eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
93eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
103eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
113eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
123eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
133eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangModule Name:
143eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
153eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  EdkIIGlueBaseMemoryLib.h
163eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
173eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangAbstract:
183eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
193eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Memory-only library functions with no library constructor/destructor
203eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
213eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang--*/
223eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
233eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#ifndef __EDKII_GLUE_BASE_MEMORY_LIB_H__
243eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#define __EDKII_GLUE_BASE_MEMORY_LIB_H__
253eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
263eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
273eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#define CopyMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)     GlueCopyMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)
283eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#define ZeroMem(_BUFFER, _LENGTH)                               GlueZeroMem(_BUFFER, _LENGTH)
293eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#define SetMem(_BUFFER, _LENGTH, _VALUE)                        GlueSetMem(_BUFFER, _LENGTH, _VALUE)
303eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#define CompareMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)  GlueCompareMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)
313eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#define CompareGuid(_GUID1, _GUID2)                             GlueCompareGuid(_GUID1, _GUID2)
32193f8db47b9e61afcc7b6e89735d4ecfdfbd7d92qhuang#define ScanGuid(_BUFFER, _LENGTH, _GUID)                       GlueScanGuid(_BUFFER, _LENGTH, _GUID)
333eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
343eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
353eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Copies a source buffer to a destination buffer, and returns the destination buffer.
363eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
373eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
383eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  DestinationBuffer.  The implementation must be reentrant, and it must handle the case
393eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  where SourceBuffer overlaps DestinationBuffer.
403eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
413eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
423eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
433eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  DestinationBuffer   Pointer to the destination buffer of the memory copy.
443eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  SourceBuffer        Pointer to the source buffer of the memory copy.
453eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length              Number of bytes to copy from SourceBuffer to DestinationBuffer.
463eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
473eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return DestinationBuffer.
483eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
493eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
503eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
513eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
523eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangGlueCopyMem (
533eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT VOID       *DestinationBuffer,
543eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *SourceBuffer,
553eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length
563eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
573eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
583eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
593eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Fills a target buffer with a byte value, and returns the target buffer.
603eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
613eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function fills Length bytes of Buffer with Value, and returns Buffer.
623eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
633eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
643eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer    Memory to set.
653eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length    Number of bytes to set.
663eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value     Value of the set operation.
673eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
683eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return Buffer.
693eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
703eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
713eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
723eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
733eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangGlueSetMem (
743eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT VOID  *Buffer,
753eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN  Length,
763eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT8  Value
773eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
783eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
793eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
803eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Fills a target buffer with a 16-bit value, and returns the target buffer.
813eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
823eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function fills Length bytes of Buffer with the 16-bit value specified by
833eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Value, and returns Buffer. Value is repeated every 16-bits in for Length
843eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  bytes of Buffer.
853eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
863eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
873eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
883eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
893eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 16-bit boundary, then ASSERT().
903eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
913eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer  Pointer to the target buffer to fill.
923eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length  Number of bytes in Buffer to fill.
933eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value   Value with which to fill Length bytes of Buffer.
943eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
953eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return Buffer.
963eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
973eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
983eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
993eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
1003eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangSetMem16 (
1013eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT VOID   *Buffer,
1023eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN   Length,
1033eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT16  Value
1043eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
1053eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1063eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
1073eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Fills a target buffer with a 32-bit value, and returns the target buffer.
1083eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1093eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function fills Length bytes of Buffer with the 32-bit value specified by
1103eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Value, and returns Buffer. Value is repeated every 32-bits in for Length
1113eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  bytes of Buffer.
1123eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1133eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
1143eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1153eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 32-bit boundary, then ASSERT().
1163eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 32-bit boundary, then ASSERT().
1173eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1183eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer  Pointer to the target buffer to fill.
1193eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length  Number of bytes in Buffer to fill.
1203eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value   Value with which to fill Length bytes of Buffer.
1213eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1223eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return Buffer.
1233eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1243eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
1253eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
1263eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
1273eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangSetMem32 (
1283eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT VOID   *Buffer,
1293eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN   Length,
1303eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT32  Value
1313eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
1323eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1333eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
1343eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Fills a target buffer with a 64-bit value, and returns the target buffer.
1353eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1363eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function fills Length bytes of Buffer with the 64-bit value specified by
1373eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Value, and returns Buffer. Value is repeated every 64-bits in for Length
1383eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  bytes of Buffer.
1393eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1403eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
1413eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1423eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 64-bit boundary, then ASSERT().
1433eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 64-bit boundary, then ASSERT().
1443eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1453eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer  Pointer to the target buffer to fill.
1463eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length  Number of bytes in Buffer to fill.
1473eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value   Value with which to fill Length bytes of Buffer.
1483eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1493eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return Buffer.
1503eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1513eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
1523eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
1533eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
1543eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangSetMem64 (
1553eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT VOID   *Buffer,
1563eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN   Length,
1573eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT64  Value
1583eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
1593eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1603eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
1613eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Fills a target buffer with zeros, and returns the target buffer.
1623eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1633eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function fills Length bytes of Buffer with zeros, and returns Buffer.
1643eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
1653eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
1663eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1673eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer      Pointer to the target buffer to fill with zeros.
1683eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length      Number of bytes in Buffer to fill with zeros.
1693eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1703eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return Buffer.
1713eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1723eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
1733eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
1743eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
1753eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangGlueZeroMem (
1763eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT VOID  *Buffer,
1773eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN  Length
1783eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
1793eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1803eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
1813eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Compares the contents of two buffers.
1823eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1833eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
1843eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If all Length bytes of the two buffers are identical, then 0 is returned.  Otherwise, the
1853eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  value returned is the first mismatched byte in SourceBuffer subtracted from the first
1863eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  mismatched byte in DestinationBuffer.
1873eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
1883eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
1893eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
1903eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
1913eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1923eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  DestinationBuffer Pointer to the destination buffer to compare.
1933eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  SourceBuffer      Pointer to the source buffer to compare.
1943eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length            Number of bytes to compare.
1953eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
1963eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return 0                 All Length bytes of the two buffers are identical.
1973eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @retval Non-zero          The first mismatched byte in SourceBuffer subtracted from the first
1983eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang                            mismatched byte in DestinationBuffer.
1993eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2003eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
2013eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangINTN
2023eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
2033eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangGlueCompareMem (
2043eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *DestinationBuffer,
2053eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *SourceBuffer,
2063eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length
2073eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
2083eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2093eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
2103eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value
2113eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  in the target buffer.
2123eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2133eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function searches target the buffer specified by Buffer and Length from the lowest
2143eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  address to the highest address for an 8-bit value that matches Value.  If a match is found,
2153eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then a pointer to the matching byte in the target buffer is returned.  If no match is found,
2163eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then NULL is returned.  If Length is 0, then NULL is returned.
2173eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
2183eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
2193eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2203eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer      Pointer to the target buffer to scan.
2213eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length      Number of bytes in Buffer to scan.
2223eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value       Value to search for in the target buffer.
2233eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2243eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return A pointer to the matching byte in the target buffer or NULL otherwise.
2253eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2263eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
2273eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
2283eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
2293eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangScanMem8 (
2303eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *Buffer,
2313eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length,
2323eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT8       Value
2333eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
2343eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2353eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
2363eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value
2373eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  in the target buffer.
2383eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2393eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function searches target the buffer specified by Buffer and Length from the lowest
2403eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  address to the highest address for a 16-bit value that matches Value.  If a match is found,
2413eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then a pointer to the matching byte in the target buffer is returned.  If no match is found,
2423eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then NULL is returned.  If Length is 0, then NULL is returned.
2433eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
2443eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
2453eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 16-bit boundary, then ASSERT().
2463eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
2473eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2483eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer      Pointer to the target buffer to scan.
2493eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length      Number of bytes in Buffer to scan.
2503eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value       Value to search for in the target buffer.
2513eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2523eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return A pointer to the matching byte in the target buffer or NULL otherwise.
2533eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2543eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
2553eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
2563eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
2573eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangScanMem16 (
2583eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *Buffer,
2593eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length,
2603eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT16      Value
2613eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
2623eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2633eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
2643eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value
2653eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  in the target buffer.
2663eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2673eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function searches target the buffer specified by Buffer and Length from the lowest
2683eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  address to the highest address for a 32-bit value that matches Value.  If a match is found,
2693eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then a pointer to the matching byte in the target buffer is returned.  If no match is found,
2703eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then NULL is returned.  If Length is 0, then NULL is returned.
2713eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
2723eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 32-bit boundary, then ASSERT().
2733eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 32-bit boundary, then ASSERT().
2743eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
2753eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2763eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer      Pointer to the target buffer to scan.
2773eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length      Number of bytes in Buffer to scan.
2783eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value       Value to search for in the target buffer.
2793eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2803eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return A pointer to the matching byte in the target buffer or NULL otherwise.
2813eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2823eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
2833eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
2843eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
2853eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangScanMem32 (
2863eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *Buffer,
2873eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length,
2883eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT32      Value
2893eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
2903eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2913eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
2923eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value
2933eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  in the target buffer.
2943eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
2953eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function searches target the buffer specified by Buffer and Length from the lowest
2963eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  address to the highest address for a 64-bit value that matches Value.  If a match is found,
2973eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then a pointer to the matching byte in the target buffer is returned.  If no match is found,
2983eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  then NULL is returned.  If Length is 0, then NULL is returned.
2993eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
3003eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 64-bit boundary, then ASSERT().
3013eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 64-bit boundary, then ASSERT().
3023eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
3033eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3043eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer      Pointer to the target buffer to scan.
3053eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length      Number of bytes in Buffer to scan.
3063eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Value       Value to search for in the target buffer.
3073eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3083eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return A pointer to the matching byte in the target buffer or NULL otherwise.
3093eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3103eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
3113eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
3123eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
3133eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangScanMem64 (
3143eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *Buffer,
3153eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length,
3163eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINT64      Value
3173eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
3183eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3193eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
3203eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Copies a source GUID to a destination GUID.
3213eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3223eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function copies the contents of the 128-bit GUID specified by SourceGuid to
3233eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  DestinationGuid, and returns DestinationGuid.
3243eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If DestinationGuid is NULL, then ASSERT().
3253eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If SourceGuid is NULL, then ASSERT().
3263eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3273eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  DestinationGuid   Pointer to the destination GUID.
3283eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  SourceGuid        Pointer to the source GUID.
3293eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3303eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return DestinationGuid.
3313eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3323eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
3333eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangGUID *
3343eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
3353eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangCopyGuid (
3363eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  OUT GUID       *DestinationGuid,
3373eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST GUID  *SourceGuid
3383eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
3393eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3403eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
3413eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Compares two GUIDs.
3423eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3433eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function compares Guid1 to Guid2.  If the GUIDs are identical then TRUE is returned.
3443eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If there are any bit differences in the two GUIDs, then FALSE is returned.
3453eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Guid1 is NULL, then ASSERT().
3463eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Guid2 is NULL, then ASSERT().
3473eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3483eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Guid1       A pointer to a 128 bit GUID.
3493eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Guid2       A pointer to a 128 bit GUID.
3503eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3513eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @retval TRUE        Guid1 and Guid2 are identical.
3523eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @retval FALSE       Guid1 and Guid2 are not identical.
3533eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3543eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
3553eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangBOOLEAN
3563eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
3573eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangGlueCompareGuid (
3583eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST GUID  *Guid1,
3593eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST GUID  *Guid2
3603eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
3613eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3623eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang/**
3633eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  Scans a target buffer for a GUID, and returns a pointer to the matching GUID
3643eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  in the target buffer.
3653eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3663eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  This function searches target the buffer specified by Buffer and Length from
3673eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  the lowest address to the highest address at 128-bit increments for the 128-bit
3683eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  GUID value that matches Guid.  If a match is found, then a pointer to the matching
3693eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  GUID in the target buffer is returned.  If no match is found, then NULL is returned.
3703eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is 0, then NULL is returned.
3713eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length > 0 and Buffer is NULL, then ASSERT().
3723eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Buffer is not aligned on a 32-bit boundary, then ASSERT().
3733eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is not aligned on a 128-bit boundary, then ASSERT().
3743eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
3753eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3763eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Buffer  Pointer to the target buffer to scan.
3773eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Length  Number of bytes in Buffer to scan.
3783eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @param  Guid    Value to search for in the target buffer.
3793eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3803eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  @return A pointer to the matching Guid in the target buffer or NULL otherwise.
3813eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3823eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang**/
3833eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangVOID *
3843eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangEFIAPI
3853eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwangScanGuid (
3863eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST VOID  *Buffer,
3873eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN UINTN       Length,
3883eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  IN CONST GUID  *Guid
3893eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang  );
3903eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang
3913eb9473ea9a949badfe06ae61d2d3fcfa53651c7qwang#endif
392