From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.3604.1663821789498008976 for ; Wed, 21 Sep 2022 21:43:09 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=PkGUhDh/; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663821789; x=1695357789; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=LN7rG6WEnF5zq0payPQcegaJj+D4p8qZqGRfmcVLL78=; b=PkGUhDh/+DBjI0hjAWV4tsDMdrrQloQNcgTeNZ/SRIdDBxbPKVlCc5Zs NTphwhocR4DRkjJdOw8QFU8Gv7g+ulTRJZ7jcir9KYU+V1ngQrd98Jhft gN8mS4v9vmPWxVnavkggoQNnTdEk0HltaPDS4EtKAvnr38QMqIVQ/wvHZ z+ba+40npFxX2HVV/G1TTFgRNHfXnloX4HLyEuIOB7u32t/kI+A02SU9X JQ2Q7NrF48ltnGPq8d0Owt0XzDLhvflJT8LgDujSSyzfXxynNrbmJozkI iWYvPdmJKO39yixWCAzqiOx5lnfOEtQCec6ARK+doI0RihOiXIDB8++dk Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10477"; a="301040333" X-IronPort-AV: E=Sophos;i="5.93,335,1654585200"; d="scan'208";a="301040333" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2022 21:43:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,335,1654585200"; d="scan'208";a="597277070" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 21 Sep 2022 21:43:08 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 21:43:09 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 21 Sep 2022 21:43:09 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) 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.2375.31; Wed, 21 Sep 2022 21:43:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M0HWaqWCZmLnceTQdG0OGQVWH16fE2b5Uc7M2wrxT5el2CAV/OJ1jRqVoR2ih83HH+sR1TzaFik8qe+RkX13AT+mqXITqayUIqAiMcFoanPKGwNVNaDkm7mr6pJ4+AQMQZRxwVm0vBG8nsFJr0fYs/3waSFsvbdD9cysBuYRaYq+2h7F+hISR9KMgqVkr+pWXxITJhH0sy7EGVXeG7DfmJZf5gqErmFE1JnsVeVyjVVvGLatf1vuCTPSvhsiU3n44TRcOvpn61jPps5SocZGDBhEMG87qcJAtI/2qeTV+1nIdwpaHwBak1r5PYrAyJFW4G25gRrxp7BTUIRCgJJ3sg== 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=elXab3xUtoo13R1wEOImeayX3L+AuY5DoDErvU4NMqI=; b=MsqWa01IysYC/xIy5W8z7TkJe5gMA4w2jYD74DlBNEAtXgKh9k6buesGy5u17FERqgAttMLulACU8kQhlFOeod3k3CotMNkk6PKrk2LoFr0vSsgqYXF05gn9RpW2cFb7MXWZeWc7acJgV505r7MKMzDuChRpf4y4y0y2iqf6O72eELcgMBALQ1iV6lYL5oClt541d3b/uJ6SAuZR7UKwfBMQneLPz8hyqwXvtUT0JQ+SwrP7ad3KYOTiqU98s8MCLil6guJXsNLhoT+eYZp+84qaFqYX9mM8zmHiXkX7SZmjEQtxLXq7Lpkls0xoPI/gh5WFHMbLVYgfYHmxEu1UvQ== 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 Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by MN0PR11MB6207.namprd11.prod.outlook.com (2603:10b6:208:3c5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 04:43:04 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::ec3f:8428:41d6:3284]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::ec3f:8428:41d6:3284%4]) with mapi id 15.20.5654.016; Thu, 22 Sep 2022 04:43:04 +0000 From: "Min Xu" To: "devel@edk2.groups.io" , Gerd Hoffmann CC: "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg: Store PageTablePool in TdxWorkArea Thread-Topic: [edk2-devel] [PATCH 1/1] OvmfPkg: Store PageTablePool in TdxWorkArea Thread-Index: AQHYwmAfAYrKTBs41EOjLRAjuKpiO63q9pIA Date: Thu, 22 Sep 2022 04:43:04 +0000 Message-ID: References: <1712727D109677C5.26635@groups.io> In-Reply-To: <1712727D109677C5.26635@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5064:EE_|MN0PR11MB6207:EE_ x-ms-office365-filtering-correlation-id: decc3dc3-cab7-454b-a04b-08da9c54f037 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nMAjW952SX3lawuGFPXpp5mcjxrDgEdkWOF9V/fevUSuFwVMDHw/TBW4mmexFaOP/cVE41+GelVNSDB29+o8IMGkxQN4mVWqML6hRXtKBN/XLLvO+Pay2jzAYUQycPoxQNWd6Wtr2SCJGlVJe9QoNRcr0LyLflYsSLlskc8oXWcLejSW7hsZ0HsJXFDq3r4nyv2WGssu1jpWxBI4yp83mb8aK2PBBYMpYkoNeBirJc0ZG99/b/LDuAvnUOYvc1feh2FMSLYWt4KmA+XA7VVEZJbsG1bHDf1dtNaLSBtI5ip4xhGAl0n26aUdqofox7i4LaWbBZAr41p1djmA4FV2lH3f++awzqtMWrMU0XisKdi881W722jPj68ERUjEhs+LXtM2S7d/9AZqKpllv2DOlHf2UdAFdTuqOxH1PmzKatNFMUkYza2Nwn9KeZyMeeJYe+MCiWRUDQ66jtmDK7+a1Igth5+KiIsezbiClZYbQ9SndlzbDsjCruZpOAeY6ofhQDurhzIa8SoDmTLQwsSsYnCQY5eTEGLmBUd8zHsU2l+THbOAfPxw1rVYk6tW8TguCoOBhPymq8aIWRtbMyF6yVd54YST6/hj78EyVTHld/D6vH0Et6DCbuZmokO3+8/sk+/iLalt5RG/hQiJhXIc/R4pTwkUig6s1QjHMuFJ/CnWL8+5mNlE45PN9FRNmnm+Iz8UCfCa2BJIZJ1mAgGvdPAw92ZQ9HD19itkrjN0l/k6+7/x+CabClaFkjJoIozbP/W860fWHN+XaK6+Zj3Onsjw+ZMDd6Yd2/cJQ9MH2BHcNIC32YUvJJL6ybEh7HS4yj6v9l/dTZDqGvG9/7b7iQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(346002)(136003)(376002)(396003)(366004)(451199015)(55016003)(54906003)(71200400001)(82960400001)(186003)(110136005)(38100700002)(86362001)(53546011)(2906002)(5660300002)(316002)(966005)(66556008)(66446008)(33656002)(9686003)(8936002)(6506007)(7696005)(76116006)(19627235002)(66946007)(478600001)(122000001)(83380400001)(52536014)(38070700005)(66476007)(41300700001)(26005)(4326008)(8676002)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QJBGO4/ujd+LXxXsCHqy8Vzc/FQcqSeGQYo1vMkj2LjxcZBoRmf31cZXYaWZ?= =?us-ascii?Q?C4EKv0BjjgXlw8D7K/4d2lKRvHzra4OLIHSH9jtSR8t7IPqzL4dRYXd8+5CF?= =?us-ascii?Q?CUYZB2UMxUpYhzRsIcDwfldhpfCkninXnlTn0/Qbf+/khjjaTV8FT5wluja0?= =?us-ascii?Q?ZKc11Y8S4AwMuUu8HVFs7c1nIZVSkTFKInsF6LxdzBZ891rJpDb7KxPyj22W?= =?us-ascii?Q?GoGwJXzbeoH84Q6UnSWOEHGDSXw23xe4f89LFYU4IaEJSffNi/18XRnGa2gc?= =?us-ascii?Q?4CQnc8I2M4NfaCRUKIioXVzBfP2X+gdNvcVaDmDV//6OJbtvXueTqZlQHE3w?= =?us-ascii?Q?ub4RzX/lf1vmxIzaQAc4h0uqaKdJlR2Hf9j+oGr/teMSnM5+QNsMBzzeoM4C?= =?us-ascii?Q?KCyrcLdA3iqOAit9iBO/cagGD5Hiw5/5ycYLmycVg3freRSjFyGyfwC58i4I?= =?us-ascii?Q?I6FevZNRnvGuFMJUIw7jPokqgPznpNSmA6m4kNQrYwtwrwCYmdSW2EnYnbdD?= =?us-ascii?Q?uXVDSoDAtDD8qRDqC/0XQPyw3nnS21lPNuM3qb+Ny18mRvzwDQwvEWV2Ix+H?= =?us-ascii?Q?7FMv2FmtgCrFX+hVeIx0mgrxCXkL3zgWjwPzATwpwhisGVBjB3EzqCzrhSGa?= =?us-ascii?Q?puycfS8Wcg9f06jTHWu0eifwFqQ4WmcFF17nHjsQ5juSW8hF0cexhJJphFFd?= =?us-ascii?Q?aAJs6xJTiyAe95xLg3vfejGFY0zdDIbC8aJ80HkooX76mo2OSy5XKouSalOA?= =?us-ascii?Q?pWvvqeonJLBMCNoo7fGoJXL5UazzyXat1IVWwnE2dqBYpH9555PZRjFYsyjL?= =?us-ascii?Q?BoptLOqj55b+wgtfgj2Tshhe+9mjKca+QO/utIUvHJkFxwFXaIQD1Zw62HJj?= =?us-ascii?Q?JaX2QKQvB8QBrYttl9Rp0+7xOZ3qNPAidhi/kKnWOBK6u2jrvrBDZkqUnQvi?= =?us-ascii?Q?IOMmkohWCg+7K8+WHjMSyQVyPTfyi73yo8fCE0SjTT6QT/YUXwuIh0jeGLkw?= =?us-ascii?Q?cU1oha+Y8czpGdlf1fKiu2uBtduHKKva4Jh14j1FvxEpELfpjnZB8zjNiuHF?= =?us-ascii?Q?iAWjHvOUHzzGNj4fX6zuQjxGxb0/7QxlFsHojszrD8HuCJT+SBo0DMoLZGif?= =?us-ascii?Q?ElIuSZYWu6aCi9KYZkNkpQRaoWwL1td6Sqe7TuemJXM99owJ0DG72sVen20v?= =?us-ascii?Q?7t0qdl8n1H3xKIGX/iZemOdoZjP2/GUfTkirV7H9ABNnv14V2YWB/AJ+Ra6V?= =?us-ascii?Q?kFrRprvsjgZsqVDFSgGHJrYgQzQwTfmt52oRWUZlOw5g3FyboryNQOlcQtW2?= =?us-ascii?Q?GlK/V/N+8lCDl8loxCLJUvN/wFCo27Oo/DFxobyTmhuv8gXHOE6FjiWO9PlP?= =?us-ascii?Q?ijCWVoF3xYpimK0+geikcgHGLXL3AaVy/bLqoVWGJuIwE/N4+tgtFzyndLH+?= =?us-ascii?Q?2vjw+6GMHl6DLnTUj0Ggw+evmE++QcQLsPKvLNSX5Z8LuqQ5j4ut0HnUYcmy?= =?us-ascii?Q?16X0mqRfkhJD3hpQa5WJ7baCfg88t1obTc0xC69sVJHdz6P/5RksRSLm9Bax?= =?us-ascii?Q?u/QC1sRZF7acv1CHkALf11QQu2KHQJabtG/qv1v4?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: decc3dc3-cab7-454b-a04b-08da9c54f037 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2022 04:43:04.7553 (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: RJ2AkZU3m0n6rRMAvCzq6SKgcIJe3QVdAQ9yZDrTU8/nyMDIIucxKqSdUdPeF/a9/ea1lYS0X8ZDbzBB/JWKxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR11MB6207 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Gerd Do you have any comments on this patch? > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Min Xu > Sent: Wednesday, September 7, 2022 10:18 AM > To: devel@edk2.groups.io > Cc: Xu, Min M ; Aktas, Erdem > ; Gerd Hoffmann ; James > Bottomley ; Yao, Jiewen ; Tom > Lendacky > Subject: [edk2-devel] [PATCH 1/1] OvmfPkg: Store PageTablePool in > TdxWorkArea >=20 > From: Min M Xu >=20 > PeilessStartupLib is running in SEC phase. In that phase global variable = is not > allowed. So the mPageTablePool cannot be used. In stead the PageTablePool > is stored in TdxWorkArea. >=20 > Cc: Erdem Aktas > Cc: Gerd Hoffmann > Cc: James Bottomley > Cc: Jiewen Yao > Cc: Tom Lendacky > Signed-off-by: Min M Xu > --- > OvmfPkg/Include/WorkArea.h | 1 + > .../PeilessStartupLib/PeilessStartupLib.inf | 1 + > .../PeilessStartupLib/X64/VirtualMemory.c | 82 +++++++++++++------ > 3 files changed, 60 insertions(+), 24 deletions(-) >=20 > diff --git a/OvmfPkg/Include/WorkArea.h b/OvmfPkg/Include/WorkArea.h > index bf56fc4a6f65..0b2fb2f8c573 100644 > --- a/OvmfPkg/Include/WorkArea.h > +++ b/OvmfPkg/Include/WorkArea.h > @@ -71,6 +71,7 @@ typedef struct _SEC_TDX_WORK_AREA { > UINT32 PageTableReady; > UINT32 Gpaw; > UINT64 HobList; > + UINT64 PageTablePool; > } SEC_TDX_WORK_AREA; >=20 > typedef struct _TDX_WORK_AREA { > diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf > b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf > index def50b4b019e..eed9f27d3d01 100644 > --- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf > +++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf > @@ -88,3 +88,4 @@ >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask > ## CONSUMES > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize > + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase > diff --git a/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c > b/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c > index 6877e521e485..7e33f044993a 100644 > --- a/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c > +++ b/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c > @@ -19,13 +19,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include #include > #include > +#include > #include "PageTables.h" >=20 > -// > -// Global variable to keep track current available memory used as page t= able. > -// > -PAGE_TABLE_POOL *mPageTablePool =3D NULL; > - > UINTN mLevelShift[5] =3D { > 0, > PAGING_L1_ADDRESS_SHIFT, > @@ -50,6 +46,32 @@ UINT64 mLevelSize[5] =3D { > SIZE_512GB > }; >=20 > +PAGE_TABLE_POOL * > +GetPageTablePool ( > + VOID > + ) > +{ > + TDX_WORK_AREA *TdxWorkArea; > + > + TdxWorkArea =3D (TDX_WORK_AREA *)(UINTN)FixedPcdGet32 > + (PcdOvmfWorkAreaBase); ASSERT (TdxWorkArea !=3D NULL); > + > + return (PAGE_TABLE_POOL *)TdxWorkArea- > >SecTdxWorkArea.PageTablePool; > +} > + > +VOID > +SetPageTablePool ( > + VOID *PageTablePool > + ) > +{ > + TDX_WORK_AREA *TdxWorkArea; > + > + TdxWorkArea =3D (TDX_WORK_AREA *)(UINTN)FixedPcdGet32 > + (PcdOvmfWorkAreaBase); ASSERT (TdxWorkArea !=3D NULL); > + > + TdxWorkArea->SecTdxWorkArea.PageTablePool =3D > +(UINT64)(UINTN)PageTablePool; } > + > BOOLEAN > IsSetNxForStack ( > VOID > @@ -283,7 +305,10 @@ InitializePageTablePool ( > IN UINTN PoolPages > ) > { > - VOID *Buffer; > + VOID *Buffer; > + PAGE_TABLE_POOL *PageTablePool; > + > + PageTablePool =3D GetPageTablePool (); >=20 > DEBUG ((DEBUG_INFO, "InitializePageTablePool PoolPages=3D%d\n", > PoolPages)); >=20 > @@ -303,20 +328,21 @@ InitializePageTablePool ( > // > // Link all pools into a list for easier track later. > // > - if (mPageTablePool =3D=3D NULL) { > - mPageTablePool =3D Buffer; > - mPageTablePool->NextPool =3D mPageTablePool; > + if (PageTablePool =3D=3D NULL) { > + PageTablePool =3D Buffer; > + PageTablePool->NextPool =3D PageTablePool; > + SetPageTablePool (PageTablePool); > } else { > - ((PAGE_TABLE_POOL *)Buffer)->NextPool =3D mPageTablePool->NextPool; > - mPageTablePool->NextPool =3D Buffer; > - mPageTablePool =3D Buffer; > + ((PAGE_TABLE_POOL *)Buffer)->NextPool =3D PageTablePool->NextPool; > + PageTablePool->NextPool =3D Buffer; > + PageTablePool =3D Buffer; > } >=20 > // > // Reserve one page for pool header. > // > - mPageTablePool->FreePages =3D PoolPages - 1; > - mPageTablePool->Offset =3D EFI_PAGES_TO_SIZE (1); > + PageTablePool->FreePages =3D PoolPages - 1; > + PageTablePool->Offset =3D EFI_PAGES_TO_SIZE (1); >=20 > return TRUE; > } > @@ -343,28 +369,33 @@ AllocatePageTableMemory ( > IN UINTN Pages > ) > { > - VOID *Buffer; > + VOID *Buffer; > + PAGE_TABLE_POOL *PageTablePool; >=20 > if (Pages =3D=3D 0) { > return NULL; > } >=20 > - DEBUG ((DEBUG_INFO, "AllocatePageTableMemory. mPageTablePool=3D%p, > Pages=3D%d\n", mPageTablePool, Pages)); > + PageTablePool =3D GetPageTablePool (); > + > + DEBUG ((DEBUG_INFO, "AllocatePageTableMemory. PageTablePool=3D%p, > + Pages=3D%d\n", PageTablePool, Pages)); > // > // Renew the pool if necessary. > // > - if ((mPageTablePool =3D=3D NULL) || > - (Pages > mPageTablePool->FreePages)) > + if ((PageTablePool =3D=3D NULL) || > + (Pages > PageTablePool->FreePages)) > { > if (!InitializePageTablePool (Pages)) { > return NULL; > + } else { > + PageTablePool =3D GetPageTablePool (); > } > } >=20 > - Buffer =3D (UINT8 *)mPageTablePool + mPageTablePool->Offset; > + Buffer =3D (UINT8 *)PageTablePool + PageTablePool->Offset; >=20 > - mPageTablePool->Offset +=3D EFI_PAGES_TO_SIZE (Pages); > - mPageTablePool->FreePages -=3D Pages; > + PageTablePool->Offset +=3D EFI_PAGES_TO_SIZE (Pages); > + PageTablePool->FreePages -=3D Pages; >=20 > DEBUG (( > DEBUG_INFO, > @@ -618,10 +649,13 @@ EnablePageTableProtection ( > PAGE_TABLE_POOL *Pool; > UINT64 PoolSize; > EFI_PHYSICAL_ADDRESS Address; > + PAGE_TABLE_POOL *PageTablePool; >=20 > DEBUG ((DEBUG_INFO, "EnablePageTableProtection\n")); >=20 > - if (mPageTablePool =3D=3D NULL) { > + PageTablePool =3D GetPageTablePool (); > + > + if (PageTablePool =3D=3D NULL) { > return; > } >=20 > @@ -632,10 +666,10 @@ EnablePageTableProtection ( > AsmWriteCr0 (AsmReadCr0 () & ~CR0_WP); >=20 > // > - // SetPageTablePoolReadOnly might update mPageTablePool. It's safer to > + // SetPageTablePoolReadOnly might update PageTablePool. It's safer to > // remember original one in advance. > // > - HeadPool =3D mPageTablePool; > + HeadPool =3D PageTablePool; > Pool =3D HeadPool; > do { > Address =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Pool; > -- > 2.29.2.windows.2 >=20 >=20 >=20 >=20 >=20