ASSERT_LOCKED (&gMemoryLock);\r
\r
DEBUG ((DEBUG_PAGE, "AddRange: %lx-%lx to %d\n", Start, End, Type));\r
-\r
+ \r
+ //\r
+ // If memory of type EfiConventionalMemory is being added that includes the page \r
+ // starting at address 0, then zero the page starting at address 0. This has \r
+ // two benifits. It helps find NULL pointer bugs and it also maximizes \r
+ // compatibility with operating systems that may evaluate memory in this page \r
+ // for legacy data structures. If memory of any other type is added starting \r
+ // at address 0, then do not zero the page at address 0 because the page is being \r
+ // used for other purposes.\r
+ // \r
+ if (Type == EfiConventionalMemory && Start == 0 && (End >= EFI_PAGE_SIZE - 1)) {\r
+ SetMem ((VOID *)(UINTN)Start, EFI_PAGE_SIZE, 0);\r
+ }\r
+ \r
//\r
// Memory map being altered so updated key\r
//\r