public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/3] ArmPkg/BaseMemoryLibStm: implement new IsZeroGuid() API function
Date: Wed, 31 Aug 2016 10:07:32 +0100	[thread overview]
Message-ID: <1472634453-27246-3-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1472634453-27246-1-git-send-email-ard.biesheuvel@linaro.org>

BaseMemoryLib has recently been extended with an API function
IsZeroGuid(), so copy the default implementation into BaseMemoryLibStm
as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPkg/Library/BaseMemoryLibStm/MemLibGuid.c | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/ArmPkg/Library/BaseMemoryLibStm/MemLibGuid.c b/ArmPkg/Library/BaseMemoryLibStm/MemLibGuid.c
index 2b4ed5775581..36d42d71d79a 100644
--- a/ArmPkg/Library/BaseMemoryLibStm/MemLibGuid.c
+++ b/ArmPkg/Library/BaseMemoryLibStm/MemLibGuid.c
@@ -130,3 +130,32 @@ ScanGuid (
   }
   return NULL;
 }
+
+/**
+  Checks if the given GUID is a zero GUID.
+
+  This function checks whether the given GUID is a zero GUID. If the GUID is
+  identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned.
+
+  If Guid is NULL, then ASSERT().
+
+  @param  Guid        The pointer to a 128 bit GUID.
+
+  @retval TRUE        Guid is a zero GUID.
+  @retval FALSE       Guid is not a zero GUID.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroGuid (
+  IN CONST GUID  *Guid
+  )
+{
+  UINT64  LowPartOfGuid;
+  UINT64  HighPartOfGuid;
+
+  LowPartOfGuid  = ReadUnaligned64 ((CONST UINT64*) Guid);
+  HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+
+  return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+}
-- 
2.7.4



  parent reply	other threads:[~2016-08-31  9:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31  9:07 [PATCH 0/3] ArmPkg: introduce IsZeroGuid() and IsZeroBuffer() Ard Biesheuvel
2016-08-31  9:07 ` [PATCH 1/3] ArmPkg: remove BaseMemoryLibVstm implementation of BaseMemoryLib Ard Biesheuvel
2016-09-01 12:58   ` Leif Lindholm
2016-08-31  9:07 ` Ard Biesheuvel [this message]
2016-08-31  9:07 ` [PATCH 3/3] ArmPkg/BaseMemoryLibStm: implement new IsZeroBuffer() API function Ard Biesheuvel
2016-08-31 12:48 ` [PATCH 0/3] ArmPkg: introduce IsZeroGuid() and IsZeroBuffer() Leif Lindholm
2016-09-02 11:33   ` Laszlo Ersek
2016-09-02 13:01     ` Leif Lindholm
2016-09-02 14:18       ` Laszlo Ersek
2016-09-02 14:40         ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472634453-27246-3-git-send-email-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox