diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c b/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c index 8e235e03d4..ec6871207e 100644 --- a/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c +++ b/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c @@ -417,8 +417,16 @@ CpuGetMemoryAttributes ( PAGE_ATTRIBUTE PageAttribute; UINT64 *PageEntry; + ASSERT (Attributes != NULL); + GetCurrentPagingContext (&PagingContext); + if ((PagingContext.MachineType == IMAGE_FILE_MACHINE_I386) && + ((PagingContext.ContextData.Ia32.Attributes & PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE) == 0)) { + *Attributes = 0; + return EFI_UNSUPPORTED; + } + PageEntry = GetPageTableEntry (&PagingContext, Address, &PageAttribute); if (PageEntry == NULL) { *Attributes = 0;