--- /dev/null
+//\r
+// Copyright (c) 2016, Linaro Limited\r
+// All rights reserved.\r
+//\r
+// Redistribution and use in source and binary forms, with or without\r
+// modification, are permitted provided that the following conditions are met:\r
+// * Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+// * Redistributions in binary form must reproduce the above copyright\r
+// notice, this list of conditions and the following disclaimer in the\r
+// documentation and/or other materials provided with the distribution.\r
+// * Neither the name of the Linaro nor the\r
+// names of its contributors may be used to endorse or promote products\r
+// derived from this software without specific prior written permission.\r
+//\r
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+\r
+ .text\r
+ .align 5\r
+ASM_GLOBAL ASM_PFX(InternalMemCompareGuid)\r
+ASM_PFX(InternalMemCompareGuid):\r
+ mov x2, xzr\r
+ ldp x3, x4, [x0]\r
+ cbz x1, 0f\r
+ ldp x1, x2, [x1]\r
+0: cmp x1, x3\r
+ ccmp x2, x4, #0, eq\r
+ cset w0, eq\r
+ ret\r
--- /dev/null
+//\r
+// Copyright (c) 2016, Linaro Limited\r
+// All rights reserved.\r
+//\r
+// Redistribution and use in source and binary forms, with or without\r
+// modification, are permitted provided that the following conditions are met:\r
+// * Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+// * Redistributions in binary form must reproduce the above copyright\r
+// notice, this list of conditions and the following disclaimer in the\r
+// documentation and/or other materials provided with the distribution.\r
+// * Neither the name of the Linaro nor the\r
+// names of its contributors may be used to endorse or promote products\r
+// derived from this software without specific prior written permission.\r
+//\r
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+\r
+ .text\r
+ .thumb\r
+ .syntax unified\r
+ .align 5\r
+ASM_GLOBAL ASM_PFX(InternalMemCompareGuid)\r
+ASM_PFX(InternalMemCompareGuid):\r
+ push {r4, lr}\r
+ ldr r2, [r0]\r
+ ldr r3, [r0, #4]\r
+ ldr r4, [r0, #8]\r
+ ldr r0, [r0, #12]\r
+ cbz r1, 1f\r
+ ldr ip, [r1]\r
+ ldr lr, [r1, #4]\r
+ cmp r2, ip\r
+ it eq\r
+ cmpeq r3, lr\r
+ beq 0f\r
+ movs r0, #0\r
+ pop {r4, pc}\r
+\r
+0: ldr r2, [r1, #8]\r
+ ldr r3, [r1, #12]\r
+ cmp r4, r2\r
+ it eq\r
+ cmpeq r0, r3\r
+ bne 2f\r
+ movs r0, #1\r
+ pop {r4, pc}\r
+\r
+1: orrs r2, r2, r3\r
+ orrs r4, r4, r0\r
+ movs r0, #1\r
+ orrs r2, r2, r4\r
+2: it ne\r
+ movne r0, #0\r
+ pop {r4, pc}\r
--- /dev/null
+;\r
+; Copyright (c) 2016, Linaro Limited\r
+; All rights reserved.\r
+;\r
+; Redistribution and use in source and binary forms, with or without\r
+; modification, are permitted provided that the following conditions are met:\r
+; * Redistributions of source code must retain the above copyright\r
+; notice, this list of conditions and the following disclaimer.\r
+; * Redistributions in binary form must reproduce the above copyright\r
+; notice, this list of conditions and the following disclaimer in the\r
+; documentation and/or other materials provided with the distribution.\r
+; * Neither the name of the Linaro nor the\r
+; names of its contributors may be used to endorse or promote products\r
+; derived from this software without specific prior written permission.\r
+;\r
+; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+;\r
+\r
+ EXPORT InternalMemCompareGuid\r
+ THUMB\r
+ AREA CompareGuid, CODE, READONLY, CODEALIGN, ALIGN=5\r
+\r
+InternalMemCompareGuid\r
+ push {r4, lr}\r
+ ldr r2, [r0]\r
+ ldr r3, [r0, #4]\r
+ ldr r4, [r0, #8]\r
+ ldr r0, [r0, #12]\r
+ cbz r1, L1\r
+ ldr ip, [r1]\r
+ ldr lr, [r1, #4]\r
+ cmp r2, ip\r
+ it eq\r
+ cmpeq r3, lr\r
+ beq L0\r
+ movs r0, #0\r
+ pop {r4, pc}\r
+\r
+L0\r
+ ldr r2, [r1, #8]\r
+ ldr r3, [r1, #12]\r
+ cmp r4, r2\r
+ it eq\r
+ cmpeq r0, r3\r
+ bne L2\r
+ movs r0, #1\r
+ pop {r4, pc}\r
+\r
+L1\r
+ orrs r2, r2, r3\r
+ orrs r4, r4, r0\r
+ movs r0, #1\r
+ orrs r2, r2, r4\r
+\r
+L2\r
+ it ne\r
+ movne r0, #0\r
+ pop {r4, pc}\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ Implementation of GUID functions for ARM and AARCH64\r
+\r
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php.\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "MemLibInternals.h"\r
+\r
+BOOLEAN\r
+EFIAPI\r
+InternalMemCompareGuid (\r
+ IN CONST GUID *Guid1,\r
+ IN CONST GUID *Guid2\r
+ );\r
+\r
+/**\r
+ Copies a source GUID to a destination GUID.\r
+\r
+ This function copies the contents of the 128-bit GUID specified by SourceGuid to\r
+ DestinationGuid, and returns DestinationGuid.\r
+\r
+ If DestinationGuid is NULL, then ASSERT().\r
+ If SourceGuid is NULL, then ASSERT().\r
+\r
+ @param DestinationGuid The pointer to the destination GUID.\r
+ @param SourceGuid The pointer to the source GUID.\r
+\r
+ @return DestinationGuid.\r
+\r
+**/\r
+GUID *\r
+EFIAPI\r
+CopyGuid (\r
+ OUT GUID *DestinationGuid,\r
+ IN CONST GUID *SourceGuid\r
+ )\r
+{\r
+ ASSERT (DestinationGuid != NULL);\r
+ ASSERT (SourceGuid != NULL);\r
+\r
+ return InternalMemCopyMem (DestinationGuid, SourceGuid, sizeof (GUID));\r
+}\r
+\r
+/**\r
+ Compares two GUIDs.\r
+\r
+ This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.\r
+ If there are any bit differences in the two GUIDs, then FALSE is returned.\r
+\r
+ If Guid1 is NULL, then ASSERT().\r
+ If Guid2 is NULL, then ASSERT().\r
+\r
+ @param Guid1 A pointer to a 128 bit GUID.\r
+ @param Guid2 A pointer to a 128 bit GUID.\r
+\r
+ @retval TRUE Guid1 and Guid2 are identical.\r
+ @retval FALSE Guid1 and Guid2 are not identical.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CompareGuid (\r
+ IN CONST GUID *Guid1,\r
+ IN CONST GUID *Guid2\r
+ )\r
+{\r
+ ASSERT (Guid1 != NULL);\r
+ ASSERT (Guid2 != NULL);\r
+\r
+ return InternalMemCompareGuid (Guid1, Guid2);\r
+}\r
+\r
+/**\r
+ Scans a target buffer for a GUID, and returns a pointer to the matching GUID\r
+ in the target buffer.\r
+\r
+ This function searches the target buffer specified by Buffer and Length from\r
+ the lowest address to the highest address at 128-bit increments for the 128-bit\r
+ GUID value that matches Guid. If a match is found, then a pointer to the matching\r
+ GUID in the target buffer is returned. If no match is found, then NULL is returned.\r
+ If Length is 0, then NULL is returned.\r
+\r
+ If Length > 0 and Buffer is NULL, then ASSERT().\r
+ If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+ If Length is not aligned on a 128-bit boundary, then ASSERT().\r
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+ @param Buffer The pointer to the target buffer to scan.\r
+ @param Length The number of bytes in Buffer to scan.\r
+ @param Guid The value to search for in the target buffer.\r
+\r
+ @return A pointer to the matching Guid in the target buffer or NULL otherwise.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanGuid (\r
+ IN CONST VOID *Buffer,\r
+ IN UINTN Length,\r
+ IN CONST GUID *Guid\r
+ )\r
+{\r
+ CONST GUID *GuidPtr;\r
+\r
+ ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);\r
+ ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));\r
+ ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);\r
+\r
+ GuidPtr = (GUID*)Buffer;\r
+ Buffer = GuidPtr + Length / sizeof (*GuidPtr);\r
+ while (GuidPtr < (CONST GUID*)Buffer) {\r
+ if (InternalMemCompareGuid (GuidPtr, Guid)) {\r
+ return (VOID*)GuidPtr;\r
+ }\r
+ GuidPtr++;\r
+ }\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Checks if the given GUID is a zero GUID.\r
+\r
+ This function checks whether the given GUID is a zero GUID. If the GUID is\r
+ identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned.\r
+\r
+ If Guid is NULL, then ASSERT().\r
+\r
+ @param Guid The pointer to a 128 bit GUID.\r
+\r
+ @retval TRUE Guid is a zero GUID.\r
+ @retval FALSE Guid is not a zero GUID.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsZeroGuid (\r
+ IN CONST GUID *Guid\r
+ )\r
+{\r
+ ASSERT (Guid != NULL);\r
+\r
+ return InternalMemCompareGuid (Guid, NULL);\r
+}\r
Ia32/CopyMem.nasm\r
Ia32/CopyMem.asm\r
Ia32/IsZeroBuffer.nasm\r
+ MemLibGuid.c\r
\r
[Sources.X64]\r
X64/ScanMem64.nasm\r
X64/CopyMem.asm\r
X64/CopyMem.S\r
X64/IsZeroBuffer.nasm\r
+ MemLibGuid.c\r
\r
[Defines.ARM, Defines.AARCH64]\r
#\r
Arm/SetMem.S |GCC\r
Arm/CopyMem.S |GCC\r
Arm/CompareMem.S |GCC\r
+ Arm/CompareGuid.S |GCC\r
\r
Arm/ScanMem.asm |RVCT\r
Arm/SetMem.asm |RVCT\r
Arm/CopyMem.asm |RVCT\r
Arm/CompareMem.asm |RVCT\r
+ Arm/CompareGuid.asm |RVCT\r
\r
[Sources.AARCH64]\r
AArch64/ScanMem.S\r
AArch64/SetMem.S\r
AArch64/CopyMem.S\r
AArch64/CompareMem.S\r
+ AArch64/CompareGuid.S\r
\r
[Sources.ARM, Sources.AARCH64]\r
Arm/ScanMemGeneric.c\r
+ Arm/MemLibGuid.c\r
\r
[Sources]\r
ScanMem64Wrapper.c\r
SetMemWrapper.c\r
CopyMemWrapper.c\r
IsZeroBufferWrapper.c\r
- MemLibGuid.c\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r