diff options
author | Ray Ni <ray.ni@intel.com> | 2022-07-15 20:10:08 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-08-09 07:08:05 +0000 |
commit | f4c845e46b3fb18a84c3f8ecfc6f2d4025c2ede1 (patch) | |
tree | fd2bf6f15b0d62bc94c0ec24c2c0b06fd3c6648b /BaseTools/Source/Python/FirmwareStorageFormat | |
parent | c16f02f7764cba228d9c70b7985ff7276b6de4cc (diff) | |
download | edk2-f4c845e46b3fb18a84c3f8ecfc6f2d4025c2ede1.tar.gz edk2-f4c845e46b3fb18a84c3f8ecfc6f2d4025c2ede1.tar.bz2 edk2-f4c845e46b3fb18a84c3f8ecfc6f2d4025c2ede1.zip |
CpuPageTableLib: Fix parent attributes are not inherited properly
With the following paging structure that maps [0, 2G] with ReadWrite
bit set.
PML4[0] --> PDPTE[0] --> PDE[0-255]
\-> PDPTE[1] --> PDE[0-255]
If ReadWrite bit is cleared in PML4[0] and PageTableMap() is called
to change [0, 2M] as writable, today's logic doesn't inherit the
parent entry's attributes when determining the child entry's
attributes. It just sets the PDPTE[0].PDE[0].ReadWrite bit.
But since the PML4[0].ReadWrite is 0, [0, 2M] is still read-only.
The change fixes the bug.
If the inheritable attributes in ParentPagingEntry conflicts with the
requested attributes, let the child entries take the parent attributes
and loosen the attribute in the parent entry.
E.g.: when PDPTE[0].ReadWrite = 0 but caller wants to map [0-2MB as
ReadWrite = 1 (PDE[0].ReadWrite = 1), we need to change
PDPTE[0].ReadWrite = 1 and let all PDE[0-255].ReadWrite = 0 first.
Then change PDE[0].ReadWrite = 1.
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/FirmwareStorageFormat')
0 files changed, 0 insertions, 0 deletions