]> git.proxmox.com Git - mirror_edk2.git/commit
ArmPkg/CpuDxe ARM: avoid splitting page table sections unnecessarily
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 2 Mar 2017 10:36:13 +0000 (10:36 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 7 Mar 2017 08:10:01 +0000 (09:10 +0100)
commitdf809efe13921326f2f8d7fc5654787b29ae8a8d
tree65347c3597b5808e096ee1eae01a82c7031aecc5
parent5b0ce08a3ee87a9d3fd3ecabfb1a94b5a209fb6c
ArmPkg/CpuDxe ARM: avoid splitting page table sections unnecessarily

Currently, any range passed to CpuArchProtocol::SetMemoryAttributes is
fully broken down into page mappings if the start or the size of the
region happens to be misaliged relative to the section size of 1 MB.

This is going to result in memory being wasted on second level page tables
when we enable strict memory permissions, given that we remap the entire
RAM space non-executable (modulo the code bits) when the CpuArchProtocol
is installed.

So refactor the code to iterate over the range in a way that ensures
that all naturally aligned section sized subregions are not broken up.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Drivers/CpuDxe/Arm/Mmu.c