public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg/MtrrLib: Use SetMem instead of SetMem64 to fix hang
@ 2017-10-23  5:12 Ruiyu Ni
  2017-10-23  7:11 ` Dong, Eric
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-10-23  5:12 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong

ClearMasks and OrMasks are not 8-byte aligned.
But SetMem64 requires the input address is 8-byte aligned.
If the input is not 8-byte aligned, assertion is hit.
Use SetMem instead.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
index 200becdd4a..8e46e46cd4 100644
--- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
+++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
@@ -2123,8 +2123,8 @@ MtrrLibSetBelow1MBMemoryAttribute (
   //
   // (Value & ~0 | 0) still equals to (Value)
   //
-  SetMem64 (ClearMasks, sizeof (ClearMasks), 0);
-  SetMem64 (OrMasks, sizeof (OrMasks), 0);
+  SetMem (ClearMasks, sizeof (ClearMasks), 0);
+  SetMem (OrMasks, sizeof (OrMasks), 0);
 
   MsrIndex = (UINT32)-1;
   while ((BaseAddress < BASE_1MB) && (Length != 0)) {
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UefiCpuPkg/MtrrLib: Use SetMem instead of SetMem64 to fix hang
  2017-10-23  5:12 [PATCH] UefiCpuPkg/MtrrLib: Use SetMem instead of SetMem64 to fix hang Ruiyu Ni
@ 2017-10-23  7:11 ` Dong, Eric
  0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eric @ 2017-10-23  7:11 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org

Reviewed-by: Eric Dong <eric.dong@intel.com>

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Monday, October 23, 2017 1:12 PM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>
> Subject: [PATCH] UefiCpuPkg/MtrrLib: Use SetMem instead of SetMem64 to
> fix hang
> 
> ClearMasks and OrMasks are not 8-byte aligned.
> But SetMem64 requires the input address is 8-byte aligned.
> If the input is not 8-byte aligned, assertion is hit.
> Use SetMem instead.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> ---
>  UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> index 200becdd4a..8e46e46cd4 100644
> --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> @@ -2123,8 +2123,8 @@ MtrrLibSetBelow1MBMemoryAttribute (
>    //
>    // (Value & ~0 | 0) still equals to (Value)
>    //
> -  SetMem64 (ClearMasks, sizeof (ClearMasks), 0);
> -  SetMem64 (OrMasks, sizeof (OrMasks), 0);
> +  SetMem (ClearMasks, sizeof (ClearMasks), 0);  SetMem (OrMasks, sizeof
> + (OrMasks), 0);
> 
>    MsrIndex = (UINT32)-1;
>    while ((BaseAddress < BASE_1MB) && (Length != 0)) {
> --
> 2.12.2.windows.2



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-23  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-23  5:12 [PATCH] UefiCpuPkg/MtrrLib: Use SetMem instead of SetMem64 to fix hang Ruiyu Ni
2017-10-23  7:11 ` Dong, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox