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 BC867740052 for ; Tue, 21 Nov 2023 07:03:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=eTECTIcTwFe2/rKXC+v5WX8vv5x6y49F7DCGNBMcoKM=; 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=1700550183; v=1; b=nJ1YYI4ZPXqWAB1y8ujgHebq7j7DCj6iCanJappXlYskPeWxiLEg98mS8tbOsXwWbdBXbSEK /Yd9Ib/1P209h3XAVUf2MpbzbO9E1H+dd2CNQAvyKRL4L4ZauD6t4V3IsZqx8Y754q8azNCP1qM cJXM3xrNe5cjtnWiL1CfzOuU= X-Received: by 127.0.0.2 with SMTP id 12KiYY7687511xlwmWrC9lcM; Mon, 20 Nov 2023 23:03:03 -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:03:02 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="390633425" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="390633425" 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:03:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="795705010" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="795705010" X-Received: from shwdesssddpdwei.ccr.corp.intel.com ([10.239.157.28]) by orsmga008.jf.intel.com with ESMTP; 20 Nov 2023 23:03:00 -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 6/6] MdePkg: Use macro CR4_CET_BIT to replace hard code value. Date: Tue, 21 Nov 2023 15:02:46 +0800 Message-Id: <20231121070246.505-7-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: AENaItKCxMpZ5aSZEXPIlApwx7686176AA= 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=nJ1YYI4Z; 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 The macro is used in file LongJump.nasm and SetJump.nasm. Signed-off-by: Sheng Wei Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Wu Jiaxin Cc: Tan Dun Reviewed-by: Laszlo Ersek --- 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 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.nasm b/MdePkg/Library/Bas= eLib/Ia32/LongJump.nasm index 6c13dfe307..df1bf9749e 100644 --- a/MdePkg/Library/BaseLib/Ia32/LongJump.nasm +++ b/MdePkg/Library/BaseLib/Ia32/LongJump.nasm @@ -14,6 +14,7 @@ ;-------------------------------------------------------------------------= -----=0D =0D %include "Nasm.inc"=0D +%include "Cet.inc"=0D =0D SECTION .text=0D =0D @@ -34,7 +35,7 @@ ASM_PFX(InternalLongJump): test eax, eax=0D jz CetDone=0D mov eax, cr4=0D - bt eax, 23 ; check if CET is enabled=0D + bt eax, CR4_CET_BIT ; check if CET is enabled=0D jnc CetDone=0D =0D mov edx, [esp + 4] ; edx =3D JumpBuffer=0D diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.nasm b/MdePkg/Library/Base= Lib/Ia32/SetJump.nasm index 2577373241..0c484f6852 100644 --- a/MdePkg/Library/BaseLib/Ia32/SetJump.nasm +++ b/MdePkg/Library/BaseLib/Ia32/SetJump.nasm @@ -14,6 +14,7 @@ ;-------------------------------------------------------------------------= -----=0D =0D %include "Nasm.inc"=0D +%include "Cet.inc"=0D =0D SECTION .text=0D =0D @@ -42,7 +43,7 @@ ASM_PFX(SetJump): test eax, eax=0D jz CetDone=0D mov eax, cr4=0D - bt eax, 23 ; check if CET is enabled=0D + bt eax, CR4_CET_BIT ; check if CET is enabled=0D jnc CetDone=0D =0D mov eax, 1=0D diff --git a/MdePkg/Library/BaseLib/X64/LongJump.nasm b/MdePkg/Library/Base= Lib/X64/LongJump.nasm index 2002f65cba..021b49e855 100644 --- a/MdePkg/Library/BaseLib/X64/LongJump.nasm +++ b/MdePkg/Library/BaseLib/X64/LongJump.nasm @@ -14,6 +14,7 @@ ;-------------------------------------------------------------------------= -----=0D =0D %include "Nasm.inc"=0D +%include "Cet.inc"=0D =0D DEFAULT REL=0D SECTION .text=0D @@ -35,7 +36,7 @@ ASM_PFX(InternalLongJump): test eax, eax=0D jz CetDone=0D mov rax, cr4=0D - bt eax, 23 ; check if CET is enabled=0D + bt eax, CR4_CET_BIT ; check if CET is enabled=0D jnc CetDone=0D =0D push rdx ; save rdx=0D diff --git a/MdePkg/Library/BaseLib/X64/SetJump.nasm b/MdePkg/Library/BaseL= ib/X64/SetJump.nasm index 5943a5ebe5..d2c0991e66 100644 --- a/MdePkg/Library/BaseLib/X64/SetJump.nasm +++ b/MdePkg/Library/BaseLib/X64/SetJump.nasm @@ -14,6 +14,7 @@ ;-------------------------------------------------------------------------= -----=0D =0D %include "Nasm.inc"=0D +%include "Cet.inc"=0D =0D DEFAULT REL=0D SECTION .text=0D @@ -44,7 +45,7 @@ ASM_PFX(SetJump): test eax, eax=0D jz CetDone=0D mov rax, cr4=0D - bt eax, 23 ; check if CET is enabled=0D + bt eax, CR4_CET_BIT ; check if CET is enabled=0D jnc CetDone=0D =0D mov rax, 1=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111520): https://edk2.groups.io/g/devel/message/111520 Mute This Topic: https://groups.io/mt/102724277/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-