]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/AArch64Mmu: Fix XN attribute for device memory
authorHeyi Guo <heyi.guo@linaro.org>
Thu, 14 Apr 2016 09:24:47 +0000 (17:24 +0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 14 Apr 2016 09:38:36 +0000 (11:38 +0200)
Now XN attribute will be set automatically if the region is declared
as device memory. However, the function ArmMemoryAttributeToPageAttribute
is to get attribute for block and page descriptors, not for table
descriptors, so attribute TT_TABLE_*XN does not really take effect.

Need to use TT_*XN_MASK instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c

index b7d23c6f328621bc383d7a0965729d916e5c093f..918957d4ff4a3a236c1bbc1ca12920bef77b6695 100644 (file)
@@ -51,9 +51,9 @@ ArmMemoryAttributeToPageAttribute (
   case ARM_MEMORY_REGION_ATTRIBUTE_DEVICE:\r
   case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_DEVICE:\r
     if (ArmReadCurrentEL () == AARCH64_EL2)\r
-      return TT_ATTR_INDX_DEVICE_MEMORY | TT_TABLE_XN;\r
+      return TT_ATTR_INDX_DEVICE_MEMORY | TT_XN_MASK;\r
     else\r
-      return TT_ATTR_INDX_DEVICE_MEMORY | TT_TABLE_UXN | TT_TABLE_PXN;\r
+      return TT_ATTR_INDX_DEVICE_MEMORY | TT_UXN_MASK | TT_PXN_MASK;\r
   }\r
 }\r
 \r