public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress()
@ 2018-01-10  5:45 Liming Gao
  2018-01-10  5:47 ` Zeng, Star
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2018-01-10  5:45 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

Section data alignment should be made in the build generation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index f4d7528..178bac4 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -708,18 +708,13 @@ Decompress (
         return EFI_OUT_OF_RESOURCES;
       }
       //
-      // Allocate destination buffer, extra one page for adjustment 
+      // Allocate destination buffer
       //
-      DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
+      DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
       if (DstBuffer == NULL) {
         return EFI_OUT_OF_RESOURCES;
       }
       //
-      // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header
-      // to make section data at page alignment.
-      //
-      DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
-      //
       // Call decompress function
       //
       Status = UefiDecompress (
@@ -749,16 +744,11 @@ Decompress (
     // Allocate destination buffer
     //
     DstBufferSize = UncompressedLength;
-    DstBuffer     = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
+    DstBuffer     = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
     if (DstBuffer == NULL) {
       return EFI_OUT_OF_RESOURCES;
     }
     //
-    // Adjust DstBuffer offset, skip EFI section header
-    // to make section data at page alignment.
-    //
-    DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
-    //
     // stream is not actually compressed, just encapsulated.  So just copy it.
     //
     CopyMem (DstBuffer, CompressionSource, DstBufferSize);
-- 
2.8.0.windows.1



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

* Re: [Patch] MdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress()
  2018-01-10  5:45 [Patch] MdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress() Liming Gao
@ 2018-01-10  5:47 ` Zeng, Star
  0 siblings, 0 replies; 2+ messages in thread
From: Zeng, Star @ 2018-01-10  5:47 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org; +Cc: Zeng, Star

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


Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Wednesday, January 10, 2018 1:46 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [Patch] MdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress()

Section data alignment should be made in the build generation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index f4d7528..178bac4 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -708,18 +708,13 @@ Decompress (
         return EFI_OUT_OF_RESOURCES;
       }
       //
-      // Allocate destination buffer, extra one page for adjustment 
+      // Allocate destination buffer
       //
-      DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
+      DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
       if (DstBuffer == NULL) {
         return EFI_OUT_OF_RESOURCES;
       }
       //
-      // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header
-      // to make section data at page alignment.
-      //
-      DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
-      //
       // Call decompress function
       //
       Status = UefiDecompress (
@@ -749,16 +744,11 @@ Decompress (
     // Allocate destination buffer
     //
     DstBufferSize = UncompressedLength;
-    DstBuffer     = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
+    DstBuffer     = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
     if (DstBuffer == NULL) {
       return EFI_OUT_OF_RESOURCES;
     }
     //
-    // Adjust DstBuffer offset, skip EFI section header
-    // to make section data at page alignment.
-    //
-    DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
-    //
     // stream is not actually compressed, just encapsulated.  So just copy it.
     //
     CopyMem (DstBuffer, CompressionSource, DstBufferSize);
-- 
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2018-01-10  5:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10  5:45 [Patch] MdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress() Liming Gao
2018-01-10  5:47 ` Zeng, Star

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