TianoCore EDK2 master
Loading...
Searching...
No Matches
MemLibGuid.c
Go to the documentation of this file.
1
20#include "MemLibInternals.h"
21
37GUID *
38EFIAPI
40 OUT GUID *DestinationGuid,
41 IN CONST GUID *SourceGuid
42 )
43{
45 (UINT64 *)DestinationGuid,
46 ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
47 );
49 (UINT64 *)DestinationGuid + 1,
50 ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
51 );
52 return DestinationGuid;
53}
54
71BOOLEAN
72EFIAPI
74 IN CONST GUID *Guid1,
75 IN CONST GUID *Guid2
76 )
77{
78 UINT64 LowPartOfGuid1;
79 UINT64 LowPartOfGuid2;
80 UINT64 HighPartOfGuid1;
81 UINT64 HighPartOfGuid2;
82
83 LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
84 LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
85 HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
86 HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
87
88 return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
89}
90
113VOID *
114EFIAPI
116 IN CONST VOID *Buffer,
117 IN UINTN Length,
118 IN CONST GUID *Guid
119 )
120{
121 CONST GUID *GuidPtr;
122
123 ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
124 ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
125 ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
126
127 GuidPtr = (GUID *)Buffer;
128 Buffer = GuidPtr + Length / sizeof (*GuidPtr);
129 while (GuidPtr < (CONST GUID *)Buffer) {
130 if (CompareGuid (GuidPtr, Guid)) {
131 return (VOID *)GuidPtr;
132 }
133
134 GuidPtr++;
135 }
136
137 return NULL;
138}
139
154BOOLEAN
155EFIAPI
157 IN CONST GUID *Guid
158 )
159{
160 UINT64 LowPartOfGuid;
161 UINT64 HighPartOfGuid;
162
163 LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
164 HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
165
166 return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
167}
UINT64 UINTN
#define MAX_ADDRESS
UINT64 EFIAPI ReadUnaligned64(IN CONST UINT64 *Buffer)
Definition: Unaligned.c:204
UINT64 EFIAPI WriteUnaligned64(OUT UINT64 *Buffer, IN UINT64 Value)
Definition: Unaligned.c:236
VOID *EFIAPI ScanGuid(IN CONST VOID *Buffer, IN UINTN Length, IN CONST GUID *Guid)
Definition: MemLibGuid.c:115
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
BOOLEAN EFIAPI IsZeroGuid(IN CONST GUID *Guid)
Definition: MemLibGuid.c:156
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
Definition: Base.h:213