From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.47090.1680236682460193857 for ; Thu, 30 Mar 2023 21:24:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NUMxVsFF; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680236682; x=1711772682; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=gcPLo+uBFXj9es2+tr4YgweNuZBORLCokIGyLHN3NOs=; b=NUMxVsFF5tzAjpl+51cP7y802raQvJ2Wj/hQh2srpaH4jzG8Bwj5Hppa MFTyMug5W3ni1o/4ryzUuCx/4NVk/GHuJmOZabAfjxH2LK77oEVCIc4s1 WSjZAi0ISGOPp0DpaFHpvKqjI1Zcsx0hJo7RpPfrDpJbReQkg3Pwm/iPG SfZTEw+ikpszY+h6tGLVc5tfV3PSR39rclzmFLm9dHQJrmAIZ8PvF2isq b/iU9LcU8hqu2542FyfCJGwYZtZrEdJ1gnSORmqh3b7MZQN2di7/otW9D zivPMuF9ciGRs2E+zAW/r7pHANX+N6P/5vaScf4McEGa9zgyTC79vey0J A==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="329883148" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="329883148" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 21:22:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="828565765" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="828565765" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga001.fm.intel.com with ESMTP; 30 Mar 2023 21:22:32 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 30 Mar 2023 21:22:32 -0700 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.21 via Frontend Transport; Thu, 30 Mar 2023 21:22:32 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) 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.21; Thu, 30 Mar 2023 21:22:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T57LumNyOXI0LW4SYWgz+m6hzRtXx7CPb5EfV/7BncMBNSkQwmw7X8m16wIn/SdwqZ2CgeMpczOa4I5GL1k7fn5Xpsk+vcnXz2nlwKhQVFlxWJjzlfq5X7RyMHTCOOXicURV85lhTdbbStUtDxg3CCHO4nlaMf3cBiwHeTlsgxTHfIhDOIQHv5LzyaXGMza/WINxZMG5H7/jLLHg8eazM9RvvvawjGD6GBJEub1ydMTnYxOeKd7O7UXS2GGvN3+FNR6+Mwz5dp+Vz4wCEjBeLT1PMJ/SOJZ3tSWkkQSFPduWyJtaaAsx6Eyg/1m74E7ER1U2vWLlZGQ+KdPp8511Vw== 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=CtdAvyHvIn69YgvsMN0ugz9VhGshVtghiUnQNDoMv2k=; b=mBpyWsOnHGcxIG4UqKqDAPALoxyz0mrEE95vEHnwDlTT9lJ/r4vStMfRAsiGlEWRpqRjkZ5eN8oJoxDx4bpUudoDn15WE6DsWNaZgIKxWN/3wkxHqIl9QDtYfqYQ4KpRpqVqihSUpTSgfInI9GB+NvhLIJxAS3dG+wf5YRe5oC/n2354z/AKEB0QiKHl8xcjQAjeu52gaJDqCOK3ZNQ0xN9OBKF6hTNLrycHjDQtMu1gbdE0Z6I85PCA1VvyE1x5Dl1q3u309F/Av21zsnBcXN+OfWjX8hTxbWyeCSCCruwuP0F4V4zZx+QnlTxSyW6cexJyL6VN1N3kZriiXtcygg== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by PH7PR11MB7596.namprd11.prod.outlook.com (2603:10b6:510:27e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22; Fri, 31 Mar 2023 04:22:24 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69%8]) with mapi id 15.20.6222.035; Fri, 31 Mar 2023 04:22:24 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "ardb@kernel.org" CC: Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky Subject: Re: [edk2-devel] [RFT PATCH v2 4/6] UefiCpuPkg/CpuExceptionHandlerLib: Remove needless runtime fixups Thread-Topic: [edk2-devel] [RFT PATCH v2 4/6] UefiCpuPkg/CpuExceptionHandlerLib: Remove needless runtime fixups Thread-Index: AQHZY02dnFG9NJYDWEOF4fxr599Iha8USi6Q Date: Fri, 31 Mar 2023 04:22:24 +0000 Message-ID: References: <20230330212101.1566931-1-ardb@kernel.org> <20230330212101.1566931-5-ardb@kernel.org> In-Reply-To: <20230330212101.1566931-5-ardb@kernel.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: MN6PR11MB8244:EE_|PH7PR11MB7596:EE_ x-ms-office365-filtering-correlation-id: 3d2e35fc-1a8d-4ccc-8149-08db319f877c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RxGvFt366CYZvPgE9x722D2ce65NxuZ38TRJnae9N1BoO2vkQKwsZbVE3VGGgS5nYkKw+FHd5kdFvmokeR5vrWK0kUeNBtCW4p4gRB06f/VnOwMg8dmaLOrh6CQgfH/rKiaQSlfnliz5D2l7yz4eyPGOQbfLqnPiSPQ3vuHrzhiVC/Po7oQU6Mhn/kL8+51hpIVpLt6dBBjiNcWYjPlQ861oxWj/i0YDRKd6MdXB3JBb3r63lIkiIS697p9y6UxZfxHWgx/PU2rQpjsAyHJULERSGHDKfB2pUFTo9OIjF28j+RvGaX3adGhYGUXTfYw5eocpXDmgXZGYd3XU/aYCqN0JxKdjGP9uBQe4WCHStKye7UWOab2hPYMHx25aaM83uOHuQDEH5sIHmgC/Ehb6X1w56HA8LC2O3qO5FB9BzRKZhaZB7N3qMjDDbrmCNx7YHdSN+s7EpIshm65dl6GaS0AClccSacvDBirZnxyN9cW5nTcAWSR6kRQihOiitxo7YrFqzvS2JwIuhxiCeqPWsbmSi/L5hQ96gcIglUYw5v5yRemkXy7rajrsk9eDy9Lf4uy+kEJp6MwK6DZvj7r90Q6w1wFX97kxHIlrtVBhmPmzrxblFe+odcZAtXYQQFnKyUXshW+nXX6W/PRzrceRKw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(376002)(366004)(346002)(136003)(396003)(451199021)(966005)(6506007)(26005)(53546011)(122000001)(83380400001)(186003)(9686003)(82960400001)(38100700002)(38070700005)(41300700001)(8936002)(5660300002)(52536014)(76116006)(66446008)(33656002)(478600001)(86362001)(64756008)(66556008)(19627235002)(71200400001)(8676002)(316002)(4326008)(66946007)(66476007)(55016003)(7696005)(110136005)(54906003)(66899021)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?sNFZPpFGY9FS360qAM8sAWt+1lTRHy4qFBqtgeapfeQEVrOerCT793hcKkub?= =?us-ascii?Q?JifLuj2I5jnAQj8vh5pJNv0my/N7oJnbVWFYiYw+qlm2hTZ/I4zNviFEUKCJ?= =?us-ascii?Q?oqgCiTr6CADDOZnvMLP52ClSimLwoYB3UbOgTr0tgvVjfKY0CL8/mW+MhpTl?= =?us-ascii?Q?OlLyzXSQygmu4IiUQ0m26xrgz0i6IYF8oJmDO7hsuO0ycDJFYcpxeiAEzVEN?= =?us-ascii?Q?XfbWD+q6iCozI7bSWXGP983zV6pUxpboqlLL+C+9pVWfGlBjjHVWmRwadHwU?= =?us-ascii?Q?io4Kw99BAa23CopOni9FaXri33aNAuf8IwohDhHjydI8PANFtx2ANNEp2frO?= =?us-ascii?Q?DKLtAJR5xzbVzeIQNEXQ2/0jQ7lSLbAvoMRxGA5WrK9utLq26zDi9fJim68v?= =?us-ascii?Q?huybYx2DzfxWUqc9BOIeELGKsMykP7Bb7eS2Fhklvr+29grxtXZ1/vXHHSDK?= =?us-ascii?Q?IKbCaj0PVNbKT/Yt/ai+Y91Sp93cD04KUkZuOaruYmZ18DWu+K7Rb4Oa+rhP?= =?us-ascii?Q?MEOJ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NxMObnR?= =?us-ascii?Q?6u5//ncDgtW/Tk0Au4JTGfgAc410IcYt5nl/RKRHpxhU6bPQW89rCi5fiwxf?= =?us-ascii?Q?7U5BbOW8AZILO2wVvwRWpvM6yeqdRECjXfOujE/sSzLcH+b+Ch1feVwJVKvF?= =?us-ascii?Q?xge0Fswjg8sV9yKYpUU=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: 3d2e35fc-1a8d-4ccc-8149-08db319f877c X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Mar 2023 04:22:24.5682 (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: WFKugubx4O2+JmkR7OOpxYupPVSMOCkc/A0fX3OYpcu0V2JBrXeSpv5FWawVRKabe+G4/pi65VshTdN1TLTKiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7596 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni -----Original Message----- From: devel@edk2.groups.io On Behalf Of Ard Biesheuv= el Sent: Friday, March 31, 2023 5:21 AM To: devel@edk2.groups.io Cc: Ard Biesheuvel ; Ni; Ni, Ray ; Andre= w Fish ; Kinney, Michael D ; L= iu, Zhiguang ; Rebecca Cran ; To= m Lendacky Subject: [edk2-devel] [RFT PATCH v2 4/6] UefiCpuPkg/CpuExceptionHandlerLib:= Remove needless runtime fixups Recent versions of the XCODE linker can be instructed to permit text relocations, so we no longer have to work around this, which is especially nice as our workaround assumes that the .text section is mapped both writable and executable at the same time. So remove the runtime fixups and instead, just emit the absolute references into the .text section. While at it, rename the Xcode5ExceptionHandlerAsm.nasm source file and drop the Xcode5 prefix: this code is used by other toolchains too. Signed-off-by: Ard Biesheuvel --- UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf = | 2 +- UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf = | 2 +- UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf = | 2 +- UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandlerAsm.n= asm =3D> ExceptionHandlerAsm.nasm} | 18 ++---------------- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandle= rLib.inf index d0f82095cf926e99..1b2dde746d154706 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.i= nf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandle= rLib.inf index 5339f8e604045801..86248cea3e97cedb 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i= nf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandle= rLib.inf index 8f8a5dab79303f87..0eed594be8660302 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.i= nf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionH= andlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHan= dlerAsm.nasm similarity index 92% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHa= ndlerAsm.nasm rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm= .nasm index 957478574253e619..10af4cfcdb6b1ea2 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerA= sm.nasm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nas= m @@ -59,7 +59,7 @@ AsmIdtVectorBegin: %rep 256 push strict dword %[Vector] ; This instruction pushes sign-extended= 8-byte value on stack push rax - mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptE= ntry) + mov rax, ASM_PFX(CommonInterruptEntry) jmp rax %assign Vector Vector+1 %endrep @@ -69,8 +69,7 @@ HookAfterStubHeaderBegin: push strict dword 0 ; 0 will be fixed VectorNum: push rax - mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd -JmpAbsoluteAddress: + mov rax, HookAfterStubHeaderEnd jmp rax HookAfterStubHeaderEnd: mov rax, rsp @@ -456,19 +455,6 @@ ASM_PFX(AsmGetTemplateAddressMap): mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 25= 6 lea rax, [HookAfterStubHeaderBegin] mov qword [rcx + 0x10], rax - -; Fix up CommonInterruptEntry address - lea rax, [ASM_PFX(CommonInterruptEntry)] - lea rcx, [AsmIdtVectorBegin] -%rep 256 - mov qword [rcx + (JmpAbsoluteAddress - 8 - HookAfterStubHeaderBegin= )], rax - add rcx, (AsmIdtVectorEnd - AsmIdtVectorBegin) / 256 -%endrep -; Fix up HookAfterStubHeaderEnd - lea rax, [HookAfterStubHeaderEnd] - lea rcx, [JmpAbsoluteAddress] - mov qword [rcx - 8], rax - ret =20 ;-------------------------------------------------------------------------= ------------ --=20 2.39.2 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#102215): https://edk2.groups.io/g/devel/message/102215 Mute This Topic: https://groups.io/mt/97960766/1712937 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] -=3D-=3D-=3D-=3D-=3D-=3D