diff options
author | Ray Ni <ray.ni@intel.com> | 2022-07-15 20:40:29 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-08-09 07:08:05 +0000 |
commit | 9f53fd4ba7ac4abe82365f310e0a4bcccc4448b3 (patch) | |
tree | 7d80278ed9c0a8d0db84ebc5784f8a6ec2b2d336 /BaseTools/Source/Python/FirmwareStorageFormat | |
parent | f4c845e46b3fb18a84c3f8ecfc6f2d4025c2ede1 (diff) | |
download | edk2-9f53fd4ba7ac4abe82365f310e0a4bcccc4448b3.tar.gz edk2-9f53fd4ba7ac4abe82365f310e0a4bcccc4448b3.tar.bz2 edk2-9f53fd4ba7ac4abe82365f310e0a4bcccc4448b3.zip |
CpuPageTableLib: Fix a bug to avoid unnecessary changing to page table
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 read-only, today's logic unnecessarily changes
the paging structure in 2 aspects:
1. When setting PageTableBaseAddress in the entry, the code clears
all attributes.
2. Even the ReadWrite bit in parent entry is not set, the code clears
the ReadWrite bit in the leaf entry.
First change is wrong. It should not change other attributes when
setting the PA.
Second change is unnecessary. Because the parent entry already
declares the whole region as read-only, there is no need to clear
ReadWrite bit in the leaf entry again.
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