From bf581dc3ce8575539424700409ee169af0fc6d2e 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 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;