- // Allocate pages for translation table. Pool allocations are 8 byte aligned,\r
- // but we may require a higher alignment based on the size of the root table.\r
- RootTableEntrySize = RootTableEntryCount * sizeof(UINT64);\r
- if (RootTableEntrySize < EFI_PAGE_SIZE / 2) {\r
- TranslationTableBuffer = AllocatePool (2 * RootTableEntrySize - 8);\r
- //\r
- // Naturally align the root table. Preserves possible NULL value\r
- //\r
- TranslationTable = (VOID *)((UINTN)(TranslationTableBuffer - 1) | (RootTableEntrySize - 1)) + 1;\r
- } else {\r
- TranslationTable = AllocatePages (1);\r
- TranslationTableBuffer = NULL;\r
- }\r