UefiCpuPkg/CpuPageTableLib: Remove unneeded 'if' condition

Remove unneeded 'if' condition in CpuPageTableLib code.
The deleted code is in the code branch for present non-leaf parent
entry. So the 'if' check for (ParentPagingEntry->Pnle.Bits.Present
== 0) is always FALSE.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Dun Tan
2023-03-03 15:39:41 +08:00
committed by mergify[bot]
parent d55d73152e
commit da3dad181e

View File

@ -1,7 +1,7 @@
/** @file /** @file
This library implements CpuPageTableLib that are generic for IA32 family CPU. This library implements CpuPageTableLib that are generic for IA32 family CPU.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -375,15 +375,6 @@ PageTableLibMapInLevel (
// we need to change PDPTE[0].ReadWrite = 1 and let all PDE[0-255].ReadWrite = 0 in this step. // we need to change PDPTE[0].ReadWrite = 1 and let all PDE[0-255].ReadWrite = 0 in this step.
// when PDPTE[0].Nx = 1 but caller wants to map [0-2MB] as Nx = 0 (PDT[0].Nx = 0) // when PDPTE[0].Nx = 1 but caller wants to map [0-2MB] as Nx = 0 (PDT[0].Nx = 0)
// we need to change PDPTE[0].Nx = 0 and let all PDE[0-255].Nx = 1 in this step. // we need to change PDPTE[0].Nx = 0 and let all PDE[0-255].Nx = 1 in this step.
if ((ParentPagingEntry->Pnle.Bits.Present == 0) && (Mask->Bits.Present == 1) && (Attribute->Bits.Present == 1)) {
if (Modify) {
ParentPagingEntry->Pnle.Bits.Present = 1;
}
ChildAttribute.Bits.Present = 0;
ChildMask.Bits.Present = 1;
}
if ((ParentPagingEntry->Pnle.Bits.ReadWrite == 0) && (Mask->Bits.ReadWrite == 1) && (Attribute->Bits.ReadWrite == 1)) { if ((ParentPagingEntry->Pnle.Bits.ReadWrite == 0) && (Mask->Bits.ReadWrite == 1) && (Attribute->Bits.ReadWrite == 1)) {
if (Modify) { if (Modify) {
ParentPagingEntry->Pnle.Bits.ReadWrite = 1; ParentPagingEntry->Pnle.Bits.ReadWrite = 1;