Revision: 14217
          http://edk2.svn.sourceforge.net/edk2/?rev=14217&view=rev
Author:   mdkinney
Date:     2013-03-22 21:18:02 +0000 (Fri, 22 Mar 2013)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c 2013-03-20 08:35:24 UTC (rev 
14216)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c 2013-03-22 21:18:02 UTC (rev 
14217)
@@ -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 @@
     //
     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));
+      }
     }
 
     //

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to