From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C6ED99407A0 for ; Tue, 6 Feb 2024 01:20:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Lv44LugZYQEgRGa4vM4tADROJENfG5lym9XdNa47MLY=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707182443; v=1; b=VAcfLCOCjjYNKo0SopwCZFNXDw/zbIFTN04gJRi+0g8s9pBGlpBJlWaSVh9RoDcPsSI5ObIh Ak4LeFk1oShqFRNKT6A44+L9dUj4tndxTMtPktfKxgAVROnFhKKsQrHWjGDVJ9i9i3Cvrx+jckJ OaLknD2VcBIwbo2Anve51Q3s= X-Received: by 127.0.0.2 with SMTP id biIIYY7687511xf56R0WLott; Mon, 05 Feb 2024 17:20:43 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mx.groups.io with SMTP id smtpd.web10.11814.1707182442471646193 for ; Mon, 05 Feb 2024 17:20:42 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="794395" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="794395" X-Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 17:20:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="5480755" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Feb 2024 17:20:41 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 5 Feb 2024 17:20:40 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 5 Feb 2024 17:20:40 -0800 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 5 Feb 2024 17:20:40 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 5 Feb 2024 17:20:39 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvtN6hdIKTccvMwM2qVKY25V1/NrUQOZ1ZUegkRTqphwVn30F+z6km8AVwY7d0vAn/9mwNJ+ShurMPlRsZ5UsGADPzoFhc0LmwKGF8FL7Zb1Ggq9HqmdDgq1oGUrcSLO4y5KFZ5fO958WwG41Q+CnjaKSai0j9WCIN0WUYIlugxDfnDAOVWVxmN7ZkhgzWYAiPIJzdGeXD0VcV9ms9JktBITBru9zzN21HfebCyRhlqH9a0N70MBxenZ3tJYFLZ3K3cv1AyD2eekSIv2LGlAfncgQ3A3mtil1x/qLQ7znOkk9PrtJjw4jJRmwekIJR4DFgNyZEz3Rk7L5HV3FQmFhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8PiaOvwwULBjeP6OH7A1id0x1zWZgCG2FGkgQXEiXuU=; b=GW08JkBM7IeD0xIlC7iKJxNs8VusMoceMkoYCKZv4gtQB8SM4deF35dtdxHgEDYrXaGaIuVDrKTvzeidsbU79TsXJ4oLH/ji9qz4PVayIYFJ1FBaD47+ZxwGLjF2ocpOWut3dZZs3ytLh2Aiur7O/VxDeKcIMjbX0n13as22oHiSCQNhHnNhQqEWq6dIzJFVQZUuhrKLJgwUacPBk8LbSjqWRWgNmGJEblf3+RcDaLIy1cfFd0+VQ6sMbZXxWcCaEO153XppXBICAK/5LYn5tDHJTlR/IkVDo/t7PGFXMxT522lCWEN11Q0D9P0WaFZPc2mma9i291ZQ7ClUdmWQBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SN7PR11MB6749.namprd11.prod.outlook.com (2603:10b6:806:267::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.32; Tue, 6 Feb 2024 01:20:38 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::f4e6:157c:2058:8b1d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::f4e6:157c:2058:8b1d%4]) with mapi id 15.20.7249.032; Tue, 6 Feb 2024 01:20:37 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Zhou, Jianfeng" , Laszlo Ersek , "Kumar, Rahul R" , "Gerd Hoffmann" Subject: Re: [edk2-devel] [PATCH 1/3] UefiCpuPkg: Reduce and optimize access to attribute Thread-Topic: [PATCH 1/3] UefiCpuPkg: Reduce and optimize access to attribute Thread-Index: AQHaWDxUZbhR+0s7vU2QY4uNtLSZirD8hNjQ Date: Tue, 6 Feb 2024 01:20:37 +0000 Message-ID: References: <20240205140345.1437-1-dun.tan@intel.com> <20240205140345.1437-2-dun.tan@intel.com> In-Reply-To: <20240205140345.1437-2-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SN7PR11MB6749:EE_ x-ms-office365-filtering-correlation-id: 22205784-a6a7-4682-df6f-08dc26b1d37f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: uypARggK7R2VtDj8riSER9kOBxXDBWM6AI32N4siqNTMgyaXyUmrL98kk6+QqUP6ItkTexr87j69kTlwPtneMnZTrBJY2fC0UM8uUcSbdSlXO+2EJO+tT2f562YjubQXEoQcFCdk8JjbcVqzAFN/yfOPp7CypFVug/QWIu+Bor6x5HaKcQe2chzADZ+/1HYexP/jE+SFmcc4jCnZYuiL9LrKH5L/wKQts9CelnKtMrtcbGzGS61GJQq/6qSajBsQ8Q7sMMy1PHyRNN0G4wiRWdZqjHguNhk3BdhFEyYJFtfrrVmd6SGSU10fwaXWucgy7QxH9uqMhnW9qVa3AIuIO9c7ANEe7AnVkOFO/kDWKU9QFvF2iZAhbgm09RVQyyum537X5Z7C47MQzNzN8ZGmyzLGbzow7nlbe3LLEIaxrk+6+UtECdU+bqyCaPfb3m4qa86VA5zncQ+xq1X3Hb7fHLLUgVBqpfOGkXf9nqUQxz/mntVOLz/ZFYdgu54D3fKk2Qfr7ev0gZkaGkHLK7luqjiHECzfYXJU81fyyBFCyx8WDTNsp3UODabrQ6MVec/f0dT1v8KOjj6L6UypbLs9/iZqGOn+R85JC80OqQDTvDBN31N6KPBoCgeGXp1tGaW3 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/1mbXdScyEWboppy5nnJ9rSwujlZqRSbZjot7PZnrFOzhhdKA72nZ8Vyjgz9?= =?us-ascii?Q?LtjB8oCu0CvTahrBUPE4iNUcHH0MlwtIxLdP2gPbnlxCbdV7qzS/b5b8VseH?= =?us-ascii?Q?IQFvWcq4qjvh67JakLXqQd47QBn077ekju8HdMOpr3OUpzLTjs9dmIxOKpRm?= =?us-ascii?Q?Km737axBBfk1y0LqXqOSemgMJnApEvSs8RPNvOAoX/jH+Fzoq9o5S4ILbl5B?= =?us-ascii?Q?g9DyT4nZd7h+jZHdx7HaDbqQlmvUI6/8Mv+rbneg/s+R2U5ol48Xa2/nRXpc?= =?us-ascii?Q?2F7LYHb9KCVuLXyZkpHWdotB6yDXgNPbLA9HX3s1O5zUgd/YsJPRP39WOqRD?= =?us-ascii?Q?jE2KzUZOeH9dpueJv/hYxv9Io4GZkCwK2a4wICFZ1MkWbVetxiOTaoXUtaao?= =?us-ascii?Q?6wR1GoHdnoHaxqM6NONaIbn91bTNu5zorFtarnNi9yib7Aiooi63n3lJL6wl?= =?us-ascii?Q?SUSy17ynG27uLfLSkplnl/qbzEkD9qvX+k/0ft0uKKMPKfJ1+nBaFdTDQ9Bg?= =?us-ascii?Q?DQcora5qxmyAhh0KWpJqWcVyPFFN1cm+urX+fR/CSR6zJRxUpGoougQL+V8L?= =?us-ascii?Q?xpxIJVCaASfGXvzD7FHouZtrvM6hLX0aDYgfxu66Cl03yvB+qXufBiZ5tG2h?= =?us-ascii?Q?xcIbup6PgHuYJpzH9v9ZeQ04ukliR4u8I5q9Drzv95+Hoa74SoGv5eSqWpRX?= =?us-ascii?Q?OyLIfMfNF7lSctTJapGNZm9XQPtc1AjfYeOsTlzyiMvsDYprsQUOA2qqIstF?= =?us-ascii?Q?qzF3ny9Ps8pMaPrw2SlkYYcWZcpRvraYinPpqo9b4lzGiT1kmd5CwHt01CfE?= =?us-ascii?Q?3Ea9Qb6QJnl6sgHLoHg0gUviwiEZgoMRgd60Caao0dX53jrLCkC12Jg88+Mp?= =?us-ascii?Q?xzfc6n/mq3Tm1/LvtgeHXL/hC0BJ1qk0np8r0hDoZ2fPG7pgQHU+PLQ9K9B3?= =?us-ascii?Q?O/sIvjDHQgf07mBYW+z5BAHGyC8DM0p/k+xijwC+qJj7HniUMKoB+WOmWClo?= =?us-ascii?Q?aCRhFWCJgjZT9dGNEnv0j4PNz8nFkOHZuJ4TI234CKyZPSpskXI1isf8fMgt?= =?us-ascii?Q?F6yCIM+9wDxI0FKO/BadmqD8z2wtylaQpJj6sJ5t0dsMo0prK2eBJWsFbXht?= =?us-ascii?Q?v/Mm8FbMd90TyfjV2w0gcfysFXC9JGMYhDIzAlZSM/ZS7RmHFqMBu9Q4wWpf?= =?us-ascii?Q?wYOZj1l4tgP/Uc+4Yf0CJQZ6gVPIbS7ntKDTQ78g86Wcz+vMC1A7pp1/3tVp?= =?us-ascii?Q?yXNd7pEMPvadZVcacSp65+fTEh8maGKKZZnolNrhgJzga0K4jUQJ1J8SGacb?= =?us-ascii?Q?gKvjmPXFGdrzlRbJyswCJ02s7FhxwKPJVbzDh0hU0XVnzrPBLhl29hp7drKU?= =?us-ascii?Q?jKjZ1XpdA4FmQcvOikdE+P0rfhRGzE7HDEMIMde+lqpKWKlO6mPaczHc5kfW?= =?us-ascii?Q?7QNoA5O4Qf7+IZmUnAFt1yKxCeK6j3NJTDTIpgIzFPdhwnJ9cmVQNwv1bvZh?= =?us-ascii?Q?gJI+ZxipbhjcIaTufJCrGBXbdfEP/oWI5AXRDqJgamajUpuoCv8eK0c0fKg6?= =?us-ascii?Q?lZoiKIj78do/BOus/QY=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22205784-a6a7-4682-df6f-08dc26b1d37f X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2024 01:20:37.9054 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: o5+EbSlKEus9K3G+z+UQno1n5DbfGk/4hQYzkl67okQ7sLwuXcEsAaO24y8mjVYatHbbPZPbT6JfJvt7qLV2QQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6749 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ekP2bGckdPKfeVwcshZwjpN9x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=VAcfLCOC; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Tan, Dun > Sent: Monday, February 5, 2024 10:04 PM > To: devel@edk2.groups.io > Cc: Zhou, Jianfeng ; Ni, Ray ; > Laszlo Ersek ; Kumar, Rahul R > ; Gerd Hoffmann > Subject: [PATCH 1/3] UefiCpuPkg: Reduce and optimize access to attribute >=20 > From: Zhou Jianfeng >=20 > This commit is to reduce and optimize access to > attribute in CpuPageTableLib. >=20 > Unreasonable writing to attribute of page table may > leads to expection. > The assembly code for C code Pnle->Bits.Present =3D > Attribute->Bits.Present looks like: > and dword [rcx], 0xfffffffe > and eax, 0x1 > or [rcx], eax > In case Pnle->Bits.Present and Attribute->Bits.Present > is 1, Pnle->Bits.Present will be set to 0 for short > time(2 instructions) which is unexpected. If some other > core is accessing the page, it may leads to expection. > This change reduce and optimize access to attribute of > page table, attribute of page table is set only when it > need to be changed. >=20 > Signed-off-by: Zhou Jianfeng > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Rahul Kumar > Cc: Gerd Hoffmann > --- > UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 86 > +++++++++++++++++++++++++++++++++++++++++++++++++++++--------- > ------------------------ > 1 file changed, 53 insertions(+), 33 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > index 36b2c4e6a3..ae4caf8dfe 100644 > --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > @@ -26,52 +26,59 @@ PageTableLibSetPte4K ( > IN IA32_MAP_ATTRIBUTE *Mask > ) > { > + IA32_PTE_4K LocalPte4K; > + > + LocalPte4K.Uint64 =3D Pte4K->Uint64; > if (Mask->Bits.PageTableBaseAddressLow || Mask- > >Bits.PageTableBaseAddressHigh) { > - Pte4K->Uint64 =3D (IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS > (Attribute) + Offset) | (Pte4K->Uint64 & > ~IA32_PE_BASE_ADDRESS_MASK_40); > + LocalPte4K.Uint64 =3D > (IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS (Attribute) + Offset) | > (Pte4K->Uint64 & ~IA32_PE_BASE_ADDRESS_MASK_40); > } >=20 > if (Mask->Bits.Present) { > - Pte4K->Bits.Present =3D Attribute->Bits.Present; > + LocalPte4K.Bits.Present =3D Attribute->Bits.Present; > } >=20 > if (Mask->Bits.ReadWrite) { > - Pte4K->Bits.ReadWrite =3D Attribute->Bits.ReadWrite; > + LocalPte4K.Bits.ReadWrite =3D Attribute->Bits.ReadWrite; > } >=20 > if (Mask->Bits.UserSupervisor) { > - Pte4K->Bits.UserSupervisor =3D Attribute->Bits.UserSupervisor; > + LocalPte4K.Bits.UserSupervisor =3D Attribute->Bits.UserSupervisor; > } >=20 > if (Mask->Bits.WriteThrough) { > - Pte4K->Bits.WriteThrough =3D Attribute->Bits.WriteThrough; > + LocalPte4K.Bits.WriteThrough =3D Attribute->Bits.WriteThrough; > } >=20 > if (Mask->Bits.CacheDisabled) { > - Pte4K->Bits.CacheDisabled =3D Attribute->Bits.CacheDisabled; > + LocalPte4K.Bits.CacheDisabled =3D Attribute->Bits.CacheDisabled; > } >=20 > if (Mask->Bits.Accessed) { > - Pte4K->Bits.Accessed =3D Attribute->Bits.Accessed; > + LocalPte4K.Bits.Accessed =3D Attribute->Bits.Accessed; > } >=20 > if (Mask->Bits.Dirty) { > - Pte4K->Bits.Dirty =3D Attribute->Bits.Dirty; > + LocalPte4K.Bits.Dirty =3D Attribute->Bits.Dirty; > } >=20 > if (Mask->Bits.Pat) { > - Pte4K->Bits.Pat =3D Attribute->Bits.Pat; > + LocalPte4K.Bits.Pat =3D Attribute->Bits.Pat; > } >=20 > if (Mask->Bits.Global) { > - Pte4K->Bits.Global =3D Attribute->Bits.Global; > + LocalPte4K.Bits.Global =3D Attribute->Bits.Global; > } >=20 > if (Mask->Bits.ProtectionKey) { > - Pte4K->Bits.ProtectionKey =3D Attribute->Bits.ProtectionKey; > + LocalPte4K.Bits.ProtectionKey =3D Attribute->Bits.ProtectionKey; > } >=20 > if (Mask->Bits.Nx) { > - Pte4K->Bits.Nx =3D Attribute->Bits.Nx; > + LocalPte4K.Bits.Nx =3D Attribute->Bits.Nx; > + } > + > + if (Pte4K->Uint64 !=3D LocalPte4K.Uint64) { > + Pte4K->Uint64 =3D LocalPte4K.Uint64; > } > } >=20 > @@ -93,54 +100,61 @@ PageTableLibSetPleB ( > IN IA32_MAP_ATTRIBUTE *Mask > ) > { > + IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE LocalPleB; > + > + LocalPleB.Uint64 =3D PleB->Uint64; > if (Mask->Bits.PageTableBaseAddressLow || Mask- > >Bits.PageTableBaseAddressHigh) { > - PleB->Uint64 =3D (IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS > (Attribute) + Offset) | (PleB->Uint64 & ~IA32_PE_BASE_ADDRESS_MASK_39); > + LocalPleB.Uint64 =3D (IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS > (Attribute) + Offset) | (PleB->Uint64 & ~IA32_PE_BASE_ADDRESS_MASK_39); > } >=20 > - PleB->Bits.MustBeOne =3D 1; > + LocalPleB.Bits.MustBeOne =3D 1; >=20 > if (Mask->Bits.Present) { > - PleB->Bits.Present =3D Attribute->Bits.Present; > + LocalPleB.Bits.Present =3D Attribute->Bits.Present; > } >=20 > if (Mask->Bits.ReadWrite) { > - PleB->Bits.ReadWrite =3D Attribute->Bits.ReadWrite; > + LocalPleB.Bits.ReadWrite =3D Attribute->Bits.ReadWrite; > } >=20 > if (Mask->Bits.UserSupervisor) { > - PleB->Bits.UserSupervisor =3D Attribute->Bits.UserSupervisor; > + LocalPleB.Bits.UserSupervisor =3D Attribute->Bits.UserSupervisor; > } >=20 > if (Mask->Bits.WriteThrough) { > - PleB->Bits.WriteThrough =3D Attribute->Bits.WriteThrough; > + LocalPleB.Bits.WriteThrough =3D Attribute->Bits.WriteThrough; > } >=20 > if (Mask->Bits.CacheDisabled) { > - PleB->Bits.CacheDisabled =3D Attribute->Bits.CacheDisabled; > + LocalPleB.Bits.CacheDisabled =3D Attribute->Bits.CacheDisabled; > } >=20 > if (Mask->Bits.Accessed) { > - PleB->Bits.Accessed =3D Attribute->Bits.Accessed; > + LocalPleB.Bits.Accessed =3D Attribute->Bits.Accessed; > } >=20 > if (Mask->Bits.Dirty) { > - PleB->Bits.Dirty =3D Attribute->Bits.Dirty; > + LocalPleB.Bits.Dirty =3D Attribute->Bits.Dirty; > } >=20 > if (Mask->Bits.Pat) { > - PleB->Bits.Pat =3D Attribute->Bits.Pat; > + LocalPleB.Bits.Pat =3D Attribute->Bits.Pat; > } >=20 > if (Mask->Bits.Global) { > - PleB->Bits.Global =3D Attribute->Bits.Global; > + LocalPleB.Bits.Global =3D Attribute->Bits.Global; > } >=20 > if (Mask->Bits.ProtectionKey) { > - PleB->Bits.ProtectionKey =3D Attribute->Bits.ProtectionKey; > + LocalPleB.Bits.ProtectionKey =3D Attribute->Bits.ProtectionKey; > } >=20 > if (Mask->Bits.Nx) { > - PleB->Bits.Nx =3D Attribute->Bits.Nx; > + LocalPleB.Bits.Nx =3D Attribute->Bits.Nx; > + } > + > + if (PleB->Uint64 !=3D LocalPleB.Uint64) { > + PleB->Uint64 =3D LocalPleB.Uint64; > } > } >=20 > @@ -186,24 +200,27 @@ PageTableLibSetPnle ( > IN IA32_MAP_ATTRIBUTE *Mask > ) > { > + IA32_PAGE_NON_LEAF_ENTRY LocalPnle; > + > + LocalPnle.Uint64 =3D Pnle->Uint64; > if (Mask->Bits.Present) { > - Pnle->Bits.Present =3D Attribute->Bits.Present; > + LocalPnle.Bits.Present =3D Attribute->Bits.Present; > } >=20 > if (Mask->Bits.ReadWrite) { > - Pnle->Bits.ReadWrite =3D Attribute->Bits.ReadWrite; > + LocalPnle.Bits.ReadWrite =3D Attribute->Bits.ReadWrite; > } >=20 > if (Mask->Bits.UserSupervisor) { > - Pnle->Bits.UserSupervisor =3D Attribute->Bits.UserSupervisor; > + LocalPnle.Bits.UserSupervisor =3D Attribute->Bits.UserSupervisor; > } >=20 > if (Mask->Bits.Nx) { > - Pnle->Bits.Nx =3D Attribute->Bits.Nx; > + LocalPnle.Bits.Nx =3D Attribute->Bits.Nx; > } >=20 > - Pnle->Bits.Accessed =3D 0; > - Pnle->Bits.MustBeZero =3D 0; > + LocalPnle.Bits.Accessed =3D 0; > + LocalPnle.Bits.MustBeZero =3D 0; >=20 > // > // Set the attributes (WT, CD, A) to 0. > @@ -211,8 +228,11 @@ PageTableLibSetPnle ( > // So, it implictly requires PAT[0] is Write Back. > // Create a new parameter if caller requires to use a different memory= type > for accessing page directories. > // > - Pnle->Bits.WriteThrough =3D 0; > - Pnle->Bits.CacheDisabled =3D 0; > + LocalPnle.Bits.WriteThrough =3D 0; > + LocalPnle.Bits.CacheDisabled =3D 0; > + if (Pnle->Uint64 !=3D LocalPnle.Uint64) { > + Pnle->Uint64 =3D LocalPnle.Uint64; > + } > } >=20 > /** > -- > 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115130): https://edk2.groups.io/g/devel/message/115130 Mute This Topic: https://groups.io/mt/104176232/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-