+ //\r
+ // Note: Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as really\r
+ // set attributes and change memory paging attribute accordingly.\r
+ // But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by\r
+ // value from Capabilities in GCD memory map. This might cause\r
+ // boot problems. Clearing all paging related capabilities can\r
+ // workaround it. Following code is supposed to be removed once\r
+ // the usage of EFI_MEMORY_DESCRIPTOR.Attribute is clarified in\r
+ // UEFI spec and adopted by both EDK-II Core and all supported\r
+ // OSs.\r
+ //\r
+ MemoryMapEnd = MemoryMap;\r
+ MemoryMap = MemoryMapStart;\r
+ while (MemoryMap < MemoryMapEnd) {\r
+ MemoryMap->Attribute &= ~(UINT64)(EFI_MEMORY_RP | EFI_MEMORY_RO |\r
+ EFI_MEMORY_XP);\r
+ MemoryMap = NEXT_MEMORY_DESCRIPTOR (MemoryMap, Size);\r
+ }\r
+\r