+ if (mMemoryAttributesTable != NULL) {\r
+ FreePool (mMemoryAttributesTable);\r
+ }\r
+ mMemoryAttributesTable = MemoryAttributesTable; \r
+}\r
+\r
+/**\r
+ Install MemoryAttributesTable on memory allocation.\r
+\r
+ @param[in] MemoryType EFI memory type.\r
+**/\r
+VOID\r
+InstallMemoryAttributesTableOnMemoryAllocation (\r
+ IN EFI_MEMORY_TYPE MemoryType\r
+ )\r
+{\r
+ //\r
+ // Install MemoryAttributesTable after ReadyToBoot on runtime memory allocation.\r
+ //\r
+ if (mMemoryAttributesTableReadyToBoot &&\r
+ ((MemoryType == EfiRuntimeServicesCode) || (MemoryType == EfiRuntimeServicesData))) {\r
+ InstallMemoryAttributesTable ();\r
+ }\r
+}\r
+\r
+/**\r
+ Install MemoryAttributesTable on ReadyToBoot.\r
+\r
+ @param[in] Event The Event this notify function registered to.\r
+ @param[in] Context Pointer to the context data registered to the Event.\r
+**/\r
+VOID\r
+EFIAPI\r
+InstallMemoryAttributesTableOnReadyToBoot (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ InstallMemoryAttributesTable ();\r
+ mMemoryAttributesTableReadyToBoot = TRUE; \r