[edk2] [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.

Fu Siyuan posted 1 patch 7 years, 1 month ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Dxe/Mem/Page.c              | 2 +-
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[edk2] [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.
Posted by Fu Siyuan 7 years, 1 month ago
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 MdeModulePkg/Core/Dxe/Mem/Page.c              | 2 +-
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index d596db7..7e8fa94 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -554,7 +554,7 @@ CoreAddMemoryDescriptor (
   CoreReleaseMemoryLock ();
 
   ApplyMemoryProtectionPolicy (EfiMaxMemoryType, Type, Start,
-    EFI_PAGES_TO_SIZE (NumberOfPages));
+    LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT));
 
   //
   // If Loading Module At Fixed Address feature is enabled. try to allocate memory with Runtime code & Boot time code type
diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
index 172d667..45f360c 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
@@ -851,7 +851,7 @@ InitializeDxeNxMemoryProtectionPolicy (
     if (Attributes != 0) {
       SetUefiImageMemoryAttributes (
         MemoryMapEntry->PhysicalStart,
-        EFI_PAGES_TO_SIZE (MemoryMapEntry->NumberOfPages),
+        LShiftU64 (MemoryMapEntry->NumberOfPages, EFI_PAGE_SHIFT),
         Attributes);
     }
     MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
-- 
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.
Posted by Zeng, Star 7 years, 1 month ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

Cc Ard.

Thanks,
Star
-----Original Message-----
From: Fu, Siyuan 
Sent: Wednesday, March 1, 2017 12:05 PM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 MdeModulePkg/Core/Dxe/Mem/Page.c              | 2 +-
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index d596db7..7e8fa94 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -554,7 +554,7 @@ CoreAddMemoryDescriptor (
   CoreReleaseMemoryLock ();
 
   ApplyMemoryProtectionPolicy (EfiMaxMemoryType, Type, Start,
-    EFI_PAGES_TO_SIZE (NumberOfPages));
+    LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT));
 
   //
   // If Loading Module At Fixed Address feature is enabled. try to allocate memory with Runtime code & Boot time code type diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
index 172d667..45f360c 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
@@ -851,7 +851,7 @@ InitializeDxeNxMemoryProtectionPolicy (
     if (Attributes != 0) {
       SetUefiImageMemoryAttributes (
         MemoryMapEntry->PhysicalStart,
-        EFI_PAGES_TO_SIZE (MemoryMapEntry->NumberOfPages),
+        LShiftU64 (MemoryMapEntry->NumberOfPages, EFI_PAGE_SHIFT),
         Attributes);
     }
     MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
--
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.
Posted by Tian, Feng 7 years, 1 month ago
Reviewed-by: Feng Tian <feng.tian@intel.com>

Thanks
Feng

-----Original Message-----
From: Zeng, Star 
Sent: Wednesday, March 1, 2017 12:13 PM
To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.

Reviewed-by: Star Zeng <star.zeng@intel.com>

Cc Ard.

Thanks,
Star
-----Original Message-----
From: Fu, Siyuan 
Sent: Wednesday, March 1, 2017 12:05 PM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 MdeModulePkg/Core/Dxe/Mem/Page.c              | 2 +-
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index d596db7..7e8fa94 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -554,7 +554,7 @@ CoreAddMemoryDescriptor (
   CoreReleaseMemoryLock ();
 
   ApplyMemoryProtectionPolicy (EfiMaxMemoryType, Type, Start,
-    EFI_PAGES_TO_SIZE (NumberOfPages));
+    LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT));
 
   //
   // If Loading Module At Fixed Address feature is enabled. try to allocate memory with Runtime code & Boot time code type diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
index 172d667..45f360c 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
@@ -851,7 +851,7 @@ InitializeDxeNxMemoryProtectionPolicy (
     if (Attributes != 0) {
       SetUefiImageMemoryAttributes (
         MemoryMapEntry->PhysicalStart,
-        EFI_PAGES_TO_SIZE (MemoryMapEntry->NumberOfPages),
+        LShiftU64 (MemoryMapEntry->NumberOfPages, EFI_PAGE_SHIFT),
         Attributes);
     }
     MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
--
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.
Posted by Ard Biesheuvel 7 years, 1 month ago
On 1 March 2017 at 04:04, Fu Siyuan <siyuan.fu@intel.com> wrote:
> Cc: Feng Tian <feng.tian@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  MdeModulePkg/Core/Dxe/Mem/Page.c              | 2 +-
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
> index d596db7..7e8fa94 100644
> --- a/MdeModulePkg/Core/Dxe/Mem/Page.c
> +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
> @@ -554,7 +554,7 @@ CoreAddMemoryDescriptor (
>    CoreReleaseMemoryLock ();
>
>    ApplyMemoryProtectionPolicy (EfiMaxMemoryType, Type, Start,
> -    EFI_PAGES_TO_SIZE (NumberOfPages));
> +    LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT));
>
>    //
>    // If Loading Module At Fixed Address feature is enabled. try to allocate memory with Runtime code & Boot time code type
> diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> index 172d667..45f360c 100644
> --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> @@ -851,7 +851,7 @@ InitializeDxeNxMemoryProtectionPolicy (
>      if (Attributes != 0) {
>        SetUefiImageMemoryAttributes (
>          MemoryMapEntry->PhysicalStart,
> -        EFI_PAGES_TO_SIZE (MemoryMapEntry->NumberOfPages),
> +        LShiftU64 (MemoryMapEntry->NumberOfPages, EFI_PAGE_SHIFT),
>          Attributes);
>      }
>      MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
> --
> 2.7.4.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel