summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2013-08-18 07:03:51 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-18 07:03:51 +0000
commit4388b0ee0c87e88071b1056429c8294305f36d1b (patch)
treefc3ff4fd5cd1ebb05e2773ae0a672b8fb988cf26
parentb9349596f69528a97fdf809ed868fd0e0e11920b (diff)
downloadedk2-platforms-4388b0ee0c87e88071b1056429c8294305f36d1b.tar.xz
OvmfPkg: allocate the EFI memory map for Linux as Loader Data
In Linux, efi_memblock_x86_reserve_range() and efi_reserve_boot_services() expect that whoever allocates the EFI memmap allocates it in Loader Data type memory. Linux's own exit_boot()-->low_alloc() complies, but SetupLinuxMemmap() in LoadLinuxLib doesn't. The memory type discrepancy leads to efi_memblock_x86_reserve_range() and efi_reserve_boot_services() both trying to reserve the range backing the memmap, resulting in memmap entry truncation in efi_reserve_boot_services(). This fix also makes this allocation consistent with all other persistent allocations in "OvmfPkg/Library/LoadLinuxLib/Linux.c". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reported-and-tested-by: Borislav Petkov <bp@suse.de> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14555 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--OvmfPkg/Library/LoadLinuxLib/Linux.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/OvmfPkg/Library/LoadLinuxLib/Linux.c b/OvmfPkg/Library/LoadLinuxLib/Linux.c
index cd673aa087..4a3e2c13cb 100644
--- a/OvmfPkg/Library/LoadLinuxLib/Linux.c
+++ b/OvmfPkg/Library/LoadLinuxLib/Linux.c
@@ -280,8 +280,12 @@ SetupLinuxMemmap (
// Enlarge space here, because we will allocate pool now.
//
MemoryMapSize += EFI_PAGE_SIZE;
- MemoryMap = AllocatePool (MemoryMapSize);
- ASSERT (MemoryMap != NULL);
+ Status = gBS->AllocatePool (
+ EfiLoaderData,
+ MemoryMapSize,
+ (VOID **) &MemoryMap
+ );
+ ASSERT_EFI_ERROR (Status);
//
// Get System MemoryMap