From 9edb2933ab86016c724d63461e0ba866511d991a Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Tue, 29 Oct 2013 06:02:46 +0000 Subject: OvmfPkg/PlatformPei: emulated NV storage must be EfiRuntimeServicesData 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 Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14806 6f19259b-4bc3-4df7-8a09-765794883524 --- 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) ); -- cgit v1.1