From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.19850.1677837828807486048 for ; Fri, 03 Mar 2023 02:03:51 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Zu9V8S7T; spf=pass (domain: intel.com, ip: 134.134.136.126, 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=1677837831; x=1709373831; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=isXKgtBdNw9Q6Kzv6HgBeZoUtvCxe0z7lRVaArN9wvw=; b=Zu9V8S7TWpFz4PRbfTm8WsAvO2rxodqelikehHYqnMHvICT8O92BFA0j 7FoEPQMkO+Vkbtw4S97vrV3hboRYW4xan5XuZD47YmTUuwLmvSMo+tlkw QMFHGr+Jk1Jt/cDBFSPsQuP8BaJT+1wEtyMsoZieuccz8ivCp6jTm6Hyg IbcyrTV+014QX+zjPnTLZVgesAyEUK/QLq4QS32I2Tiskb0YFGRfNQqZX Zmif0ycsiAMwZ8NHkKCOTECdXMC8umARFme1oUQtuWDVitAUb/6IGqpYq J7xDkGidQFwvLJIIqLOoLrZlxyVI84kkWSfofZfYNP4blfSCF/wuhJqia w==; X-IronPort-AV: E=McAfee;i="6500,9779,10637"; a="318831650" X-IronPort-AV: E=Sophos;i="5.98,230,1673942400"; d="scan'208";a="318831650" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 02:03:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10637"; a="818420967" X-IronPort-AV: E=Sophos;i="5.98,230,1673942400"; d="scan'208";a="818420967" Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.92]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 02:03:50 -0800 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [PATCH 1/6] UefiCpuPkg/CpuPageTableLib: Remove unneeded 'if' condition Date: Fri, 3 Mar 2023 18:03:31 +0800 Message-Id: <20230303100336.2138-2-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20230303100336.2138-1-dun.tan@intel.com> References: <20230303100336.2138-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 check for (ParentPagingEntry->Pnle.Bits.Present == 0) won't is always FALSE. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c index 37713ec659..47027917d9 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c @@ -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