]>
git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueBaseMemoryLib.h
dbd9dd5e5611406e21868a3fbea6bf17b6483e6e
3 Copyright (c) 2004 - 2006, Intel Corporation
4 All rights reserved. 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
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.
15 EdkIIGlueBaseMemoryLib.h
19 Memory-only library functions with no library constructor/destructor
23 #ifndef __EDKII_GLUE_BASE_MEMORY_LIB_H__
24 #define __EDKII_GLUE_BASE_MEMORY_LIB_H__
27 #define CopyMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH) GlueCopyMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)
28 #define ZeroMem(_BUFFER, _LENGTH) GlueZeroMem(_BUFFER, _LENGTH)
29 #define SetMem(_BUFFER, _LENGTH, _VALUE) GlueSetMem(_BUFFER, _LENGTH, _VALUE)
30 #define CompareMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH) GlueCompareMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)
31 #define CompareGuid(_GUID1, _GUID2) GlueCompareGuid(_GUID1, _GUID2)
32 #define ScanGuid(_BUFFER, _LENGTH, _GUID) GlueScanGuid(_BUFFER, _LENGTH, _GUID)
35 Copies a source buffer to a destination buffer, and returns the destination buffer.
37 This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
38 DestinationBuffer. The implementation must be reentrant, and it must handle the case
39 where SourceBuffer overlaps DestinationBuffer.
40 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
41 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
43 @param DestinationBuffer Pointer to the destination buffer of the memory copy.
44 @param SourceBuffer Pointer to the source buffer of the memory copy.
45 @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.
47 @return DestinationBuffer.
53 OUT VOID
*DestinationBuffer
,
54 IN CONST VOID
*SourceBuffer
,
59 Fills a target buffer with a byte value, and returns the target buffer.
61 This function fills Length bytes of Buffer with Value, and returns Buffer.
62 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
64 @param Buffer Memory to set.
65 @param Length Number of bytes to set.
66 @param Value Value of the set operation.
80 Fills a target buffer with a 16-bit value, and returns the target buffer.
82 This function fills Length bytes of Buffer with the 16-bit value specified by
83 Value, and returns Buffer. Value is repeated every 16-bits in for Length
86 If Length > 0 and Buffer is NULL, then ASSERT().
87 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
88 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
89 If Length is not aligned on a 16-bit boundary, then ASSERT().
91 @param Buffer Pointer to the target buffer to fill.
92 @param Length Number of bytes in Buffer to fill.
93 @param Value Value with which to fill Length bytes of Buffer.
107 Fills a target buffer with a 32-bit value, and returns the target buffer.
109 This function fills Length bytes of Buffer with the 32-bit value specified by
110 Value, and returns Buffer. Value is repeated every 32-bits in for Length
113 If Length > 0 and Buffer is NULL, then ASSERT().
114 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
115 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
116 If Length is not aligned on a 32-bit boundary, then ASSERT().
118 @param Buffer Pointer to the target buffer to fill.
119 @param Length Number of bytes in Buffer to fill.
120 @param Value Value with which to fill Length bytes of Buffer.
134 Fills a target buffer with a 64-bit value, and returns the target buffer.
136 This function fills Length bytes of Buffer with the 64-bit value specified by
137 Value, and returns Buffer. Value is repeated every 64-bits in for Length
140 If Length > 0 and Buffer is NULL, then ASSERT().
141 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
142 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
143 If Length is not aligned on a 64-bit boundary, then ASSERT().
145 @param Buffer Pointer to the target buffer to fill.
146 @param Length Number of bytes in Buffer to fill.
147 @param Value Value with which to fill Length bytes of Buffer.
161 Fills a target buffer with zeros, and returns the target buffer.
163 This function fills Length bytes of Buffer with zeros, and returns Buffer.
164 If Length > 0 and Buffer is NULL, then ASSERT().
165 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
167 @param Buffer Pointer to the target buffer to fill with zeros.
168 @param Length Number of bytes in Buffer to fill with zeros.
181 Compares the contents of two buffers.
183 This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
184 If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
185 value returned is the first mismatched byte in SourceBuffer subtracted from the first
186 mismatched byte in DestinationBuffer.
187 If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
188 If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
189 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
190 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
192 @param DestinationBuffer Pointer to the destination buffer to compare.
193 @param SourceBuffer Pointer to the source buffer to compare.
194 @param Length Number of bytes to compare.
196 @return 0 All Length bytes of the two buffers are identical.
197 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
198 mismatched byte in DestinationBuffer.
204 IN CONST VOID
*DestinationBuffer
,
205 IN CONST VOID
*SourceBuffer
,
210 Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value
211 in the target buffer.
213 This function searches target the buffer specified by Buffer and Length from the lowest
214 address to the highest address for an 8-bit value that matches Value. If a match is found,
215 then a pointer to the matching byte in the target buffer is returned. If no match is found,
216 then NULL is returned. If Length is 0, then NULL is returned.
217 If Length > 0 and Buffer is NULL, then ASSERT().
218 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
220 @param Buffer Pointer to the target buffer to scan.
221 @param Length Number of bytes in Buffer to scan.
222 @param Value Value to search for in the target buffer.
224 @return A pointer to the matching byte in the target buffer or NULL otherwise.
230 IN CONST VOID
*Buffer
,
236 Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value
237 in the target buffer.
239 This function searches target the buffer specified by Buffer and Length from the lowest
240 address to the highest address for a 16-bit value that matches Value. If a match is found,
241 then a pointer to the matching byte in the target buffer is returned. If no match is found,
242 then NULL is returned. If Length is 0, then NULL is returned.
243 If Length > 0 and Buffer is NULL, then ASSERT().
244 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
245 If Length is not aligned on a 16-bit boundary, then ASSERT().
246 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
248 @param Buffer Pointer to the target buffer to scan.
249 @param Length Number of bytes in Buffer to scan.
250 @param Value Value to search for in the target buffer.
252 @return A pointer to the matching byte in the target buffer or NULL otherwise.
258 IN CONST VOID
*Buffer
,
264 Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value
265 in the target buffer.
267 This function searches target the buffer specified by Buffer and Length from the lowest
268 address to the highest address for a 32-bit value that matches Value. If a match is found,
269 then a pointer to the matching byte in the target buffer is returned. If no match is found,
270 then NULL is returned. If Length is 0, then NULL is returned.
271 If Length > 0 and Buffer is NULL, then ASSERT().
272 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
273 If Length is not aligned on a 32-bit boundary, then ASSERT().
274 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
276 @param Buffer Pointer to the target buffer to scan.
277 @param Length Number of bytes in Buffer to scan.
278 @param Value Value to search for in the target buffer.
280 @return A pointer to the matching byte in the target buffer or NULL otherwise.
286 IN CONST VOID
*Buffer
,
292 Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value
293 in the target buffer.
295 This function searches target the buffer specified by Buffer and Length from the lowest
296 address to the highest address for a 64-bit value that matches Value. If a match is found,
297 then a pointer to the matching byte in the target buffer is returned. If no match is found,
298 then NULL is returned. If Length is 0, then NULL is returned.
299 If Length > 0 and Buffer is NULL, then ASSERT().
300 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
301 If Length is not aligned on a 64-bit boundary, then ASSERT().
302 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
304 @param Buffer Pointer to the target buffer to scan.
305 @param Length Number of bytes in Buffer to scan.
306 @param Value Value to search for in the target buffer.
308 @return A pointer to the matching byte in the target buffer or NULL otherwise.
314 IN CONST VOID
*Buffer
,
320 Copies a source GUID to a destination GUID.
322 This function copies the contents of the 128-bit GUID specified by SourceGuid to
323 DestinationGuid, and returns DestinationGuid.
324 If DestinationGuid is NULL, then ASSERT().
325 If SourceGuid is NULL, then ASSERT().
327 @param DestinationGuid Pointer to the destination GUID.
328 @param SourceGuid Pointer to the source GUID.
330 @return DestinationGuid.
336 OUT GUID
*DestinationGuid
,
337 IN CONST GUID
*SourceGuid
343 This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.
344 If there are any bit differences in the two GUIDs, then FALSE is returned.
345 If Guid1 is NULL, then ASSERT().
346 If Guid2 is NULL, then ASSERT().
348 @param Guid1 A pointer to a 128 bit GUID.
349 @param Guid2 A pointer to a 128 bit GUID.
351 @retval TRUE Guid1 and Guid2 are identical.
352 @retval FALSE Guid1 and Guid2 are not identical.
358 IN CONST GUID
*Guid1
,
363 Scans a target buffer for a GUID, and returns a pointer to the matching GUID
364 in the target buffer.
366 This function searches target the buffer specified by Buffer and Length from
367 the lowest address to the highest address at 128-bit increments for the 128-bit
368 GUID value that matches Guid. If a match is found, then a pointer to the matching
369 GUID in the target buffer is returned. If no match is found, then NULL is returned.
370 If Length is 0, then NULL is returned.
371 If Length > 0 and Buffer is NULL, then ASSERT().
372 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
373 If Length is not aligned on a 128-bit boundary, then ASSERT().
374 If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
376 @param Buffer Pointer to the target buffer to scan.
377 @param Length Number of bytes in Buffer to scan.
378 @param Guid Value to search for in the target buffer.
380 @return A pointer to the matching Guid in the target buffer or NULL otherwise.
386 IN CONST VOID
*Buffer
,