From: Ard Biesheuvel Date: Thu, 8 Oct 2015 18:51:56 +0000 (+0000) Subject: ArmPkg/AArch64Mmu: use architecturally correct definitions for XN/UXN X-Git-Tag: edk2-stable201903~8778 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2afeabd1a9cee51745f51b7b51d02f19c0a36429 ArmPkg/AArch64Mmu: use architecturally correct definitions for XN/UXN The non-privileged execute never (UXN) page table bit defined for the EL1&0 translation regime and the execute never (XN) bit defined for the EL2 and EL3 translation regimes happen to share the same bit position, but they are in fact defined distinctly by the architecture. So define both bits explicitly, and add comments in places where we take advantage of the fact that they share the same bit position. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18585 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ArmPkg/Include/Chipset/AArch64Mmu.h b/ArmPkg/Include/Chipset/AArch64Mmu.h index 2398ba2539..22e492d61d 100644 --- a/ArmPkg/Include/Chipset/AArch64Mmu.h +++ b/ArmPkg/Include/Chipset/AArch64Mmu.h @@ -75,12 +75,14 @@ #define TT_AF BIT10 #define TT_PXN_MASK BIT53 -#define TT_UXN_MASK BIT54 +#define TT_UXN_MASK BIT54 // EL1&0 +#define TT_XN_MASK BIT54 // EL2 / EL3 #define TT_ATTRIBUTES_MASK ((0xFFFULL << 52) | (0x3FFULL << 2)) #define TT_TABLE_PXN BIT59 -#define TT_TABLE_XN BIT60 +#define TT_TABLE_UXN BIT60 // EL1&0 +#define TT_TABLE_XN BIT60 // EL2 / EL3 #define TT_TABLE_NS BIT63 #define TT_TABLE_AP_MASK (BIT62 | BIT61) diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c index 3765d61ccd..d82c82c202 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c @@ -335,7 +335,8 @@ GetBlockEntryListFromAddress ( if (Attributes & TT_PXN_MASK) { TableAttributes = TT_TABLE_PXN; } - if (Attributes & TT_UXN_MASK) { + // XN maps to UXN in the EL1&0 translation regime + if (Attributes & TT_XN_MASK) { TableAttributes = TT_TABLE_XN; } if (Attributes & TT_NS) {