]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
2 Implementation of GUID functions for ARM and AARCH64
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "MemLibInternals.h"
13 Internal function to compare two GUIDs.
15 This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.
16 If there are any bit differences in the two GUIDs, then FALSE is returned.
18 @param Guid1 A pointer to a 128 bit GUID.
19 @param Guid2 A pointer to a 128 bit GUID.
21 @retval TRUE Guid1 and Guid2 are identical.
22 @retval FALSE Guid1 and Guid2 are not identical.
27 InternalMemCompareGuid (
33 Copies a source GUID to a destination GUID.
35 This function copies the contents of the 128-bit GUID specified by SourceGuid to
36 DestinationGuid, and returns DestinationGuid.
38 If DestinationGuid is NULL, then ASSERT().
39 If SourceGuid is NULL, then ASSERT().
41 @param DestinationGuid The pointer to the destination GUID.
42 @param SourceGuid The pointer to the source GUID.
44 @return DestinationGuid.
50 OUT GUID
*DestinationGuid
,
51 IN CONST GUID
*SourceGuid
54 ASSERT (DestinationGuid
!= NULL
);
55 ASSERT (SourceGuid
!= NULL
);
57 return InternalMemCopyMem (DestinationGuid
, SourceGuid
, sizeof (GUID
));
63 This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.
64 If there are any bit differences in the two GUIDs, then FALSE is returned.
66 If Guid1 is NULL, then ASSERT().
67 If Guid2 is NULL, then ASSERT().
69 @param Guid1 A pointer to a 128 bit GUID.
70 @param Guid2 A pointer to a 128 bit GUID.
72 @retval TRUE Guid1 and Guid2 are identical.
73 @retval FALSE Guid1 and Guid2 are not identical.
83 ASSERT (Guid1
!= NULL
);
84 ASSERT (Guid2
!= NULL
);
86 return InternalMemCompareGuid (Guid1
, Guid2
);
90 Scans a target buffer for a GUID, and returns a pointer to the matching GUID
93 This function searches the target buffer specified by Buffer and Length from
94 the lowest address to the highest address at 128-bit increments for the 128-bit
95 GUID value that matches Guid. If a match is found, then a pointer to the matching
96 GUID in the target buffer is returned. If no match is found, then NULL is returned.
97 If Length is 0, then NULL is returned.
99 If Length > 0 and Buffer is NULL, then ASSERT().
100 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
101 If Length is not aligned on a 128-bit boundary, then ASSERT().
102 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
104 @param Buffer The pointer to the target buffer to scan.
105 @param Length The number of bytes in Buffer to scan.
106 @param Guid The value to search for in the target buffer.
108 @return A pointer to the matching Guid in the target buffer or NULL otherwise.
114 IN CONST VOID
*Buffer
,
121 ASSERT (((UINTN
)Buffer
& (sizeof (Guid
->Data1
) - 1)) == 0);
122 ASSERT (Length
<= (MAX_ADDRESS
- (UINTN
)Buffer
+ 1));
123 ASSERT ((Length
& (sizeof (*GuidPtr
) - 1)) == 0);
125 GuidPtr
= (GUID
*)Buffer
;
126 Buffer
= GuidPtr
+ Length
/ sizeof (*GuidPtr
);
127 while (GuidPtr
< (CONST GUID
*)Buffer
) {
128 if (InternalMemCompareGuid (GuidPtr
, Guid
)) {
129 return (VOID
*)GuidPtr
;
137 Checks if the given GUID is a zero GUID.
139 This function checks whether the given GUID is a zero GUID. If the GUID is
140 identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned.
142 If Guid is NULL, then ASSERT().
144 @param Guid The pointer to a 128 bit GUID.
146 @retval TRUE Guid is a zero GUID.
147 @retval FALSE Guid is not a zero GUID.
156 ASSERT (Guid
!= NULL
);
158 return InternalMemCompareGuid (Guid
, NULL
);