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 00625AC0C6B for ; Tue, 21 Nov 2023 07:02:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dTzGEATZwwwyTiae3tgkJmRG1Fzw9ILtxUL4t/uLJ2c=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1700550178; v=1; b=oA8vdQOtxx6P0S6KLiozeXBRYGMWrO9MtoXQCrr+l8xglxcNQKqFK+S4XSCrkvZ7ah/Rb1gj BRx807ON15Y9sF+ucKBLI1NTx4xNGEFQV1UIQmKlCOpyoKf4t5miUZX1SqoY7ot5MuiR7K2rWo9 s9oQtoGK/kdx7MYxwLtEBAIs= X-Received: by 127.0.0.2 with SMTP id QKCxYY7687511xkXalwOKnDv; Mon, 20 Nov 2023 23:02:58 -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:58 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="390633406" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="390633406" 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:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="795704960" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="795704960" X-Received: from shwdesssddpdwei.ccr.corp.intel.com ([10.239.157.28]) by orsmga008.jf.intel.com with ESMTP; 20 Nov 2023 23:02:55 -0800 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Wu Jiaxin , Tan Dun Subject: [edk2-devel] [PATCH v6 4/6] UefiCpuPkg: Only change CR4.CET bit for enable and disable CET. Date: Tue, 21 Nov 2023 15:02:44 +0800 Message-Id: <20231121070246.505-5-w.sheng@intel.com> In-Reply-To: <20231121070246.505-1-w.sheng@intel.com> References: <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: XchFehWcQWYUeyyyXXAad1Gux7686176AA= 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=oA8vdQOt; 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 Signed-off-by: Sheng Wei Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Wu Jiaxin Cc: Tan Dun Reviewed-by: Laszlo Ersek --- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 10 +++++++--- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm b/UefiCpuPkg/PiSm= mCpuDxeSmm/Ia32/SmiEntry.nasm index 6368982433..1da9afab97 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm @@ -237,7 +237,9 @@ CetInterruptDone: bts ecx, 16 ; set WP=0D mov cr0, ecx=0D =0D - mov eax, 0x668 | CR4_CET=0D + ; set CR4.CET bit for enable CET=0D + mov eax, cr4=0D + bts eax, CR4_CET_BIT=0D mov cr4, eax=0D =0D setssbsy=0D @@ -264,8 +266,10 @@ CetDone: cmp al, 0=0D jz CetDone2=0D =0D - mov eax, 0x668=0D - mov cr4, eax ; disable CET=0D + ; clear CR4.CET bit for disable CET=0D + mov eax, cr4=0D + btr eax, CR4_CET_BIT=0D + mov cr4, eax=0D =0D mov ecx, MSR_IA32_PL0_SSP=0D pop eax=0D diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm b/UefiCpuPkg/PiSmm= CpuDxeSmm/X64/SmiEntry.nasm index 9a225bc3be..abf9f1a90a 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm @@ -263,7 +263,9 @@ CetInterruptDone: bts ecx, 16 ; set WP=0D mov cr0, rcx=0D =0D - mov eax, 0x668 | CR4_CET=0D + ; set CR4.CET bit for enable CET=0D + mov rax, cr4=0D + bts rax, CR4_CET_BIT=0D mov cr4, rax=0D =0D setssbsy=0D @@ -308,8 +310,10 @@ mCetSupportedAbsAddr: cmp al, 0=0D jz CetDone2=0D =0D - mov eax, 0x668=0D - mov cr4, rax ; disable CET=0D + ; clear CR4.CET bit for disable CET=0D + mov rax, cr4=0D + btr rax, CR4_CET_BIT=0D + mov cr4, rax=0D =0D mov ecx, MSR_IA32_INTERRUPT_SSP_TABLE_ADDR=0D pop rax=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111518): https://edk2.groups.io/g/devel/message/111518 Mute This Topic: https://groups.io/mt/102724275/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-