From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.7469.1679290461311870555 for ; Sun, 19 Mar 2023 22:34:23 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=lQSkuT2k; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679290463; x=1710826463; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5K6kFrdwfdKGdudmpyp68mbioH9Spxt6xMkxRrQGWHs=; b=lQSkuT2k+03dVmZ7RB3YttbA1NEEHvNrE1tROX8ABIaUhVZECYxIJRLA lxgRJ6+OsIr1Z14E1Fk3gAZxNaSVvI5SEgXKGfWVGCPLfJWdhF+p8sew0 sDHjGfwMkPzvJAzrqSCGv2ZivlHax8Sz5F87Ktm9kjf7Dc2herGF4rRRb dDnk9/OjiozWBU/UIaTqa38u7wATMw7Eol+JJk/CgfPQbXeT5XnvZe+nD qd0Jfh4Eeyyh+0Brq6mZhxHfsIUg2DVILIIZXBQmCgel/QdXR8Hcmd+m1 cDc9qbdvJi5/+ZEitnAqrazcEDd2OdP54nJc90SewPGDPJzU4aLuWWMyQ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="401155411" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="401155411" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2023 22:34:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="770059307" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="770059307" Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.92]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2023 22:34:22 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [Patch V3 01/18] UefiCpuPkg/CpuPageTableLib: Remove unneeded 'if' condition Date: Mon, 20 Mar 2023 13:33:12 +0800 Message-Id: <20230320053329.410-2-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20230320053329.410-1-dun.tan@intel.com> References: <20230320053329.410-1-dun.tan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Eric Dong Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c index 37713ec659..52535e5a8d 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c @@ -1,7 +1,7 @@ /** @file This library implements CpuPageTableLib that are generic for IA32 family CPU. - Copyright (c) 2022, Intel Corporation. All rights reserved.
+ Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.
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. // 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. - 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 (Modify) { ParentPagingEntry->Pnle.Bits.ReadWrite = 1; -- 2.31.1.windows.1