ArmPkg/Library/CpuArchLib: Refactored ARM to UEFI attribute conversion.

This commit is contained in:
Mikhail Krichanov 2024-09-27 12:02:45 +03:00
parent f0c0984521
commit e4c26e4957
2 changed files with 3 additions and 5 deletions

View File

@ -91,7 +91,7 @@ PageAttributeToGcdAttribute (
}
// Process eXecute Never attribute
if ((PageAttributes & (TT_PXN_MASK | TT_UXN_MASK)) != 0) {
if ((PageAttributes & (TT_PXN_MASK | TT_UXN_MASK)) == (TT_PXN_MASK | TT_UXN_MASK)) {
GcdAttributes |= EFI_MEMORY_XP;
}

View File

@ -78,10 +78,8 @@ SectionToGcdAttributes (
}
// now process eXectue Never attribute
if ((((SectionAttributes & TT_DESCRIPTOR_SECTION_XN_MASK) != 0)
&& ((*GcdAttributes & EFI_MEMORY_USER) != 0))
|| (((SectionAttributes & TT_DESCRIPTOR_SECTION_PXN_MASK) != 0)
&& ((*GcdAttributes & EFI_MEMORY_USER) == 0))) {
if ((SectionAttributes & (TT_DESCRIPTOR_SECTION_XN_MASK | TT_DESCRIPTOR_SECTION_PXN_MASK))
== (TT_DESCRIPTOR_SECTION_XN_MASK | TT_DESCRIPTOR_SECTION_PXN_MASK)) {
*GcdAttributes |= EFI_MEMORY_XP;
}