/** @file\r
UEFI Memory page management functions.\r
\r
-Copyright (c) 2007 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2007 - 2010, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
//\r
// If Loading Module At Fixed Address feature is enabled. try to allocate memory with Runtime code & Boot time code type\r
//\r
- if (FixedPcdGet64(PcdLoadModuleAtFixAddressEnable) != 0) {\r
+ if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0) {\r
CoreLoadingFixedAddressHook();\r
}\r
\r
// Add our new range in\r
//\r
CoreAddRange (NewType, Start, RangeEnd, Attribute);\r
+ if (NewType == EfiConventionalMemory) {\r
+ DEBUG_CLEAR_MEMORY ((VOID *)(UINTN)Start, RangeEnd - Start + 1);\r
+ }\r
\r
//\r
// Move any map descriptor stack to general pool\r
}\r
}\r
if (Link == &gMemoryMap) {\r
- CoreReleaseMemoryLock ();\r
- return EFI_NOT_FOUND;\r
+ Status = EFI_NOT_FOUND;\r
+ goto Done;\r
}\r
\r
Alignment = EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT;\r
}\r
\r
if ((Memory & (Alignment - 1)) != 0) {\r
- CoreReleaseMemoryLock ();\r
- return EFI_INVALID_PARAMETER;\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Done;\r
}\r
\r
NumberOfPages += EFI_SIZE_TO_PAGES (Alignment) - 1;\r
\r
Status = CoreConvertPages (Memory, NumberOfPages, EfiConventionalMemory);\r
\r
- CoreReleaseMemoryLock ();\r
-\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Destroy the contents\r
- //\r
- if (Memory < MAX_ADDRESS) {\r
- DEBUG_CLEAR_MEMORY ((VOID *)(UINTN)Memory, NumberOfPages << EFI_PAGE_SHIFT);\r
+ goto Done;\r
}\r
\r
+Done:\r
+ CoreReleaseMemoryLock ();\r
return Status;\r
}\r
\r