]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg DxeCore: Enhance "ConvertPages: Incompatible memory types"
authorStar Zeng <star.zeng@intel.com>
Thu, 10 Aug 2017 01:30:42 +0000 (09:30 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 14 Aug 2017 08:46:03 +0000 (16:46 +0800)
When double free pages by FreePages() or allocate allocated pages by
AllocatePages() with AllocateAddress type, the code will print debug
message "ConvertPages: Incompatible memory types", but the debug
message is not very obvious for the error paths by FreePages() or
AllocatePages().

Refer https://lists.01.org/pipermail/edk2-devel/2017-August/013075.html
for the discussion.

This patch is to enhance the debug message for the error paths by
FreePages() or AllocatePages.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Core/Dxe/Mem/Page.c

index 3b3b9a8131a2a0c35fb7f09dfb41dcc873821f5f..a142c79ee2cabd0faea99a54ce79f7637177b6f3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Memory page management functions.\r
 \r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -788,7 +788,12 @@ CoreConvertPagesEx (
       // Debug code - verify conversion is allowed\r
       //\r
       if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) {\r
-        DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types\n"));\r
+        DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types, "));\r
+        if (Entry->Type == EfiConventionalMemory) {\r
+          DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "the pages to free have been freed\n"));\r
+        } else {\r
+          DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "the pages to allocate have been allocated\n"));\r
+        }\r
         return EFI_NOT_FOUND;\r
       }\r
 \r