On Mon, Oct 28, 2013 at 01:04:33PM +0100, Laszlo Ersek wrote:
> SVN r14770 ("OvmfPkg/PlatformPei: correctly align emulated NV storage")
> made sure the emulated NV storage was allocated with correct alignment.
> 
> However, the AllocateRuntimePool() -> AllocateAlignedPages() change
> flipped the memory type from EfiRuntimeServicesData to
> EfiBootServicesData. This causes variable services to access freed storage
> at runtime. It crashes Windows 2008 R2 early at boot, for example.
> 
> Keep the alignment, but restore the memory type to EfiRuntimeServicesData,
> by calling AllocateAlignedRuntimePages().
> 
> These helper functions are implemeted and documented in
> "MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c".
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <ler...@redhat.com>

Thanks!

> ---
>  OvmfPkg/PlatformPei/Platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
> index 1d9e93f..fb56e99 100644
> --- a/OvmfPkg/PlatformPei/Platform.c
> +++ b/OvmfPkg/PlatformPei/Platform.c
> @@ -287,7 +287,7 @@ ReserveEmuVariableNvStore (
>    //
>    VariableStore =
>      (EFI_PHYSICAL_ADDRESS)(UINTN)
> -      AllocateAlignedPages (
> +      AllocateAlignedRuntimePages (
>          EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)),
>          PcdGet32 (PcdFlashNvStorageFtwSpareSize)
>          );
> -- 
> 1.8.3.1

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&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