diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-11-30 12:28:27 +0100 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-12-03 15:55:35 +0100 |
commit | aa1097921d7581a8a9c527d5beb3d9d97c731f7e (patch) | |
tree | d07a5d16ace59c2d62f840b9f6b595f7b62e9507 /ArmPkg/Library/ArmMmuLib | |
parent | 36a87fec6879b4bd96de88a7234f9a98c69af8e1 (diff) | |
download | edk2-aa1097921d7581a8a9c527d5beb3d9d97c731f7e.tar.gz edk2-aa1097921d7581a8a9c527d5beb3d9d97c731f7e.tar.bz2 edk2-aa1097921d7581a8a9c527d5beb3d9d97c731f7e.zip |
ArmPkg/ArmMmuLib ARM: handle unmapped sections when updating permissions
The ARM ArmMmuLib code currently does not take into account that
setting permissions on a region should take into account that a
region may not be mapped yet to begin with.
So when updating a section descriptor whose old value is zero,
pass in the address explicitly.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPkg/Library/ArmMmuLib')
-rw-r--r-- | ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index ec51e072ab..889b22867d 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -695,8 +695,12 @@ UpdateSectionEntries ( } else {
// still a section entry
- // mask off appropriate fields
- Descriptor = CurrentDescriptor & ~EntryMask;
+ if (CurrentDescriptor != 0) {
+ // mask off appropriate fields
+ Descriptor = CurrentDescriptor & ~EntryMask;
+ } else {
+ Descriptor = ((UINTN)FirstLevelIdx + i) << TT_DESCRIPTOR_SECTION_BASE_SHIFT;
+ }
// mask in new attributes and/or permissions
Descriptor |= EntryValue;
|