Laszlo:
  In EDKII implementation, StackHob is created in PeiCore by BuildStackHob() 
API. And, PeiHobLib instance in MdePkg implements BuildStackHob() to always 
specify EfiBootServicesData for it. So, I am curious how you create the old 
StackHob with other memory type, such as EfiACPIMemoryNVS. 

Thanks
Liming
-----Original Message-----
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, December 10, 2013 11:56 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] [RFC v2 18/24] MdeModulePkg: DxeLoad: UpdateStackHob(): honor 
original allocation type

The unique Stack HOB describes the initial memory area used as stack and PEI 
heap.

UpdateStackHob() -- called by the various platforms' HandOffToDxeCore() 
functions -- modifies this HOB before it is passed to the DXE phase. The
UpdateStackHob() function repoints the Stack HOB at the memory area that the 
DXE phase will actually use as stack.

However, as the function explains, the original area must be kept around as 
well (DXE must not reclaim it), because  "some PEIMs may [...] keep key 
information on the stack". For this end, UpdateStackHob() creates a new memory 
allocation HOB that covers the original area.

Currently, the new memory allocation HOB doesn't honor / mirror the original 
memory allocation type; it describes the old area invariably as 
EfiBootServicesData. Normally this is alright, but it causes problems if the 
original stack area was destined for a lifetime longer than 
EfiBootServicesData, for example EfiACPIMemoryNVS.

Change UpdateStackHob() so that it preserves not only the boundaries of the 
original area, but its allocation type too, in the new HOB.

The patch makes no visible difference if the original allocation type too was 
EfiBootServicesData.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c 
b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index aa05076..a67aa88 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -743,13 +743,14 @@ UpdateStackHob (
       BuildMemoryAllocationHob (
         Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress,
         Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength,
-        EfiBootServicesData
+        Hob.MemoryAllocationStack->AllocDescriptor.MemoryType
         );
       //
       // Update the BSP Stack Hob to reflect the new stack info.
       //
       Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress = 
BaseAddress;
       Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength = Length;
+      Hob.MemoryAllocationStack->AllocDescriptor.MemoryType = 
+ EfiBootServicesData;
       break;
     }
     Hob.Raw = GET_NEXT_HOB (Hob);
--
1.8.3.1



------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to