1 /*++ 2 3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 BaseMemoryLibInternals.h 15 16 Abstract: 17 18 Header file for Base Memory Library. 19 20 --*/ 21 22 #ifndef __BASEMEMORY_LIB_INTERNALS_H__ 23 #define __BASEMEMORY_LIB_INTERNALS_H__ 24 25 #include "EdkIIGlueBase.h" 26 /** 27 Copy Length bytes from Source to Destination. 28 29 @param Destination Target of copy 30 @param Source Place to copy from 31 @param Length Number of bytes to copy 32 33 @return Destination 34 35 **/ 36 VOID * 37 EFIAPI 38 InternalMemCopyMem ( 39 OUT VOID *DestinationBuffer, 40 IN CONST VOID *SourceBuffer, 41 IN UINTN Length 42 ); 43 44 /** 45 Set Buffer to Value for Size bytes. 46 47 @param Buffer Memory to set. 48 @param Size Number of bytes to set 49 @param Value Value of the set operation. 50 51 @return Buffer 52 53 **/ 54 VOID * 55 EFIAPI 56 InternalMemSetMem ( 57 OUT VOID *Buffer, 58 IN UINTN Length, 59 IN UINT8 Value 60 ); 61 62 /** 63 Fills a target buffer with a 16-bit value, and returns the target buffer. 64 65 @param Buffer Pointer to the target buffer to fill. 66 @param Length Number of bytes in Buffer to fill. 67 @param Value Value with which to fill Length bytes of Buffer. 68 69 @return Buffer 70 71 **/ 72 VOID * 73 EFIAPI 74 InternalMemSetMem16 ( 75 OUT VOID *Buffer, 76 IN UINTN Length, 77 IN UINT16 Value 78 ); 79 80 /** 81 Fills a target buffer with a 32-bit value, and returns the target buffer. 82 83 @param Buffer Pointer to the target buffer to fill. 84 @param Length Number of bytes in Buffer to fill. 85 @param Value Value with which to fill Length bytes of Buffer. 86 87 @return Buffer 88 89 **/ 90 VOID * 91 EFIAPI 92 InternalMemSetMem32 ( 93 OUT VOID *Buffer, 94 IN UINTN Length, 95 IN UINT32 Value 96 ); 97 98 /** 99 Fills a target buffer with a 64-bit value, and returns the target buffer. 100 101 @param Buffer Pointer to the target buffer to fill. 102 @param Length Number of bytes in Buffer to fill. 103 @param Value Value with which to fill Length bytes of Buffer. 104 105 @return Buffer 106 107 **/ 108 VOID * 109 EFIAPI 110 InternalMemSetMem64 ( 111 OUT VOID *Buffer, 112 IN UINTN Length, 113 IN UINT64 Value 114 ); 115 116 /** 117 Set Buffer to 0 for Size bytes. 118 119 @param Buffer Memory to set. 120 @param Size Number of bytes to set 121 122 @return Buffer 123 124 **/ 125 VOID * 126 EFIAPI 127 InternalMemZeroMem ( 128 OUT VOID *Buffer, 129 IN UINTN Length 130 ); 131 132 /** 133 Compares two memory buffers of a given length. 134 135 @param DestinationBuffer First memory buffer 136 @param SourceBuffer Second memory buffer 137 @param Length Length of DestinationBuffer and SourceBuffer memory 138 regions to compare. Must be non-zero. 139 140 @retval 0 if MemOne == MemTwo 141 142 **/ 143 INTN 144 EFIAPI 145 InternalMemCompareMem ( 146 IN CONST VOID *DestinationBuffer, 147 IN CONST VOID *SourceBuffer, 148 IN UINTN Length 149 ); 150 151 /** 152 Scans a target buffer for an 8-bit value, and returns a pointer to the 153 matching 8-bit value in the target buffer. 154 155 @param Buffer Pointer to the target buffer to scan. 156 @param Length Number of bytes in Buffer to scan. Must be non-zero. 157 @param Value Value to search for in the target buffer. 158 159 @return Pointer to the first occurrence or NULL if not found. 160 161 **/ 162 CONST VOID * 163 EFIAPI 164 InternalMemScanMem8 ( 165 IN CONST VOID *Buffer, 166 IN UINTN Length, 167 IN UINT8 Value 168 ); 169 170 /** 171 Scans a target buffer for a 16-bit value, and returns a pointer to the 172 matching 16-bit value in the target buffer. 173 174 @param Buffer Pointer to the target buffer to scan. 175 @param Length Number of bytes in Buffer to scan. Must be non-zero. 176 @param Value Value to search for in the target buffer. 177 178 @return Pointer to the first occurrence or NULL if not found. 179 180 **/ 181 CONST VOID * 182 EFIAPI 183 InternalMemScanMem16 ( 184 IN CONST VOID *Buffer, 185 IN UINTN Length, 186 IN UINT16 Value 187 ); 188 189 /** 190 Scans a target buffer for a 32-bit value, and returns a pointer to the 191 matching 32-bit value in the target buffer. 192 193 @param Buffer Pointer to the target buffer to scan. 194 @param Length Number of bytes in Buffer to scan. Must be non-zero. 195 @param Value Value to search for in the target buffer. 196 197 @return Pointer to the first occurrence or NULL if not found. 198 199 **/ 200 CONST VOID * 201 EFIAPI 202 InternalMemScanMem32 ( 203 IN CONST VOID *Buffer, 204 IN UINTN Length, 205 IN UINT32 Value 206 ); 207 208 /** 209 Scans a target buffer for a 64-bit value, and returns a pointer to the 210 matching 64-bit value in the target buffer. 211 212 @param Buffer Pointer to the target buffer to scan. 213 @param Length Number of bytes in Buffer to scan. Must be non-zero. 214 @param Value Value to search for in the target buffer. 215 216 @return Pointer to the first occurrence or NULL if not found. 217 218 **/ 219 CONST VOID * 220 EFIAPI 221 InternalMemScanMem64 ( 222 IN CONST VOID *Buffer, 223 IN UINTN Length, 224 IN UINT64 Value 225 ); 226 227 #endif 228