From 9a701955a55d094e93c3613a3ae462660551d592 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Thu, 10 Aug 2017 09:30:42 +0800 Subject: [PATCH] MdeModulePkg DxeCore: Enhance "ConvertPages: Incompatible memory types" 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 Cc: Andrew Fish Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Liming Gao --- MdeModulePkg/Core/Dxe/Mem/Page.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 3b3b9a8131..a142c79ee2 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 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
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 @@ -788,7 +788,12 @@ CoreConvertPagesEx ( // Debug code - verify conversion is allowed // if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) { - DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types\n")); + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types, ")); + if (Entry->Type == EfiConventionalMemory) { + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "the pages to free have been freed\n")); + } else { + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "the pages to allocate have been allocated\n")); + } return EFI_NOT_FOUND; } -- 2.39.2