summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2013-03-22 21:18:02 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2013-03-22 21:18:02 +0000
commit9a34087280a857eb0b80ff27d0efabc540b36f99 (patch)
tree8618639b4bd08d7e50f8ac119fdd42353c6d5484 /MdeModulePkg
parentfdc4b0b147b386e966e99893526181dfae9eaeef (diff)
downloadedk2-platforms-9a34087280a857eb0b80ff27d0efabc540b36f99.tar.xz
Fix a bug in the DXE Core that generates an ASSERT() when the page at address zero is freed and DEBUG_CLEAR_MEMORY() macros are enabled. If DEBUG_CLEAR_MEMORY() is enabled and the page at address 0 is freed, then DEBUG_CLEAR_MEMORY() is invoked skipping over the first 4K page.
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14217 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Page.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index 6d5a259eb6..8a6d35d6e4 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1,7 +1,7 @@
/** @file
UEFI Memory page management functions.
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -834,7 +834,18 @@ CoreConvertPages (
//
CoreAddRange (NewType, Start, RangeEnd, Attribute);
if (NewType == EfiConventionalMemory) {
- DEBUG_CLEAR_MEMORY ((VOID *)(UINTN) Start, (UINTN) (RangeEnd - Start + 1));
+ //
+ // Avoid calling DEBUG_CLEAR_MEMORY() for an address of 0 because this
+ // macro will ASSERT() if address is 0. Instead, CoreAddRange() guarantees
+ // that the page starting at address 0 is always filled with zeros.
+ //
+ if (Start == 0) {
+ if (RangeEnd > EFI_PAGE_SIZE) {
+ DEBUG_CLEAR_MEMORY ((VOID *)(UINTN) EFI_PAGE_SIZE, (UINTN) (RangeEnd - EFI_PAGE_SIZE + 1));
+ }
+ } else {
+ DEBUG_CLEAR_MEMORY ((VOID *)(UINTN) Start, (UINTN) (RangeEnd - Start + 1));
+ }
}
//