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 7D7CDAC0C43 for ; Tue, 21 Nov 2023 07:02:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=L2AOlm+oTsuJ2niSoAJTsmFCBSFV+ooR5cIgQPuWqrw=; c=relaxed/simple; d=groups.io; h=From:To:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700550170; v=1; b=Yfc3enk5Hyt1+S8fZbv+o5I6trdL6X7bkCsqTz1KqzKvetZhP9NEcfV+ID4PutHnnflWYuG7 fIk6KdzPFP14j4eNycMTLnGVgNvnlpDtpb231fYPcHBd4exe8jtdLgHKyit5wTbneam8p6bBBe2 PfqBRsyrp3f1oWRbOif9Ip/g= X-Received: by 127.0.0.2 with SMTP id a8EoYY7687511xy6BE30xXUG; Mon, 20 Nov 2023 23:02:50 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.30512.1700550170171771930 for ; Mon, 20 Nov 2023 23:02:50 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="390633385" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="390633385" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 23:02:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="795704899" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="795704899" X-Received: from shwdesssddpdwei.ccr.corp.intel.com ([10.239.157.28]) by orsmga008.jf.intel.com with ESMTP; 20 Nov 2023 23:02:48 -0800 From: "Sheng Wei" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v6 0/6] MdePkg: Add macro definitions for CET feature for NASM files. Date: Tue, 21 Nov 2023 15:02:40 +0800 Message-Id: <20231121070246.505-1-w.sheng@intel.com> MIME-Version: 1.0 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,w.sheng@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: R3nbk6ThNBf8NwscKXtZaZ9tx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Yfc3enk5; 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 Patch V6: Cet.inc only contains definitions for x86 CPU. Move the file to \Ia32 and \X64 folder. Refine code for cet.inc. Patch V5: File cet.inc will be used in both MdePkg UefiCpuPkg. Move cet.inc file from UefiCpuPkg to MdePkg. Use macro CR4_CET_BIT to replace hard code value for both LongJump.nasm and SetJump.nasm. Patch V4: Separate the changes to 5 patches. 1) Add macro definitions for CET feature for NASM files. 2) Use macro CR4_CET_BIT to replace hard code value in Cet.nasm. 3) Use CET macro definitions in Cet.inc for SmiEntry.nasm files. 4) Only change CR4.CET bit for enable/disable CET. 5) Backup and Restore MSR IA32_U_CET in SMI handler. Remove some unused code. It is no need to clear MSR IA32_S_CET, because clear CR4.CET bit will disable all CET functions. Since CET is disabled between clear CR4.CET and run 'rsm', it is no need to delay MSR IA32_S_CET restoration. Patch V3: Remove the 3rd patch. mSmmInterruptSspTables is a global variable. It is unnecessary to initializ it to zero manually. Patch V2: No function change with Patch V1. Split the patch to into 3 separate patches. Sheng Wei (6): MdePkg: Add macro definitions for CET feature for NASM files. UefiCpuPkg: Use macro CR4_CET_BIT to replace hard code value in Cet.nasm. UefiCpuPkg: Use CET macro definitions in Cet.inc for SmiEntry.nasm files. UefiCpuPkg: Only change CR4.CET bit for enable and disable CET. UefiCpuPkg: Backup and Restore MSR IA32_U_CET in SMI handler. MdePkg: Use macro CR4_CET_BIT to replace hard code value. MdePkg/Include/Ia32/Cet.inc | 26 +++++++++++++ MdePkg/Include/X64/Cet.inc | 26 +++++++++++++ MdePkg/Library/BaseLib/Ia32/LongJump.nasm | 3 +- MdePkg/Library/BaseLib/Ia32/SetJump.nasm | 3 +- MdePkg/Library/BaseLib/X64/LongJump.nasm | 3 +- MdePkg/Library/BaseLib/X64/SetJump.nasm | 3 +- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Cet.nasm | 5 ++- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 39 +++++++++++-------- UefiCpuPkg/PiSmmCpuDxeSmm/X64/Cet.nasm | 5 ++- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm | 40 +++++++++++--------- 10 files changed, 112 insertions(+), 41 deletions(-) create mode 100644 MdePkg/Include/Ia32/Cet.inc create mode 100644 MdePkg/Include/X64/Cet.inc -- 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111514): https://edk2.groups.io/g/devel/message/111514 Mute This Topic: https://groups.io/mt/102724271/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-