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 29BDE740034 for ; Wed, 15 Nov 2023 04:12:33 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=89FE1M+Bh+wZHav7Wk+yVGQ7/bsKVXeF4/VFHKqSZ5Q=; 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=1700021551; v=1; b=Hw3WfKPaT/VgjUAM8YUgSHxgRE+2PB/53DkQNoqqw1522xLf+roeitz57lihtknGLQvIte1O iAuF0Vqk4SIDw8w4s7SrWqyKChRsCHEm+LhXS4bjrcwUZ2hszlQFpy7nhhH6ybTJPTebcEW4qAS EVAr0dDndXiWNanV0WpKmdgk= X-Received: by 127.0.0.2 with SMTP id LmdLYY7687511x7VwgDKl71j; Tue, 14 Nov 2023 20:12:31 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.5844.1700021541097014257 for ; Tue, 14 Nov 2023 20:12:31 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="393666252" X-IronPort-AV: E=Sophos;i="6.03,303,1694761200"; d="scan'208";a="393666252" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 20:12:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="882266146" X-IronPort-AV: E=Sophos;i="6.03,303,1694761200"; d="scan'208";a="882266146" X-Received: from shwdesssddpdwei.ccr.corp.intel.com ([10.239.157.28]) by fmsmga002.fm.intel.com with ESMTP; 14 Nov 2023 20:12:29 -0800 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Wu Jiaxin , Tan Dun Subject: [edk2-devel] [PATCH v5 6/6] MdePkg: Use macro CR4_CET_BIT to replace hard code value. Date: Wed, 15 Nov 2023 12:12:16 +0800 Message-Id: <20231115041216.2016-7-w.sheng@intel.com> In-Reply-To: <20231115041216.2016-1-w.sheng@intel.com> References: <20231115041216.2016-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: 78a1tbgrXK59f9XQRLAoo21fx7686176AA= 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=Hw3WfKPa; 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 --- 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 (#111240): https://edk2.groups.io/g/devel/message/111240 Mute This Topic: https://groups.io/mt/102599356/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-