]> xenbits.xensource.com Git - ovmf.git/commitdiff
UefiCpuPkg/CpuPageTableLib: Remove unneeded 'if' condition
authorDun Tan <dun.tan@intel.com>
Fri, 3 Mar 2023 07:39:41 +0000 (15:39 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 27 Mar 2023 08:21:58 +0000 (08:21 +0000)
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>
UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c

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