-UINT64\r
-GcdAttributeToPageAttribute (\r
- IN UINT64 GcdAttributes\r
- )\r
-{\r
- UINT64 PageAttributes;\r
-\r
- switch (GcdAttributes & 0xFF) {\r
- case EFI_MEMORY_UC:\r
- PageAttributes = TT_ATTR_INDX_DEVICE_MEMORY;\r
- break;\r
- case EFI_MEMORY_WC:\r
- PageAttributes = TT_ATTR_INDX_MEMORY_NON_CACHEABLE;\r
- break;\r
- case EFI_MEMORY_WT:\r
- PageAttributes = TT_ATTR_INDX_MEMORY_WRITE_THROUGH;\r
- break;\r
- case EFI_MEMORY_WB:\r
- PageAttributes = TT_ATTR_INDX_MEMORY_WRITE_BACK;\r
- break;\r
- default:\r
- DEBUG ((EFI_D_ERROR, "GcdAttributeToPageAttribute: 0x%X attributes is not supported.\n", GcdAttributes));\r
- ASSERT (0);\r
- // If no match has been found then we mark the memory as device memory.\r
- // The only side effect of using device memory should be a slow down in the performance.\r
- PageAttributes = TT_ATTR_INDX_DEVICE_MEMORY;\r
- }\r
-\r
- // Determine protection attributes\r
- if (GcdAttributes & EFI_MEMORY_WP) {\r
- // Read only cases map to write-protect\r
- PageAttributes |= TT_AP_RO_RO;\r
- }\r
-\r
- // Process eXecute Never attribute\r
- if (GcdAttributes & EFI_MEMORY_XP) {\r
- PageAttributes |= (TT_PXN_MASK | TT_UXN_MASK);\r
- }\r
-\r
- return PageAttributes;\r
-}\r
-\r