From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.95185.1679637638981244777 for ; Thu, 23 Mar 2023 23:00:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=WPjhEu+/; spf=pass (domain: intel.com, ip: 192.55.52.151, 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=1679637639; x=1711173639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pw7tXVkdWxjx9W3YUF/wDPu6rCUJ/7GNuqXk7nGFEgc=; b=WPjhEu+/bpRJ7E/cvjlXIg7Jx1lLiO9coE+QALeRniOa55Nh45+53T0r RfqNymiAW1VuD6jhkJNSjQokJFMziDGrFEF8y2DgHORGR+vlkgMDgKF7E ubxavkw/qw4g9ImV+NTrvND4lQGJZSUGXa1hn3LYQ62Ukz+dFb0IulrJr zpcQ+xdmEascXHC5DgUMkGwiY4FR1Rb2g5o4rtl4K7Pb8AzqfUfUY5lDW 4B8Yv2RW21f2FKem9XHNmE+hvY57MHh+zPdc76tJVUW27JyMZSgcTcmKf /dFj1RM8ZXKnZl1SrQsw7Op0p37AOWEH2MLEZy/mlUTNuAamKBkfk6+hD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="320093831" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="320093831" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 23:00:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="1012122014" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="1012122014" Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.92]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 23:00:31 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [Patch V5 01/22] UefiCpuPkg/CpuPageTableLib: Remove unneeded 'if' condition Date: Fri, 24 Mar 2023 13:59:59 +0800 Message-Id: <20230324060020.940-2-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20230324060020.940-1-dun.tan@intel.com> References: <20230324060020.940-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 Tested-by: Gerd Hoffmann Acked-by: 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