From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.85]) by mx.groups.io with SMTP id smtpd.web11.1610.1680847776835562988 for ; Thu, 06 Apr 2023 23:09:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=2eQq+mi1; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.244.85, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XABWPWKods13tIzQiMW7rejKqbWO9Dp9cKDM8xOxc3ZlYl+vbdjkqjCebT8mJb5GYitA56e/JnCqkkiGo6Ta1L2Vz8BPWNM+YtRALRmAxkYzYC74ZufUyi6ysLypyOadG8BPJFC08iXTGhtazth+G19tjzu5SliTPDlzRZR1QNZCAsercLGOu+vZ6NVyCV/TPHi0pWrWbG+1yVpmQ0GUKNCmEsiHw1zZd8F1+uvbxz7+8azU2FlHRGw6/hIkaLNJo1SBSAvhwH+OVci2DMEntlKiPnjpb/ZE62vMAC1QvAUnpEMPaZR9q/8F7l0nKc0c05EJyUqL3cGTvVOjlHqyPw== 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=HmMQFXSHZOSFqWd9O2cn9N3FFsmkCSKGy9tIy8pqLC8=; b=bs4R04LIK8kFiqvcFtTH8RW6bhN679lm08MNip5CRjuVVWuDaJ0CUexII+U1f/sUryqRBFgP4aho+mElbUYKB+ikVDVhw3lwaU5hTfupWt5fvlHl0AsDiA2QtjwCWBvS6wzFlaPiAfqbcTJpoe3P262duzQoSW/TbqIqObMI6oUe7TRadEfz0GAz1mVviGa0OhuS161GxufAoiMt761KaeAzOLBgxsDjjRxxJ96ogkNvlIhWE6Our4Dcd6hqAFfmWubwjhJEwDFrMETyxUIcsxtl/JVWE+KjATk0PNLiVFR9eZ64al0WqlF4NHalp0qczzXy98N1Hxtg3yGqDgItmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HmMQFXSHZOSFqWd9O2cn9N3FFsmkCSKGy9tIy8pqLC8=; b=2eQq+mi1EbKuzuMKnIiMTEXQyVziuuHp3WINMJm1w1PommDX7qk8Vz89vW8XTSP/nOGBH5+2IbJTD9CYPJcvxkjQa8KoV9zZE90t48JngfWQUl0yjeQ7PjkP9nVyDgMA5S2f6w2EqzsieQsSNEmoanCY57WCdmAXN3ruGTPxSo8= Received: from PH7PR12MB6466.namprd12.prod.outlook.com (2603:10b6:510:1f6::22) by SJ0PR12MB6925.namprd12.prod.outlook.com (2603:10b6:a03:483::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Fri, 7 Apr 2023 06:09:34 +0000 Received: from PH7PR12MB6466.namprd12.prod.outlook.com ([fe80::127d:946f:b238:1151]) by PH7PR12MB6466.namprd12.prod.outlook.com ([fe80::127d:946f:b238:1151%2]) with mapi id 15.20.6156.027; Fri, 7 Apr 2023 06:09:34 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Grimes, Paul" , "Kirkendall, Garrett" , "Chang, Abner" , "Dong, Eric" , "Kumar, Rahul R" Subject: Re: [edk2-devel] [PATCH v6 6/6] UefiCpuPkg: Implements SmmCpuFeaturesLib for AMD Family Thread-Topic: [edk2-devel] [PATCH v6 6/6] UefiCpuPkg: Implements SmmCpuFeaturesLib for AMD Family Thread-Index: AQHZXtwjXnflTfM0mEeoHikXL9EgZq8Uj52AgArgwsA= Date: Fri, 7 Apr 2023 06:09:34 +0000 Message-ID: References: <19f2778bccfc88ef2f47960a4ae8c7184df3a303.1679722393.git.abdattar@amd.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=73e429a2-9b08-43e7-8379-43d6e4a2b8eb;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-04-07T06:06:09Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR12MB6466:EE_|SJ0PR12MB6925:EE_ x-ms-office365-filtering-correlation-id: 1a24a314-ae2b-46bf-09a4-08db372ea8c1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nsvjG/YkEX5DA26DkvtxDeqpzMbQgi5VKWD5v4TuL+QY85uy010PMlFQpl3h4RP5ZW7id3jujL5ec5asGwr8pmPsUjxCGucKtWanvnW8Z3HcPWXWPw4oIcXuc6SbJU7cpTDCt+Wo9EMA/TnAKFql8/NCliWtHBMwdN+Lodgl1494XPRWGvdlAQLUq0KToxR1NhZYo97SXtvQ0gAqnlF5F9mFPRpuagSfUv/TyHhl5ANXnnQ7AdLQUHqw68LZSGu1AMfKPHffVrGWhIxjAMnfIK6rjWg+gPSXvYElgPo3jb72IHMRekwPvi5hljnvdVlA/QyyiIG+Ul+rVe3aYGWB/yyFBiEbccbJsbOKNnknEF0Lbd1DhmigasYSu2O9SNDcLJh6jIi8/FV+oPZ/s6PFUCjqt92mOylIIHT/XKPpU7o8XjTcxUk4yKcwlUwX81Nj8U0t1VJZDMBN3x0/7rQohQlN+t4OSHdqMuUKronROaO69qbA9iSE1go7pLQtC8Etpzw/c31knBj9bwRGzKduQvyZETUb0uTvHWq/KHF7w0VqBTnCJfZztmM41ze62LrtBiLYpCLuhDihBgcuART720x3WMuNvXH+fUPIhPN+G98= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB6466.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(39860400002)(396003)(346002)(136003)(366004)(451199021)(2906002)(966005)(9686003)(54906003)(71200400001)(316002)(53546011)(6506007)(26005)(110136005)(478600001)(66946007)(186003)(76116006)(66476007)(86362001)(8676002)(7696005)(66556008)(83380400001)(64756008)(66446008)(4326008)(122000001)(41300700001)(5660300002)(38100700002)(38070700005)(66899021)(52536014)(8936002)(55016003)(33656002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8Hril/JUOICceQ8G1DZoxG3FjmjukR4qTOwWKM/h70JqIgCzTwf/y9iNXaH+?= =?us-ascii?Q?tkDyTd1O/h3JG1LsjbdUife0PQRiq+klZFrJ+vXLOkqIdI88IfRdCv1e/npE?= =?us-ascii?Q?v/Laed0andG/S9cvaCvkzJlh2Hv6FHcW8uFracsivZd7J6zSNpaoSZHkT8ug?= =?us-ascii?Q?+ZCec+N0GUllX11Yw8C2ksQNHF2YZrOqyCZsQpfweHyv4TvQmpAN2OcD5cOR?= =?us-ascii?Q?kG6dLXTI89adQ1rZG4up5hqRRHGZNltQOtStWBfVrDsfNf/B2LZJQJpne2nJ?= =?us-ascii?Q?hZqHYkC2u/dSme4y4HksT6MEE+ySOlRySuCJtgjJCvxEyxxW83dIYhlKzYab?= =?us-ascii?Q?chP+ZsPtEUxi8CFEOk+/9Xbc6tCyhpLv90JNEembY2ffEIAUqnjQzO5/DID/?= =?us-ascii?Q?qyJwqvBsjHnu+wVT0+jIyUzd8XyutmwIxbu+K4ZWtJc56zwh5rkZq+ANI3VN?= =?us-ascii?Q?O3HHmr9x0H/WUS2EfETc3+VuYIhtPnNUXyd8A+vXbrS61lH+t1W+upApN1A8?= =?us-ascii?Q?HtBQ1RS2jl/bVy4Y32chf90HId+YgxejCp4Z1eVgkl08IlyMYD1m9BuE0GYF?= =?us-ascii?Q?Qs3Gob6gULn1U/VrSxJMaFRqiGdUVtCse+iFHp2SDOVxmVWmOMwxV2pLJEmC?= =?us-ascii?Q?bEjYzlQS4aFGhSBMyRxhh0YTff4bWpCcUhGibzimdUmI7bDcAMOSsUKig3ZE?= =?us-ascii?Q?UaISBSB0KPuujCS3YdUZYGZq7qcz0UiIWTRfF97GwHs98BXwKO0PA9OHrlPl?= =?us-ascii?Q?D87d6jr3Z4jGAkpXoS2KZNPJQS3H9WNy8Z7ZhinTeAVTj/t+qUs+O0iOep3N?= =?us-ascii?Q?5/L81Yu1kHnqxQZ6dGih25a21CKCN+7LHeULcZx4Dxu07xKfRmJ5Kfho05KA?= =?us-ascii?Q?kJkI27QNPF5nkYLKs4N4DZyeC7b2w0bQY46TLjctF4F964Cm3s0QTAWRbZZK?= =?us-ascii?Q?NYmP33nLtxDNqYsC1wfGFdB4+uYPXz3ojun/RYFxM71toSF8ZrF9mywUjU8f?= =?us-ascii?Q?GbuUZey7XqR2FiGRwll5SrzQrcPEo0ySpw5MnaM1igFtOwrnhHB2t+otJ87n?= =?us-ascii?Q?89Ar8EDt3xBlhnypOo2w151zeHOz8dLT3Si7M4LuRqfrXuJSTXNcNHuwFaVF?= =?us-ascii?Q?33Vw/KcciV20iPpF74XrVp2MiXpLhXoYude4F8gij5UXMCnnQjHVT50ANyvq?= =?us-ascii?Q?593LHYjQn7qn3/HEmc4pZG/wDeoZh0Lg1z2mDpmuitZWC2Z9D87EtxrR7PVO?= =?us-ascii?Q?oTu9Sy1bqrmXiK9IvIHwe5dsK/llIpbMPFOQYBUEyD1w36YCB+pUgth6qUaU?= =?us-ascii?Q?e+4SndkJCQqA5S4GJ1Z9VHbUf70gU1MWQ7UimdNGYvcmUSjdx77S0rCRURcs?= =?us-ascii?Q?2/Qfa2YpIfT0/jy+LTh8z7ep/DwUmTsoCRbatPK5lnpBjCoEGFW2Jb5V8Mcy?= =?us-ascii?Q?PrOTVsY+CYdQchVatQKpBJ0n0VI3e9+6Qj57jLUuQiWFeExpwGEQQsMQRbAB?= =?us-ascii?Q?KoQgoCrlm2YME6m0FKtDSHQKstvwQKqhC0cN/rg84nVA4Y8fXzfH88rpc+jN?= =?us-ascii?Q?g/rRj9dp4Z2sPb0P7WM=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB6466.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a24a314-ae2b-46bf-09a4-08db372ea8c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2023 06:09:34.1991 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1XDjnyMlj6PkAOtUtR9OgmbPyND8I9nqdLco75oYNsRFxEBUG9na2wY5I7snlUy9wDgfzdioQfB1WK6r/UY0UQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6925 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Hi Ray, Please see inline. Thanks AbduL -----Original Message----- From: Ni, Ray Sent: 31 March 2023 13:29 To: devel@edk2.groups.io; Attar, AbdulLateef (Abdul Lateef) Cc: Attar, AbdulLateef (Abdul Lateef) ; Grimes, = Paul ; Kirkendall, Garrett ; Chang, Abner ; Dong, Eric ; Ku= mar, Rahul R Subject: RE: [edk2-devel] [PATCH v6 6/6] UefiCpuPkg: Implements SmmCpuFeatu= resLib for AMD Family Caution: This message originated from an External Source. Use proper cautio= n when opening attachments, clicking links, or responding. It's a bit wired that AMD version of SmmCpuFeaturesLib calls AMD version of= SmmSmramSaveStateLib. The question naturally becomes: why not integrate the two lib implementatio= ns together to avoid creating the SmmSmramSaveStateLib library class? Becau= se I cannot imagine AmdSmmCpuFeaturesLib calls to IntelSmmSmramSaveStateLib= . [Abdul] Initial version of this patch series has combined implementation of= SmmSmramSaveStateLib and AmdSmmCpuFeaturesLib, but reviewers (Abner) sugge= sted to separate the save state library; So that we can implement generic l= ibrary for both AMD and Intel. But I like the idea of separating the SMM save state access logic out of th= e SmmCpuFeaturesLib. Do you think CpuSmm driver calling the SmmSmramSaveStateLib is better? [Abdul] I'll make the changes and submit the patch for the same. > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Abdul > Lateef Attar via groups.io > Sent: Saturday, March 25, 2023 1:39 PM > To: devel@edk2.groups.io > Cc: Abdul Lateef Attar ; Paul Grimes > ; Garrett Kirkendall > ; Abner Chang ; Dong, > Eric ; Ni, Ray ; Kumar, Rahul R > ; Abdul Lateef Attar > Subject: [edk2-devel] [PATCH v6 6/6] UefiCpuPkg: Implements > SmmCpuFeaturesLib for AMD Family > > From: Abdul Lateef Attar > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4182 > > Implements interfaces to read and write save state registers of AMD's > processor family. > Initializes processor SMMADDR and MASK depends on PcdSmrrEnable flag. > Program or corrects the IP once control returns from SMM. > > Cc: Paul Grimes > Cc: Garrett Kirkendall > Cc: Abner Chang > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Signed-off-by: Abdul Lateef Attar > Reviewed-by: Abner Chang > --- > .../AmdSmmCpuFeaturesLib.inf | 6 + > .../SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c | 106 > +++++++++++++++++- > 2 files changed, 109 insertions(+), 3 deletions(-) > > diff --git > a/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.inf > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.inf > index 4c77efc64462..9d5b8c2e972d 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.inf > +++ > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.inf > @@ -31,3 +31,9 @@ [LibraryClasses] > PcdLib > MemoryAllocationLib > DebugLib > + SmmSmramSaveStateLib > + > +[FeaturePcd] > + gUefiCpuPkgTokenSpaceGuid.PcdSmrrEnable ## CONSUMES > + gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable ## > CONSUMES > + > diff --git > a/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c > index c74e1a0c0c5b..af45be3e265a 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c > @@ -11,6 +11,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > #include #include > > +#include > +#include > +#include > +#include > + > +// EFER register LMA bit > +#define LMA BIT10 > + > +// Machine Specific Registers (MSRs) > +#define SMMADDR_ADDRESS 0xC0010112ul #define SMMMASK_ADDRESS > +0xC0010113ul > +#define EFER_ADDRESS 0XC0000080ul > + > +// The mode of the CPU at the time an SMI occurs STATIC UINT8 > +mSmmSaveStateRegisterLma; > > /** > Read an SMM Save State register on the target processor. If this > function @@ -39,7 +54,7 @@ SmmCpuFeaturesReadSaveStateRegister ( > OUT VOID *Buffer > ) > { > - return EFI_SUCCESS; > + return SmramSaveStateReadRegister (CpuIndex, Register, Width, > + Buffer); > } > > /** > @@ -67,7 +82,7 @@ SmmCpuFeaturesWriteSaveStateRegister ( > IN CONST VOID *Buffer > ) > { > - return EFI_SUCCESS; > + return SmramSaveStateWriteRegister (CpuIndex, Register, Width, > + Buffer); > } > > /** > @@ -82,6 +97,13 @@ CpuFeaturesLibInitialization ( > VOID > ) > { > + UINT32 LMAValue; > + > + LMAValue =3D (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA= ; > + mSmmSaveStateRegisterLma =3D > EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT; > + if (LMAValue) { > + mSmmSaveStateRegisterLma =3D > EFI_SMM_SAVE_STATE_REGISTER_LMA_64BIT; > + } > } > > /** > @@ -117,6 +139,52 @@ SmmCpuFeaturesInitializeProcessor ( > IN CPU_HOT_PLUG_DATA *CpuHotPlugData > ) > { > + AMD_SMRAM_SAVE_STATE_MAP *CpuState; > + UINT32 LMAValue; > + > + // > + // Configure SMBASE. > + // > + CpuState =3D (AMD_SMRAM_SAVE_STATE_MAP > *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); > + CpuState->x64.SMBASE =3D (UINT32)CpuHotPlugData->SmBase[CpuIndex]; > + > + // Re-initialize the value of mSmmSaveStateRegisterLma flag which > + might > have been changed in PiCpuSmmDxeSmm Driver > + // Entry point, to make sure correct value on AMD platform is > + assigned to > be used by SmmCpuFeaturesLib. > + LMAValue =3D (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA= ; > + mSmmSaveStateRegisterLma =3D > EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT; > + if (LMAValue) { > + mSmmSaveStateRegisterLma =3D > EFI_SMM_SAVE_STATE_REGISTER_LMA_64BIT; > + } > + > + // > + // If SMRR is supported, then program SMRR base/mask MSRs. > + // The EFI_MSR_SMRR_PHYS_MASK_VALID bit is not set until the first > normal SMI. > + // The code that initializes SMM environment is running in normal > + mode // from SMRAM region. If SMRR is enabled here, then the SMRAM > + region // is protected and the normal mode code execution will fail. > + // > + if (FeaturePcdGet (PcdSmrrEnable)) { > + // > + // SMRR size cannot be less than 4-KBytes > + // SMRR size must be of length 2^n > + // SMRR base alignment cannot be less than SMRR length > + // > + if ((CpuHotPlugData->SmrrSize < SIZE_4KB) || > + (CpuHotPlugData->SmrrSize !=3D GetPowerOfTwo32 (CpuHotPlugData- > >SmrrSize)) || > + ((CpuHotPlugData->SmrrBase & ~(CpuHotPlugData->SmrrSize - 1)) > + !=3D > CpuHotPlugData->SmrrBase)) > + { > + // > + // Print message and halt if CPU is Monarch > + // > + if (IsMonarch) { > + DEBUG ((DEBUG_ERROR, "SMM Base/Size does not meet > alignment/size requirement!\n")); > + CpuDeadLoop (); > + } > + } else { > + AsmWriteMsr64 (SMMADDR_ADDRESS, CpuHotPlugData->SmrrBase); > + AsmWriteMsr64 (SMMMASK_ADDRESS, ((~(UINT64)(CpuHotPlugData- > >SmrrSize - 1)) | 0x6600)); > + } > + } > } > > /** > @@ -159,7 +227,39 @@ SmmCpuFeaturesHookReturnFromSmm ( > IN UINT64 NewInstructionPointer > ) > { > - return 0; > + UINT64 OriginalInstructionPointer; > + AMD_SMRAM_SAVE_STATE_MAP *AmdCpuState; > + > + AmdCpuState =3D (AMD_SMRAM_SAVE_STATE_MAP *)CpuState; > + > + if (mSmmSaveStateRegisterLma =3D=3D > EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT) { > + OriginalInstructionPointer =3D (UINT64)AmdCpuState->x86._EIP; > + AmdCpuState->x86._EIP =3D (UINT32)NewInstructionPointer; > + // > + // Clear the auto HALT restart flag so the RSM instruction returns > + // program control to the instruction following the HLT instruction. > + // > + if ((AmdCpuState->x86.AutoHALTRestart & BIT0) !=3D 0) { > + AmdCpuState->x86.AutoHALTRestart &=3D ~BIT0; > + } > + } else { > + OriginalInstructionPointer =3D AmdCpuState->x64._RIP; > + if ((AmdCpuState->x64.EFER & LMA) =3D=3D 0) { > + AmdCpuState->x64._RIP =3D (UINT32)NewInstructionPointer32; > + } else { > + AmdCpuState->x64._RIP =3D (UINT32)NewInstructionPointer; > + } > + > + // > + // Clear the auto HALT restart flag so the RSM instruction returns > + // program control to the instruction following the HLT instruction. > + // > + if ((AmdCpuState->x64.AutoHALTRestart & BIT0) !=3D 0) { > + AmdCpuState->x64.AutoHALTRestart &=3D ~BIT0; > + } > + } > + > + return OriginalInstructionPointer; > } > > /** > -- > 2.25.1 > > > >=20 >