From 558889562fcafac530c88725246afd4a8c3e38f2 Mon Sep 17 00:00:00 2001 From: Mikhail Krichanov Date: Thu, 5 Dec 2024 20:46:57 +0300 Subject: [PATCH] CpuArchLib: Fixed CpuGetMemoryAttributes(). --- UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c b/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c index d24b9fb551..2d5058d6b2 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;