10d1ba665SWarner Losh /** @file 20d1ba665SWarner Losh Provides copy memory, fill memory, zero memory, and GUID functions. 30d1ba665SWarner Losh 40d1ba665SWarner Losh The Base Memory Library provides optimized implementations for common memory-based operations. 50d1ba665SWarner Losh These functions should be used in place of coding your own loops to do equivalent common functions. 60d1ba665SWarner Losh This allows optimized library implementations to help increase performance. 70d1ba665SWarner Losh 8*3245fa21SMitchell Horne Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 9*3245fa21SMitchell Horne SPDX-License-Identifier: BSD-2-Clause-Patent 100d1ba665SWarner Losh 110d1ba665SWarner Losh **/ 120d1ba665SWarner Losh 130d1ba665SWarner Losh #ifndef __BASE_MEMORY_LIB__ 140d1ba665SWarner Losh #define __BASE_MEMORY_LIB__ 150d1ba665SWarner Losh 160d1ba665SWarner Losh /** 170d1ba665SWarner Losh Copies a source buffer to a destination buffer, and returns the destination buffer. 180d1ba665SWarner Losh 190d1ba665SWarner Losh This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns 200d1ba665SWarner Losh DestinationBuffer. The implementation must be reentrant, and it must handle the case 210d1ba665SWarner Losh where SourceBuffer overlaps DestinationBuffer. 220d1ba665SWarner Losh 230d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). 240d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). 250d1ba665SWarner Losh 260d1ba665SWarner Losh @param DestinationBuffer The pointer to the destination buffer of the memory copy. 270d1ba665SWarner Losh @param SourceBuffer The pointer to the source buffer of the memory copy. 280d1ba665SWarner Losh @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. 290d1ba665SWarner Losh 300d1ba665SWarner Losh @return DestinationBuffer. 310d1ba665SWarner Losh 320d1ba665SWarner Losh **/ 330d1ba665SWarner Losh VOID * 340d1ba665SWarner Losh EFIAPI 350d1ba665SWarner Losh CopyMem ( 360d1ba665SWarner Losh OUT VOID *DestinationBuffer, 370d1ba665SWarner Losh IN CONST VOID *SourceBuffer, 380d1ba665SWarner Losh IN UINTN Length 390d1ba665SWarner Losh ); 400d1ba665SWarner Losh 410d1ba665SWarner Losh /** 420d1ba665SWarner Losh Fills a target buffer with a byte value, and returns the target buffer. 430d1ba665SWarner Losh 440d1ba665SWarner Losh This function fills Length bytes of Buffer with Value, and returns Buffer. 450d1ba665SWarner Losh 460d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 470d1ba665SWarner Losh 480d1ba665SWarner Losh @param Buffer The memory to set. 490d1ba665SWarner Losh @param Length The number of bytes to set. 500d1ba665SWarner Losh @param Value The value with which to fill Length bytes of Buffer. 510d1ba665SWarner Losh 520d1ba665SWarner Losh @return Buffer. 530d1ba665SWarner Losh 540d1ba665SWarner Losh **/ 550d1ba665SWarner Losh VOID * 560d1ba665SWarner Losh EFIAPI 570d1ba665SWarner Losh SetMem ( 580d1ba665SWarner Losh OUT VOID *Buffer, 590d1ba665SWarner Losh IN UINTN Length, 600d1ba665SWarner Losh IN UINT8 Value 610d1ba665SWarner Losh ); 620d1ba665SWarner Losh 630d1ba665SWarner Losh /** 640d1ba665SWarner Losh Fills a target buffer with a 16-bit value, and returns the target buffer. 650d1ba665SWarner Losh 660d1ba665SWarner Losh This function fills Length bytes of Buffer with the 16-bit value specified by 670d1ba665SWarner Losh Value, and returns Buffer. Value is repeated every 16-bits in for Length 680d1ba665SWarner Losh bytes of Buffer. 690d1ba665SWarner Losh 700d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 710d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 720d1ba665SWarner Losh If Buffer is not aligned on a 16-bit boundary, then ASSERT(). 730d1ba665SWarner Losh If Length is not aligned on a 16-bit boundary, then ASSERT(). 740d1ba665SWarner Losh 750d1ba665SWarner Losh @param Buffer The pointer to the target buffer to fill. 760d1ba665SWarner Losh @param Length The number of bytes in Buffer to fill. 770d1ba665SWarner Losh @param Value The value with which to fill Length bytes of Buffer. 780d1ba665SWarner Losh 790d1ba665SWarner Losh @return Buffer. 800d1ba665SWarner Losh 810d1ba665SWarner Losh **/ 820d1ba665SWarner Losh VOID * 830d1ba665SWarner Losh EFIAPI 840d1ba665SWarner Losh SetMem16 ( 850d1ba665SWarner Losh OUT VOID *Buffer, 860d1ba665SWarner Losh IN UINTN Length, 870d1ba665SWarner Losh IN UINT16 Value 880d1ba665SWarner Losh ); 890d1ba665SWarner Losh 900d1ba665SWarner Losh /** 910d1ba665SWarner Losh Fills a target buffer with a 32-bit value, and returns the target buffer. 920d1ba665SWarner Losh 930d1ba665SWarner Losh This function fills Length bytes of Buffer with the 32-bit value specified by 940d1ba665SWarner Losh Value, and returns Buffer. Value is repeated every 32-bits in for Length 950d1ba665SWarner Losh bytes of Buffer. 960d1ba665SWarner Losh 970d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 980d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 990d1ba665SWarner Losh If Buffer is not aligned on a 32-bit boundary, then ASSERT(). 1000d1ba665SWarner Losh If Length is not aligned on a 32-bit boundary, then ASSERT(). 1010d1ba665SWarner Losh 1020d1ba665SWarner Losh @param Buffer The pointer to the target buffer to fill. 1030d1ba665SWarner Losh @param Length The number of bytes in Buffer to fill. 1040d1ba665SWarner Losh @param Value The value with which to fill Length bytes of Buffer. 1050d1ba665SWarner Losh 1060d1ba665SWarner Losh @return Buffer. 1070d1ba665SWarner Losh 1080d1ba665SWarner Losh **/ 1090d1ba665SWarner Losh VOID * 1100d1ba665SWarner Losh EFIAPI 1110d1ba665SWarner Losh SetMem32 ( 1120d1ba665SWarner Losh OUT VOID *Buffer, 1130d1ba665SWarner Losh IN UINTN Length, 1140d1ba665SWarner Losh IN UINT32 Value 1150d1ba665SWarner Losh ); 1160d1ba665SWarner Losh 1170d1ba665SWarner Losh /** 1180d1ba665SWarner Losh Fills a target buffer with a 64-bit value, and returns the target buffer. 1190d1ba665SWarner Losh 1200d1ba665SWarner Losh This function fills Length bytes of Buffer with the 64-bit value specified by 1210d1ba665SWarner Losh Value, and returns Buffer. Value is repeated every 64-bits in for Length 1220d1ba665SWarner Losh bytes of Buffer. 1230d1ba665SWarner Losh 1240d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 1250d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 1260d1ba665SWarner Losh If Buffer is not aligned on a 64-bit boundary, then ASSERT(). 1270d1ba665SWarner Losh If Length is not aligned on a 64-bit boundary, then ASSERT(). 1280d1ba665SWarner Losh 1290d1ba665SWarner Losh @param Buffer The pointer to the target buffer to fill. 1300d1ba665SWarner Losh @param Length The number of bytes in Buffer to fill. 1310d1ba665SWarner Losh @param Value The value with which to fill Length bytes of Buffer. 1320d1ba665SWarner Losh 1330d1ba665SWarner Losh @return Buffer. 1340d1ba665SWarner Losh 1350d1ba665SWarner Losh **/ 1360d1ba665SWarner Losh VOID * 1370d1ba665SWarner Losh EFIAPI 1380d1ba665SWarner Losh SetMem64 ( 1390d1ba665SWarner Losh OUT VOID *Buffer, 1400d1ba665SWarner Losh IN UINTN Length, 1410d1ba665SWarner Losh IN UINT64 Value 1420d1ba665SWarner Losh ); 1430d1ba665SWarner Losh 1440d1ba665SWarner Losh /** 1450d1ba665SWarner Losh Fills a target buffer with a value that is size UINTN, and returns the target buffer. 1460d1ba665SWarner Losh 1470d1ba665SWarner Losh This function fills Length bytes of Buffer with the UINTN sized value specified by 1480d1ba665SWarner Losh Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length 1490d1ba665SWarner Losh bytes of Buffer. 1500d1ba665SWarner Losh 1510d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 1520d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 1530d1ba665SWarner Losh If Buffer is not aligned on a UINTN boundary, then ASSERT(). 1540d1ba665SWarner Losh If Length is not aligned on a UINTN boundary, then ASSERT(). 1550d1ba665SWarner Losh 1560d1ba665SWarner Losh @param Buffer The pointer to the target buffer to fill. 1570d1ba665SWarner Losh @param Length The number of bytes in Buffer to fill. 1580d1ba665SWarner Losh @param Value The value with which to fill Length bytes of Buffer. 1590d1ba665SWarner Losh 1600d1ba665SWarner Losh @return Buffer. 1610d1ba665SWarner Losh 1620d1ba665SWarner Losh **/ 1630d1ba665SWarner Losh VOID * 1640d1ba665SWarner Losh EFIAPI 1650d1ba665SWarner Losh SetMemN ( 1660d1ba665SWarner Losh OUT VOID *Buffer, 1670d1ba665SWarner Losh IN UINTN Length, 1680d1ba665SWarner Losh IN UINTN Value 1690d1ba665SWarner Losh ); 1700d1ba665SWarner Losh 1710d1ba665SWarner Losh /** 1720d1ba665SWarner Losh Fills a target buffer with zeros, and returns the target buffer. 1730d1ba665SWarner Losh 1740d1ba665SWarner Losh This function fills Length bytes of Buffer with zeros, and returns Buffer. 1750d1ba665SWarner Losh 1760d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 1770d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 1780d1ba665SWarner Losh 1790d1ba665SWarner Losh @param Buffer The pointer to the target buffer to fill with zeros. 1800d1ba665SWarner Losh @param Length The number of bytes in Buffer to fill with zeros. 1810d1ba665SWarner Losh 1820d1ba665SWarner Losh @return Buffer. 1830d1ba665SWarner Losh 1840d1ba665SWarner Losh **/ 1850d1ba665SWarner Losh VOID * 1860d1ba665SWarner Losh EFIAPI 1870d1ba665SWarner Losh ZeroMem ( 1880d1ba665SWarner Losh OUT VOID *Buffer, 1890d1ba665SWarner Losh IN UINTN Length 1900d1ba665SWarner Losh ); 1910d1ba665SWarner Losh 1920d1ba665SWarner Losh /** 1930d1ba665SWarner Losh Compares the contents of two buffers. 1940d1ba665SWarner Losh 1950d1ba665SWarner Losh This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. 1960d1ba665SWarner Losh If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the 1970d1ba665SWarner Losh value returned is the first mismatched byte in SourceBuffer subtracted from the first 1980d1ba665SWarner Losh mismatched byte in DestinationBuffer. 1990d1ba665SWarner Losh 2000d1ba665SWarner Losh If Length > 0 and DestinationBuffer is NULL, then ASSERT(). 2010d1ba665SWarner Losh If Length > 0 and SourceBuffer is NULL, then ASSERT(). 2020d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). 2030d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). 2040d1ba665SWarner Losh 2050d1ba665SWarner Losh @param DestinationBuffer The pointer to the destination buffer to compare. 2060d1ba665SWarner Losh @param SourceBuffer The pointer to the source buffer to compare. 2070d1ba665SWarner Losh @param Length The number of bytes to compare. 2080d1ba665SWarner Losh 2090d1ba665SWarner Losh @return 0 All Length bytes of the two buffers are identical. 2100d1ba665SWarner Losh @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first 2110d1ba665SWarner Losh mismatched byte in DestinationBuffer. 2120d1ba665SWarner Losh 2130d1ba665SWarner Losh **/ 2140d1ba665SWarner Losh INTN 2150d1ba665SWarner Losh EFIAPI 2160d1ba665SWarner Losh CompareMem ( 2170d1ba665SWarner Losh IN CONST VOID *DestinationBuffer, 2180d1ba665SWarner Losh IN CONST VOID *SourceBuffer, 2190d1ba665SWarner Losh IN UINTN Length 2200d1ba665SWarner Losh ); 2210d1ba665SWarner Losh 2220d1ba665SWarner Losh /** 2230d1ba665SWarner Losh Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value 2240d1ba665SWarner Losh in the target buffer. 2250d1ba665SWarner Losh 2260d1ba665SWarner Losh This function searches target the buffer specified by Buffer and Length from the lowest 2270d1ba665SWarner Losh address to the highest address for an 8-bit value that matches Value. If a match is found, 2280d1ba665SWarner Losh then a pointer to the matching byte in the target buffer is returned. If no match is found, 2290d1ba665SWarner Losh then NULL is returned. If Length is 0, then NULL is returned. 2300d1ba665SWarner Losh 2310d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 2320d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 2330d1ba665SWarner Losh 2340d1ba665SWarner Losh @param Buffer The pointer to the target buffer to scan. 2350d1ba665SWarner Losh @param Length The number of bytes in Buffer to scan. 2360d1ba665SWarner Losh @param Value The value to search for in the target buffer. 2370d1ba665SWarner Losh 2380d1ba665SWarner Losh @return A pointer to the matching byte in the target buffer, otherwise NULL. 2390d1ba665SWarner Losh 2400d1ba665SWarner Losh **/ 2410d1ba665SWarner Losh VOID * 2420d1ba665SWarner Losh EFIAPI 2430d1ba665SWarner Losh ScanMem8 ( 2440d1ba665SWarner Losh IN CONST VOID *Buffer, 2450d1ba665SWarner Losh IN UINTN Length, 2460d1ba665SWarner Losh IN UINT8 Value 2470d1ba665SWarner Losh ); 2480d1ba665SWarner Losh 2490d1ba665SWarner Losh /** 2500d1ba665SWarner Losh Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value 2510d1ba665SWarner Losh in the target buffer. 2520d1ba665SWarner Losh 2530d1ba665SWarner Losh This function searches target the buffer specified by Buffer and Length from the lowest 2540d1ba665SWarner Losh address to the highest address for a 16-bit value that matches Value. If a match is found, 2550d1ba665SWarner Losh then a pointer to the matching byte in the target buffer is returned. If no match is found, 2560d1ba665SWarner Losh then NULL is returned. If Length is 0, then NULL is returned. 2570d1ba665SWarner Losh 2580d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 2590d1ba665SWarner Losh If Buffer is not aligned on a 16-bit boundary, then ASSERT(). 2600d1ba665SWarner Losh If Length is not aligned on a 16-bit boundary, then ASSERT(). 2610d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 2620d1ba665SWarner Losh 2630d1ba665SWarner Losh @param Buffer The pointer to the target buffer to scan. 2640d1ba665SWarner Losh @param Length The number of bytes in Buffer to scan. 2650d1ba665SWarner Losh @param Value The value to search for in the target buffer. 2660d1ba665SWarner Losh 2670d1ba665SWarner Losh @return A pointer to the matching byte in the target buffer, otherwise NULL. 2680d1ba665SWarner Losh 2690d1ba665SWarner Losh **/ 2700d1ba665SWarner Losh VOID * 2710d1ba665SWarner Losh EFIAPI 2720d1ba665SWarner Losh ScanMem16 ( 2730d1ba665SWarner Losh IN CONST VOID *Buffer, 2740d1ba665SWarner Losh IN UINTN Length, 2750d1ba665SWarner Losh IN UINT16 Value 2760d1ba665SWarner Losh ); 2770d1ba665SWarner Losh 2780d1ba665SWarner Losh /** 2790d1ba665SWarner Losh Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value 2800d1ba665SWarner Losh in the target buffer. 2810d1ba665SWarner Losh 2820d1ba665SWarner Losh This function searches target the buffer specified by Buffer and Length from the lowest 2830d1ba665SWarner Losh address to the highest address for a 32-bit value that matches Value. If a match is found, 2840d1ba665SWarner Losh then a pointer to the matching byte in the target buffer is returned. If no match is found, 2850d1ba665SWarner Losh then NULL is returned. If Length is 0, then NULL is returned. 2860d1ba665SWarner Losh 2870d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 2880d1ba665SWarner Losh If Buffer is not aligned on a 32-bit boundary, then ASSERT(). 2890d1ba665SWarner Losh If Length is not aligned on a 32-bit boundary, then ASSERT(). 2900d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 2910d1ba665SWarner Losh 2920d1ba665SWarner Losh @param Buffer The pointer to the target buffer to scan. 2930d1ba665SWarner Losh @param Length The number of bytes in Buffer to scan. 2940d1ba665SWarner Losh @param Value The value to search for in the target buffer. 2950d1ba665SWarner Losh 2960d1ba665SWarner Losh @return A pointer to the matching byte in the target buffer, otherwise NULL. 2970d1ba665SWarner Losh 2980d1ba665SWarner Losh **/ 2990d1ba665SWarner Losh VOID * 3000d1ba665SWarner Losh EFIAPI 3010d1ba665SWarner Losh ScanMem32 ( 3020d1ba665SWarner Losh IN CONST VOID *Buffer, 3030d1ba665SWarner Losh IN UINTN Length, 3040d1ba665SWarner Losh IN UINT32 Value 3050d1ba665SWarner Losh ); 3060d1ba665SWarner Losh 3070d1ba665SWarner Losh /** 3080d1ba665SWarner Losh Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value 3090d1ba665SWarner Losh in the target buffer. 3100d1ba665SWarner Losh 3110d1ba665SWarner Losh This function searches target the buffer specified by Buffer and Length from the lowest 3120d1ba665SWarner Losh address to the highest address for a 64-bit value that matches Value. If a match is found, 3130d1ba665SWarner Losh then a pointer to the matching byte in the target buffer is returned. If no match is found, 3140d1ba665SWarner Losh then NULL is returned. If Length is 0, then NULL is returned. 3150d1ba665SWarner Losh 3160d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 3170d1ba665SWarner Losh If Buffer is not aligned on a 64-bit boundary, then ASSERT(). 3180d1ba665SWarner Losh If Length is not aligned on a 64-bit boundary, then ASSERT(). 3190d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 3200d1ba665SWarner Losh 3210d1ba665SWarner Losh @param Buffer The pointer to the target buffer to scan. 3220d1ba665SWarner Losh @param Length The number of bytes in Buffer to scan. 3230d1ba665SWarner Losh @param Value The value to search for in the target buffer. 3240d1ba665SWarner Losh 3250d1ba665SWarner Losh @return A pointer to the matching byte in the target buffer, otherwise NULL. 3260d1ba665SWarner Losh 3270d1ba665SWarner Losh **/ 3280d1ba665SWarner Losh VOID * 3290d1ba665SWarner Losh EFIAPI 3300d1ba665SWarner Losh ScanMem64 ( 3310d1ba665SWarner Losh IN CONST VOID *Buffer, 3320d1ba665SWarner Losh IN UINTN Length, 3330d1ba665SWarner Losh IN UINT64 Value 3340d1ba665SWarner Losh ); 3350d1ba665SWarner Losh 3360d1ba665SWarner Losh /** 3370d1ba665SWarner Losh Scans a target buffer for a UINTN sized value, and returns a pointer to the matching 3380d1ba665SWarner Losh UINTN sized value in the target buffer. 3390d1ba665SWarner Losh 3400d1ba665SWarner Losh This function searches target the buffer specified by Buffer and Length from the lowest 3410d1ba665SWarner Losh address to the highest address for a UINTN sized value that matches Value. If a match is found, 3420d1ba665SWarner Losh then a pointer to the matching byte in the target buffer is returned. If no match is found, 3430d1ba665SWarner Losh then NULL is returned. If Length is 0, then NULL is returned. 3440d1ba665SWarner Losh 3450d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 3460d1ba665SWarner Losh If Buffer is not aligned on a UINTN boundary, then ASSERT(). 3470d1ba665SWarner Losh If Length is not aligned on a UINTN boundary, then ASSERT(). 3480d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 3490d1ba665SWarner Losh 3500d1ba665SWarner Losh @param Buffer The pointer to the target buffer to scan. 3510d1ba665SWarner Losh @param Length The number of bytes in Buffer to scan. 3520d1ba665SWarner Losh @param Value The value to search for in the target buffer. 3530d1ba665SWarner Losh 3540d1ba665SWarner Losh @return A pointer to the matching byte in the target buffer, otherwise NULL. 3550d1ba665SWarner Losh 3560d1ba665SWarner Losh **/ 3570d1ba665SWarner Losh VOID * 3580d1ba665SWarner Losh EFIAPI 3590d1ba665SWarner Losh ScanMemN ( 3600d1ba665SWarner Losh IN CONST VOID *Buffer, 3610d1ba665SWarner Losh IN UINTN Length, 3620d1ba665SWarner Losh IN UINTN Value 3630d1ba665SWarner Losh ); 3640d1ba665SWarner Losh 3650d1ba665SWarner Losh /** 3660d1ba665SWarner Losh Copies a source GUID to a destination GUID. 3670d1ba665SWarner Losh 3680d1ba665SWarner Losh This function copies the contents of the 128-bit GUID specified by SourceGuid to 3690d1ba665SWarner Losh DestinationGuid, and returns DestinationGuid. 3700d1ba665SWarner Losh 3710d1ba665SWarner Losh If DestinationGuid is NULL, then ASSERT(). 3720d1ba665SWarner Losh If SourceGuid is NULL, then ASSERT(). 3730d1ba665SWarner Losh 3740d1ba665SWarner Losh @param DestinationGuid The pointer to the destination GUID. 3750d1ba665SWarner Losh @param SourceGuid The pointer to the source GUID. 3760d1ba665SWarner Losh 3770d1ba665SWarner Losh @return DestinationGuid. 3780d1ba665SWarner Losh 3790d1ba665SWarner Losh **/ 3800d1ba665SWarner Losh GUID * 3810d1ba665SWarner Losh EFIAPI 3820d1ba665SWarner Losh CopyGuid ( 3830d1ba665SWarner Losh OUT GUID *DestinationGuid, 3840d1ba665SWarner Losh IN CONST GUID *SourceGuid 3850d1ba665SWarner Losh ); 3860d1ba665SWarner Losh 3870d1ba665SWarner Losh /** 3880d1ba665SWarner Losh Compares two GUIDs. 3890d1ba665SWarner Losh 3900d1ba665SWarner Losh This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. 3910d1ba665SWarner Losh If there are any bit differences in the two GUIDs, then FALSE is returned. 3920d1ba665SWarner Losh 3930d1ba665SWarner Losh If Guid1 is NULL, then ASSERT(). 3940d1ba665SWarner Losh If Guid2 is NULL, then ASSERT(). 3950d1ba665SWarner Losh 3960d1ba665SWarner Losh @param Guid1 A pointer to a 128 bit GUID. 3970d1ba665SWarner Losh @param Guid2 A pointer to a 128 bit GUID. 3980d1ba665SWarner Losh 3990d1ba665SWarner Losh @retval TRUE Guid1 and Guid2 are identical. 4000d1ba665SWarner Losh @retval FALSE Guid1 and Guid2 are not identical. 4010d1ba665SWarner Losh 4020d1ba665SWarner Losh **/ 4030d1ba665SWarner Losh BOOLEAN 4040d1ba665SWarner Losh EFIAPI 4050d1ba665SWarner Losh CompareGuid ( 4060d1ba665SWarner Losh IN CONST GUID *Guid1, 4070d1ba665SWarner Losh IN CONST GUID *Guid2 4080d1ba665SWarner Losh ); 4090d1ba665SWarner Losh 4100d1ba665SWarner Losh /** 4110d1ba665SWarner Losh Scans a target buffer for a GUID, and returns a pointer to the matching GUID 4120d1ba665SWarner Losh in the target buffer. 4130d1ba665SWarner Losh 4140d1ba665SWarner Losh This function searches target the buffer specified by Buffer and Length from 4150d1ba665SWarner Losh the lowest address to the highest address at 128-bit increments for the 128-bit 4160d1ba665SWarner Losh GUID value that matches Guid. If a match is found, then a pointer to the matching 4170d1ba665SWarner Losh GUID in the target buffer is returned. If no match is found, then NULL is returned. 4180d1ba665SWarner Losh If Length is 0, then NULL is returned. 4190d1ba665SWarner Losh 4200d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 4210d1ba665SWarner Losh If Buffer is not aligned on a 32-bit boundary, then ASSERT(). 4220d1ba665SWarner Losh If Length is not aligned on a 128-bit boundary, then ASSERT(). 4230d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 4240d1ba665SWarner Losh 4250d1ba665SWarner Losh @param Buffer The pointer to the target buffer to scan. 4260d1ba665SWarner Losh @param Length The number of bytes in Buffer to scan. 4270d1ba665SWarner Losh @param Guid The value to search for in the target buffer. 4280d1ba665SWarner Losh 4290d1ba665SWarner Losh @return A pointer to the matching Guid in the target buffer, otherwise NULL. 4300d1ba665SWarner Losh 4310d1ba665SWarner Losh **/ 4320d1ba665SWarner Losh VOID * 4330d1ba665SWarner Losh EFIAPI 4340d1ba665SWarner Losh ScanGuid ( 4350d1ba665SWarner Losh IN CONST VOID *Buffer, 4360d1ba665SWarner Losh IN UINTN Length, 4370d1ba665SWarner Losh IN CONST GUID *Guid 4380d1ba665SWarner Losh ); 4390d1ba665SWarner Losh 4400d1ba665SWarner Losh /** 4410d1ba665SWarner Losh Checks if the given GUID is a zero GUID. 4420d1ba665SWarner Losh 4430d1ba665SWarner Losh This function checks whether the given GUID is a zero GUID. If the GUID is 4440d1ba665SWarner Losh identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. 4450d1ba665SWarner Losh 4460d1ba665SWarner Losh If Guid is NULL, then ASSERT(). 4470d1ba665SWarner Losh 4480d1ba665SWarner Losh @param Guid The pointer to a 128 bit GUID. 4490d1ba665SWarner Losh 4500d1ba665SWarner Losh @retval TRUE Guid is a zero GUID. 4510d1ba665SWarner Losh @retval FALSE Guid is not a zero GUID. 4520d1ba665SWarner Losh 4530d1ba665SWarner Losh **/ 4540d1ba665SWarner Losh BOOLEAN 4550d1ba665SWarner Losh EFIAPI 4560d1ba665SWarner Losh IsZeroGuid ( 4570d1ba665SWarner Losh IN CONST GUID *Guid 4580d1ba665SWarner Losh ); 4590d1ba665SWarner Losh 4600d1ba665SWarner Losh /** 4610d1ba665SWarner Losh Checks if the contents of a buffer are all zeros. 4620d1ba665SWarner Losh 4630d1ba665SWarner Losh This function checks whether the contents of a buffer are all zeros. If the 4640d1ba665SWarner Losh contents are all zeros, return TRUE. Otherwise, return FALSE. 4650d1ba665SWarner Losh 4660d1ba665SWarner Losh If Length > 0 and Buffer is NULL, then ASSERT(). 4670d1ba665SWarner Losh If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 4680d1ba665SWarner Losh 4690d1ba665SWarner Losh @param Buffer The pointer to the buffer to be checked. 4700d1ba665SWarner Losh @param Length The size of the buffer (in bytes) to be checked. 4710d1ba665SWarner Losh 4720d1ba665SWarner Losh @retval TRUE Contents of the buffer are all zeros. 4730d1ba665SWarner Losh @retval FALSE Contents of the buffer are not all zeros. 4740d1ba665SWarner Losh 4750d1ba665SWarner Losh **/ 4760d1ba665SWarner Losh BOOLEAN 4770d1ba665SWarner Losh EFIAPI 4780d1ba665SWarner Losh IsZeroBuffer ( 4790d1ba665SWarner Losh IN CONST VOID *Buffer, 4800d1ba665SWarner Losh IN UINTN Length 4810d1ba665SWarner Losh ); 4820d1ba665SWarner Losh 4830d1ba665SWarner Losh #endif 484