* [PATCH 1/3] MdePkg BaseMemoryLib: Add implementation of API IsZeroGuid()
2016-08-04 1:24 [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Hao Wu
@ 2016-08-04 1:24 ` Hao Wu
2016-08-04 1:24 ` [PATCH 2/3] MdePkg BaseMemoryLib: Add implementation of API IsZeroBuffer() Hao Wu
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Hao Wu @ 2016-08-04 1:24 UTC (permalink / raw)
To: edk2-devel; +Cc: Hao Wu, Michael D Kinney, Liming Gao, Jiewen Yao
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
MdePkg/Include/Library/BaseMemoryLib.h | 20 ++++++++++++++++
MdePkg/Library/BaseMemoryLib/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/PeiMemoryLib/MemLibGuid.c | 31 ++++++++++++++++++++++++-
MdePkg/Library/UefiMemoryLib/MemLibGuid.c | 31 ++++++++++++++++++++++++-
9 files changed, 260 insertions(+), 8 deletions(-)
diff --git a/MdePkg/Include/Library/BaseMemoryLib.h b/MdePkg/Include/Library/BaseMemoryLib.h
index e3a46d0..5a57dee 100644
--- a/MdePkg/Include/Library/BaseMemoryLib.h
+++ b/MdePkg/Include/Library/BaseMemoryLib.h
@@ -443,4 +443,24 @@ ScanGuid (
IN CONST GUID *Guid
);
+/**
+ 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
+ );
+
#endif
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibGuid.c b/MdePkg/Library/BaseMemoryLib/MemLibGuid.c
index dc16bd5..b2590f8 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLib/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
index c04af6e..cbb385f 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
index c04af6e..cbb385f 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
index 6f6edd0..cbb385f 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
index 6f6edd0..cbb385f 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
index c04af6e..cbb385f 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/PeiMemoryLib/MemLibGuid.c b/MdePkg/Library/PeiMemoryLib/MemLibGuid.c
index c04af6e..cbb385f 100644
--- a/MdePkg/Library/PeiMemoryLib/MemLibGuid.c
+++ b/MdePkg/Library/PeiMemoryLib/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibGuid.c b/MdePkg/Library/UefiMemoryLib/MemLibGuid.c
index 6f6edd0..cbb385f 100644
--- a/MdePkg/Library/UefiMemoryLib/MemLibGuid.c
+++ b/MdePkg/Library/UefiMemoryLib/MemLibGuid.c
@@ -12,7 +12,7 @@
PeiMemoryLib
UefiMemoryLib
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -140,3 +140,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);
+}
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] MdePkg BaseMemoryLib: Add implementation of API IsZeroBuffer()
2016-08-04 1:24 [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Hao Wu
2016-08-04 1:24 ` [PATCH 1/3] MdePkg BaseMemoryLib: Add implementation of API IsZeroGuid() Hao Wu
@ 2016-08-04 1:24 ` Hao Wu
2016-08-04 1:24 ` [PATCH 3/3] SecurityPkg Tcg2: Remove internal implementation of IsZeroBuffer() Hao Wu
2016-08-04 8:07 ` [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Laszlo Ersek
3 siblings, 0 replies; 7+ messages in thread
From: Hao Wu @ 2016-08-04 1:24 UTC (permalink / raw)
To: edk2-devel; +Cc: Hao Wu, Michael D Kinney, Liming Gao, Jiewen Yao
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
MdePkg/Include/Library/BaseMemoryLib.h | 23 ++++++++
MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf | 1 +
MdePkg/Library/BaseMemoryLib/IsZeroBuffer.c | 65 ++++++++++++++++++++++
.../Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf | 1 +
MdePkg/Library/BaseMemoryLibMmx/IsZeroBuffer.c | 65 ++++++++++++++++++++++
.../BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf | 2 +
MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBuffer.c | 65 ++++++++++++++++++++++
.../BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf | 2 +
MdePkg/Library/BaseMemoryLibOptPei/IsZeroBuffer.c | 65 ++++++++++++++++++++++
.../BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf | 1 +
MdePkg/Library/BaseMemoryLibRepStr/IsZeroBuffer.c | 65 ++++++++++++++++++++++
.../BaseMemoryLibSse2/BaseMemoryLibSse2.inf | 1 +
MdePkg/Library/BaseMemoryLibSse2/IsZeroBuffer.c | 65 ++++++++++++++++++++++
MdePkg/Library/PeiMemoryLib/IsZeroBuffer.c | 65 ++++++++++++++++++++++
MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf | 1 +
MdePkg/Library/UefiMemoryLib/IsZeroBuffer.c | 65 ++++++++++++++++++++++
MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf | 1 +
17 files changed, 553 insertions(+)
create mode 100644 MdePkg/Library/BaseMemoryLib/IsZeroBuffer.c
create mode 100644 MdePkg/Library/BaseMemoryLibMmx/IsZeroBuffer.c
create mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBuffer.c
create mode 100644 MdePkg/Library/BaseMemoryLibOptPei/IsZeroBuffer.c
create mode 100644 MdePkg/Library/BaseMemoryLibRepStr/IsZeroBuffer.c
create mode 100644 MdePkg/Library/BaseMemoryLibSse2/IsZeroBuffer.c
create mode 100644 MdePkg/Library/PeiMemoryLib/IsZeroBuffer.c
create mode 100644 MdePkg/Library/UefiMemoryLib/IsZeroBuffer.c
diff --git a/MdePkg/Include/Library/BaseMemoryLib.h b/MdePkg/Include/Library/BaseMemoryLib.h
index 5a57dee..1338c27 100644
--- a/MdePkg/Include/Library/BaseMemoryLib.h
+++ b/MdePkg/Include/Library/BaseMemoryLib.h
@@ -463,4 +463,27 @@ IsZeroGuid (
IN CONST GUID *Guid
);
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ );
+
#endif
diff --git a/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf b/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
index 5dfab35..51b4d16 100644
--- a/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+++ b/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
@@ -45,6 +45,7 @@
MemLibGeneric.c
MemLibGuid.c
CopyMem.c
+ IsZeroBuffer.c
MemLibInternals.h
[Packages]
diff --git a/MdePkg/Library/BaseMemoryLib/IsZeroBuffer.c b/MdePkg/Library/BaseMemoryLib/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/BaseMemoryLib/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
index a609073..59261f9 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
+++ b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
@@ -47,6 +47,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
MemLibInternals.h
[Sources.Ia32]
diff --git a/MdePkg/Library/BaseMemoryLibMmx/IsZeroBuffer.c b/MdePkg/Library/BaseMemoryLibMmx/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/BaseMemoryLibMmx/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
index e637034..a75270b 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
@@ -90,6 +90,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
[Sources.X64]
X64/ScanMem64.nasm
@@ -137,6 +138,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBuffer.c b/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
index ff60e9e..bd915eb 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
+++ b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
@@ -90,6 +90,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
[Sources.X64]
X64/ScanMem64.nasm
@@ -137,6 +138,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
[Packages]
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBuffer.c b/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
index 9d7ce4b..aac7865 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+++ b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
@@ -44,6 +44,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
[Sources.Ia32]
Ia32/ScanMem64.nasm
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBuffer.c b/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
index a78d823..2919827 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
+++ b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
@@ -43,6 +43,7 @@
SetMemWrapper.c
CopyMemWrapper.c
MemLibGuid.c
+ IsZeroBuffer.c
[Sources.Ia32]
Ia32/ScanMem64.nasm
diff --git a/MdePkg/Library/BaseMemoryLibSse2/IsZeroBuffer.c b/MdePkg/Library/BaseMemoryLibSse2/IsZeroBuffer.c
new file mode 100644
index 0000000..6a3a2c1
--- /dev/null
+++ b/MdePkg/Library/BaseMemoryLibSse2/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/PeiMemoryLib/IsZeroBuffer.c b/MdePkg/Library/PeiMemoryLib/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/PeiMemoryLib/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf b/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf
index 58af9d0..9760639 100644
--- a/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf
+++ b/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf
@@ -45,6 +45,7 @@
MemLibGeneric.c
MemLibGuid.c
MemLib.c
+ IsZeroBuffer.c
MemLibInternals.h
diff --git a/MdePkg/Library/UefiMemoryLib/IsZeroBuffer.c b/MdePkg/Library/UefiMemoryLib/IsZeroBuffer.c
new file mode 100644
index 0000000..fda0c7c
--- /dev/null
+++ b/MdePkg/Library/UefiMemoryLib/IsZeroBuffer.c
@@ -0,0 +1,65 @@
+/** @file
+ Implementation of IsZeroBuffer function.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+
+/**
+ Checks if the contents of a buffer are all zeros.
+
+ This function checks whether the contents of a buffer are all zeros. If the
+ contents are all zeros, return TRUE. Otherwise, return FALSE.
+
+ If Length > 0 and Buffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ @param Buffer The pointer to the buffer to be checked.
+ @param Length The size of the buffer (in bytes) to be checked.
+
+ @retval TRUE Contents of the buffer are all zeros.
+ @retval FALSE Contents of the buffer are not all zeros.
+
+**/
+BOOLEAN
+EFIAPI
+IsZeroBuffer (
+ IN CONST VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ CONST UINT8 *BufferData;
+ UINTN Index;
+
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+
+ BufferData = Buffer;
+ for (Index = 0; Index < Length; Index++) {
+ if (BufferData[Index] != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf b/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf
index e82732f..2ea7875 100644
--- a/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf
+++ b/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf
@@ -45,6 +45,7 @@
MemLibGeneric.c
MemLibGuid.c
MemLib.c
+ IsZeroBuffer.c
MemLibInternals.h
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] SecurityPkg Tcg2: Remove internal implementation of IsZeroBuffer()
2016-08-04 1:24 [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Hao Wu
2016-08-04 1:24 ` [PATCH 1/3] MdePkg BaseMemoryLib: Add implementation of API IsZeroGuid() Hao Wu
2016-08-04 1:24 ` [PATCH 2/3] MdePkg BaseMemoryLib: Add implementation of API IsZeroBuffer() Hao Wu
@ 2016-08-04 1:24 ` Hao Wu
2016-08-04 13:28 ` Zhang, Chao B
2016-08-04 8:07 ` [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Laszlo Ersek
3 siblings, 1 reply; 7+ messages in thread
From: Hao Wu @ 2016-08-04 1:24 UTC (permalink / raw)
To: edk2-devel; +Cc: Hao Wu, Jiewen Yao, Chao Zhang
This commit removes the internal implementation of the function
IsZeroBuffer(). Instead, it will use the one from BaseMemoryLib.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 27 ---------------------------
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 27 ---------------------------
SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 27 ---------------------------
3 files changed, 81 deletions(-)
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
index db38bd4..5f4420c 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
@@ -617,33 +617,6 @@ FillBufferWithTCG2EventLogFormat (
}
/**
- Check if buffer is all zero.
-
- @param[in] Buffer Buffer to be checked.
- @param[in] BufferSize Size of buffer to be checked.
-
- @retval TRUE Buffer is all zero.
- @retval FALSE Buffer is not all zero.
-**/
-BOOLEAN
-IsZeroBuffer (
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-{
- UINT8 *BufferData;
- UINTN Index;
-
- BufferData = Buffer;
- for (Index = 0; Index < BufferSize; Index++) {
- if (BufferData[Index] != 0) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
This function publish the TCG2 configuration Form for TPM device.
@param[in, out] PrivateData Points to TCG2 configuration private data.
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index 95219c0..319f245 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -202,33 +202,6 @@ InternalDumpHex (
}
/**
- Check if buffer is all zero.
-
- @param[in] Buffer Buffer to be checked.
- @param[in] BufferSize Size of buffer to be checked.
-
- @retval TRUE Buffer is all zero.
- @retval FALSE Buffer is not all zero.
-**/
-BOOLEAN
-IsZeroBuffer (
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-{
- UINT8 *BufferData;
- UINTN Index;
-
- BufferData = Buffer;
- for (Index = 0; Index < BufferSize; Index++) {
- if (BufferData[Index] != 0) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
Get All processors EFI_CPU_LOCATION in system. LocationBuf is allocated inside the function
Caller is responsible to free LocationBuf.
diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index a830ba8..0d779f1 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -225,33 +225,6 @@ EndofPeiSignalNotifyCallBack (
}
/**
- Check if buffer is all zero.
-
- @param[in] Buffer Buffer to be checked.
- @param[in] BufferSize Size of buffer to be checked.
-
- @retval TRUE Buffer is all zero.
- @retval FALSE Buffer is not all zero.
-**/
-BOOLEAN
-IsZeroBuffer (
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-{
- UINT8 *BufferData;
- UINTN Index;
-
- BufferData = Buffer;
- for (Index = 0; Index < BufferSize; Index++) {
- if (BufferData[Index] != 0) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
Get TPML_DIGEST_VALUES data size.
@param[in] DigestList TPML_DIGEST_VALUES data.
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] SecurityPkg Tcg2: Remove internal implementation of IsZeroBuffer()
2016-08-04 1:24 ` [PATCH 3/3] SecurityPkg Tcg2: Remove internal implementation of IsZeroBuffer() Hao Wu
@ 2016-08-04 13:28 ` Zhang, Chao B
0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Chao B @ 2016-08-04 13:28 UTC (permalink / raw)
To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Yao, Jiewen
Reviewed-by: Chao Zhang<chao.b.zhang@intel.com>
Thanks & Best regards
Chao Zhang
-----Original Message-----
From: Wu, Hao A
Sent: Thursday, August 04, 2016 9:24 AM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A; Yao, Jiewen; Zhang, Chao B
Subject: [PATCH 3/3] SecurityPkg Tcg2: Remove internal implementation of IsZeroBuffer()
This commit removes the internal implementation of the function
IsZeroBuffer(). Instead, it will use the one from BaseMemoryLib.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 27 ---------------------------
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 27 ---------------------------
SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 27 ---------------------------
3 files changed, 81 deletions(-)
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
index db38bd4..5f4420c 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
@@ -617,33 +617,6 @@ FillBufferWithTCG2EventLogFormat (
}
/**
- Check if buffer is all zero.
-
- @param[in] Buffer Buffer to be checked.
- @param[in] BufferSize Size of buffer to be checked.
-
- @retval TRUE Buffer is all zero.
- @retval FALSE Buffer is not all zero.
-**/
-BOOLEAN
-IsZeroBuffer (
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-{
- UINT8 *BufferData;
- UINTN Index;
-
- BufferData = Buffer;
- for (Index = 0; Index < BufferSize; Index++) {
- if (BufferData[Index] != 0) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
This function publish the TCG2 configuration Form for TPM device.
@param[in, out] PrivateData Points to TCG2 configuration private data.
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index 95219c0..319f245 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -202,33 +202,6 @@ InternalDumpHex (
}
/**
- Check if buffer is all zero.
-
- @param[in] Buffer Buffer to be checked.
- @param[in] BufferSize Size of buffer to be checked.
-
- @retval TRUE Buffer is all zero.
- @retval FALSE Buffer is not all zero.
-**/
-BOOLEAN
-IsZeroBuffer (
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-{
- UINT8 *BufferData;
- UINTN Index;
-
- BufferData = Buffer;
- for (Index = 0; Index < BufferSize; Index++) {
- if (BufferData[Index] != 0) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
Get All processors EFI_CPU_LOCATION in system. LocationBuf is allocated inside the function
Caller is responsible to free LocationBuf.
diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index a830ba8..0d779f1 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -225,33 +225,6 @@ EndofPeiSignalNotifyCallBack (
}
/**
- Check if buffer is all zero.
-
- @param[in] Buffer Buffer to be checked.
- @param[in] BufferSize Size of buffer to be checked.
-
- @retval TRUE Buffer is all zero.
- @retval FALSE Buffer is not all zero.
-**/
-BOOLEAN
-IsZeroBuffer (
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-{
- UINT8 *BufferData;
- UINTN Index;
-
- BufferData = Buffer;
- for (Index = 0; Index < BufferSize; Index++) {
- if (BufferData[Index] != 0) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
Get TPML_DIGEST_VALUES data size.
@param[in] DigestList TPML_DIGEST_VALUES data.
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib
2016-08-04 1:24 [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Hao Wu
` (2 preceding siblings ...)
2016-08-04 1:24 ` [PATCH 3/3] SecurityPkg Tcg2: Remove internal implementation of IsZeroBuffer() Hao Wu
@ 2016-08-04 8:07 ` Laszlo Ersek
2016-08-04 8:44 ` Wu, Hao A
3 siblings, 1 reply; 7+ messages in thread
From: Laszlo Ersek @ 2016-08-04 8:07 UTC (permalink / raw)
To: Hao Wu; +Cc: edk2-devel, Ard Biesheuvel, Leif Lindholm (Linaro address)
Hello Hao,
On 08/04/16 03:24, Hao Wu wrote:
> The patch series will add two APIs in BaseMemoryLib:
> 1. IsZeroBuffer()
> The API is used to check if the contents of a buffer are all zeros.
>
> 2. IsZeroGuid()
> The API is used to check if the given GUID is a zero GUID.
>
> In order to resolve build issues in SecurityPkg, the series will also
> remove the internal implementation of IsZeroBuffer() in modules within
> SecurityPkg\Tcg and use the one in BaseMemoryLib instead.
(1) Do you plan to add optimized implementations of IsZeroBuffer() later
on?
For example, in QEMU, the buffer_is_zero() function has optimized
implementations for:
- AVX2
- SSE2
- AArch64
I see one of the library instances is called BaseMemoryLibSse2, so an
SSE2 optimized implementation could be possible.
Also, as far as I understand the example in the QEMU code, for AArch64,
the optimized implementation could go in all of the library instances
that build on AArch64. (QEMU calls the vgetq_lane_u64() function -- I'm
unsure how it would be available in edk2. Perhaps AArch64 assembly would
be necessary.)
Just an idea, of course.
(2) The edk2 tree contains a number of zero GUID comparisons:
$ git grep -i -e zeroguid --and -e compareguid
> BaseTools/Source/C/GenFfs/GenFfs.c:749: if (CompareGuid (&FileGuid, &mZeroGuid) == 0) {
> BaseTools/Source/C/GenFv/GenFvInternalLib.c:4134: if (CompareGuid (&mCapDataInfo.CapGuid, &mZeroGuid) == 0) {
> BaseTools/Source/C/GenSec/GenSec.c:854: if (CompareGuid (VendorGuid, &mZeroGuid) == 0) {
> BaseTools/Source/C/GenSec/GenSec.c:900: if (CompareGuid (VendorGuid, &mZeroGuid) == 0) {
> BaseTools/Source/C/GenSec/GenSec.c:1368: if ((SectType != EFI_SECTION_GUID_DEFINED) && (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
> BaseTools/Source/C/GenSec/GenSec.c:1421: if (InputFileAlign != NULL && (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
> EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c:717: if (FormSetGuid == NULL || CompareGuid (FormSetGuid, &gZeroGuid)) {
> EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Translate.c:85: for (; !CompareGuid (&(mConversionTable[Index].SubClass), &gZeroGuid); Index++) {
> EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Translate.c:96: if (CompareGuid (&(mConversionTable[Index].SubClass), &gZeroGuid)) {
> EdkCompatibilityPkg/Sample/Tools/Source/GenAprioriFile/GenAprioriFile.c:196: if (CompareGuid (&GuidIn, &ZeroGuid) != 0) {
> EdkCompatibilityPkg/Sample/Tools/Source/GenFfsFile/GenFfsFile.c:1328: if (CompareGuid (&SignGuid, &mZeroGuid) != 0) {
> EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c:1348: if (CompareGuid (&File->FvNameGuid, &gZeroGuid)) {
> IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c:142: (CompareGuid (&FilterEntry->FilterDataRecordGuid, &gZeroGuid) ||
> MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c:258: if (!CompareGuid (&DriverInfo->FileName, &gZeroGuid)) {
> MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c:449: if (CompareGuid (PcdGetPtr (PcdDriverHealthConfigureForm), &gZeroGuid)) {
> MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c:375: for (Index = 0; !CompareGuid (&DriverGuidArray[Index], &gZeroGuid); Index++) {
> MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c:424: if (CompareGuid (&DriverGuidArray[0], &gZeroGuid)) {
> MdeModulePkg/Universal/SetupBrowserDxe/Expression.c:2832: } else if (CompareGuid (&OpCode->Guid, &gZeroGuid) != 0) {
> MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:361: if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
> MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:376: if ((!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) || (Statement->RefreshInterval != 0)) {
> MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:631: if (!CompareGuid (&gCurrentSelection->Form->RefreshGuid, &gZeroGuid)) {
> MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:1413: } else if (!CompareGuid (&Statement->HiiValue.Value.ref.FormSetGuid, &gZeroGuid)) {
> MdeModulePkg/Universal/SetupBrowserDxe/Setup.c:184: if (CompareGuid (&MenuList->FormSetGuid, &gZeroGuid)) {
> MdeModulePkg/Universal/SetupBrowserDxe/Setup.c:5659: if (CompareGuid (FormSetGuid, &gZeroGuid) ||
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c:376: if (CompareGuid (&VendorGuid, &gZeroGuid)) {
> SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c:205: if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
> SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c:241: if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
> SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c:205: if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
> SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c:239: if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
Do you plan to migrate these source files to the new IsZeroGuid()
function?
(There might be more -- "zeroguid" and "compareguid" could be on
different lines, so perhaps it's better to search for just "zeroguid",
and audit each location separately.)
(3) I think patch #3 should be implemented differently -- I believe the
current series can break bisection between patch #2 and patch #3.
I suggest to first rename the IsZeroBuffer() functions in
SecurityPkg/Tcg to IsZeroBufferInternal(), as patch #1.
Then add IsZeroBuffer() and IsZeroGuid() to the BaseMemoryLib instances,
as patch #2 and patch #3.
Finally, switch SecurityPkg/Tcg from IsZeroBufferInternal() to
IsZeroBuffer() in patch #4.
What do you think?
Thanks
Laszlo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib
2016-08-04 8:07 ` [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in BaseMemoryLib Laszlo Ersek
@ 2016-08-04 8:44 ` Wu, Hao A
0 siblings, 0 replies; 7+ messages in thread
From: Wu, Hao A @ 2016-08-04 8:44 UTC (permalink / raw)
To: Laszlo Ersek
Cc: edk2-devel@ml01.01.org, Leif Lindholm (Linaro address),
Ard Biesheuvel
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Laszlo
> Ersek
> Sent: Thursday, August 04, 2016 4:07 PM
> To: Wu, Hao A
> Cc: edk2-devel@ml01.01.org; Leif Lindholm (Linaro address); Ard Biesheuvel
> Subject: Re: [edk2] [PATCH 0/3] Add APIs IsZeroBuffer and IsZeroGuid in
> BaseMemoryLib
>
> Hello Hao,
>
> On 08/04/16 03:24, Hao Wu wrote:
> > The patch series will add two APIs in BaseMemoryLib:
> > 1. IsZeroBuffer()
> > The API is used to check if the contents of a buffer are all zeros.
> >
> > 2. IsZeroGuid()
> > The API is used to check if the given GUID is a zero GUID.
> >
> > In order to resolve build issues in SecurityPkg, the series will also
> > remove the internal implementation of IsZeroBuffer() in modules within
> > SecurityPkg\Tcg and use the one in BaseMemoryLib instead.
>
> (1) Do you plan to add optimized implementations of IsZeroBuffer() later
> on?
>
> For example, in QEMU, the buffer_is_zero() function has optimized
> implementations for:
> - AVX2
> - SSE2
> - AArch64
>
> I see one of the library instances is called BaseMemoryLibSse2, so an
> SSE2 optimized implementation could be possible.
>
> Also, as far as I understand the example in the QEMU code, for AArch64,
> the optimized implementation could go in all of the library instances
> that build on AArch64. (QEMU calls the vgetq_lane_u64() function -- I'm
> unsure how it would be available in edk2. Perhaps AArch64 assembly would
> be necessary.)
>
> Just an idea, of course.
I will hold this patch series and do more research on the optimized
implementations of IsZeroBuffer() for SSE2 and other library instances.
>
> (2) The edk2 tree contains a number of zero GUID comparisons:
>
> $ git grep -i -e zeroguid --and -e compareguid
>
> > BaseTools/Source/C/GenFfs/GenFfs.c:749: if (CompareGuid (&FileGuid,
> &mZeroGuid) == 0) {
> > BaseTools/Source/C/GenFv/GenFvInternalLib.c:4134: if (CompareGuid
> (&mCapDataInfo.CapGuid, &mZeroGuid) == 0) {
> > BaseTools/Source/C/GenSec/GenSec.c:854: if (CompareGuid (VendorGuid,
> &mZeroGuid) == 0) {
> > BaseTools/Source/C/GenSec/GenSec.c:900: if (CompareGuid (VendorGuid,
> &mZeroGuid) == 0) {
> > BaseTools/Source/C/GenSec/GenSec.c:1368: if ((SectType !=
> EFI_SECTION_GUID_DEFINED) && (CompareGuid (&VendorGuid,
> &mZeroGuid) != 0)) {
> > BaseTools/Source/C/GenSec/GenSec.c:1421: if (InputFileAlign != NULL &&
> (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
> >
> EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c:717:
> if (FormSetGuid == NULL || CompareGuid (FormSetGuid, &gZeroGuid)) {
> >
> EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordT
> hunk/Translate.c:85: for (; !CompareGuid
> (&(mConversionTable[Index].SubClass), &gZeroGuid); Index++) {
> >
> EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordT
> hunk/Translate.c:96: if (CompareGuid (&(mConversionTable[Index].SubClass),
> &gZeroGuid)) {
> >
> EdkCompatibilityPkg/Sample/Tools/Source/GenAprioriFile/GenAprioriFile.c:196:
> if (CompareGuid (&GuidIn, &ZeroGuid) != 0) {
> > EdkCompatibilityPkg/Sample/Tools/Source/GenFfsFile/GenFfsFile.c:1328:
> if (CompareGuid (&SignGuid, &mZeroGuid) != 0) {
> > EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c:1348: if (CompareGuid (&File-
> >FvNameGuid, &gZeroGuid)) {
> > IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c:142:
> (CompareGuid (&FilterEntry->FilterDataRecordGuid, &gZeroGuid) ||
> > MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c:258: if
> (!CompareGuid (&DriverInfo->FileName, &gZeroGuid)) {
> > MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c:449: if
> (CompareGuid (PcdGetPtr (PcdDriverHealthConfigureForm), &gZeroGuid)) {
> > MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c:375: for
> (Index = 0; !CompareGuid (&DriverGuidArray[Index], &gZeroGuid); Index++) {
> > MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c:424: if
> (CompareGuid (&DriverGuidArray[0], &gZeroGuid)) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Expression.c:2832: } else if
> (CompareGuid (&OpCode->Guid, &gZeroGuid) != 0) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:361: if
> (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:376: if
> ((!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) || (Statement-
> >RefreshInterval != 0)) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:631: if
> (!CompareGuid (&gCurrentSelection->Form->RefreshGuid, &gZeroGuid)) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c:1413: } else if
> (!CompareGuid (&Statement->HiiValue.Value.ref.FormSetGuid, &gZeroGuid)) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Setup.c:184: if
> (CompareGuid (&MenuList->FormSetGuid, &gZeroGuid)) {
> > MdeModulePkg/Universal/SetupBrowserDxe/Setup.c:5659: if
> (CompareGuid (FormSetGuid, &gZeroGuid) ||
> > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c:376: if
> (CompareGuid (&VendorGuid, &gZeroGuid)) {
> >
> SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c:205:
> if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
> >
> SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c:241:
> if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
> > SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c:205:
> if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
> > SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c:239:
> if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) {
>
> Do you plan to migrate these source files to the new IsZeroGuid()
> function?
>
> (There might be more -- "zeroguid" and "compareguid" could be on
> different lines, so perhaps it's better to search for just "zeroguid",
> and audit each location separately.)
Yes, we plan to replace the usages of "compareguid with zeroguid" with
the new API. It will be done independently by another patch later.
For the above-listed results, I think we won't handle the cases used in
tools. Since these codes won't be able to use the BaseMemoryLib.
>
> (3) I think patch #3 should be implemented differently -- I believe the
> current series can break bisection between patch #2 and patch #3.
>
> I suggest to first rename the IsZeroBuffer() functions in
> SecurityPkg/Tcg to IsZeroBufferInternal(), as patch #1.
>
> Then add IsZeroBuffer() and IsZeroGuid() to the BaseMemoryLib instances,
> as patch #2 and patch #3.
>
> Finally, switch SecurityPkg/Tcg from IsZeroBufferInternal() to
> IsZeroBuffer() in patch #4.
>
> What do you think?
Yes, I will follow this approach when sending out the next version of patch.
Best Regards,
Hao Wu
>
> Thanks
> Laszlo
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 7+ messages in thread