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
This commit is contained in:
mdkinney 2013-03-22 21:18:02 +00:00
parent fdc4b0b147
commit 9a34087280
1 changed files with 13 additions and 2 deletions

View File

@ -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));
}
}
//