Re: [edk2-devel] [PATCH v6 6/6] MdePkg: Use macro CR4_CET_BIT to replace hard code value.

2023-11-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: Sheng, W 
> Sent: Tuesday, November 21, 2023 3:03 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Ni, Ray ; Laszlo
> Ersek ; Wu, Jiaxin ; Tan, Dun
> 
> Subject: [PATCH v6 6/6] MdePkg: Use macro CR4_CET_BIT to replace hard
> code value.
> 
> 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/BaseLib/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 @@
>  
> ;--
> 
> 
> 
>  %include "Nasm.inc"
> 
> +%include "Cet.inc"
> 
> 
> 
>  SECTION .text
> 
> 
> 
> @@ -34,7 +35,7 @@ ASM_PFX(InternalLongJump):
>  testeax, eax
> 
>  jz  CetDone
> 
>  mov eax, cr4
> 
> -bt  eax, 23; check if CET is enabled
> 
> +bt  eax, CR4_CET_BIT   ; check if CET is enabled
> 
>  jnc CetDone
> 
> 
> 
>  mov edx, [esp + 4] ; edx = JumpBuffer
> 
> diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.nasm
> b/MdePkg/Library/BaseLib/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 @@
>  
> ;--
> 
> 
> 
>  %include "Nasm.inc"
> 
> +%include "Cet.inc"
> 
> 
> 
>  SECTION .text
> 
> 
> 
> @@ -42,7 +43,7 @@ ASM_PFX(SetJump):
>  testeax, eax
> 
>  jz  CetDone
> 
>  mov eax, cr4
> 
> -bt  eax, 23; check if CET is enabled
> 
> +bt  eax, CR4_CET_BIT   ; check if CET is enabled
> 
>  jnc CetDone
> 
> 
> 
>  mov eax, 1
> 
> diff --git a/MdePkg/Library/BaseLib/X64/LongJump.nasm
> b/MdePkg/Library/BaseLib/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 @@
>  
> ;--
> 
> 
> 
>  %include "Nasm.inc"
> 
> +%include "Cet.inc"
> 
> 
> 
>  DEFAULT REL
> 
>  SECTION .text
> 
> @@ -35,7 +36,7 @@ ASM_PFX(InternalLongJump):
>  testeax, eax
> 
>  jz  CetDone
> 
>  mov rax, cr4
> 
> -bt  eax, 23  ; check if CET is enabled
> 
> +bt  eax, CR4_CET_BIT ; check if CET is enabled
> 
>  jnc CetDone
> 
> 
> 
>  pushrdx  ; save rdx
> 
> diff --git a/MdePkg/Library/BaseLib/X64/SetJump.nasm
> b/MdePkg/Library/BaseLib/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 @@
>  
> ;--
> 
> 
> 
>  %include "Nasm.inc"
> 
> +%include "Cet.inc"
> 
> 
> 
>  DEFAULT REL
> 
>  SECTION .text
> 
> @@ -44,7 +45,7 @@ ASM_PFX(SetJump):
>  testeax, eax
> 
>  jz  CetDone
> 
>  mov rax, cr4
> 
> -bt  eax, 23  ; check if CET is enabled
> 
> +bt  eax, CR4_CET_BIT ; check if CET is enabled
> 
>  jnc CetDone
> 
> 
> 
>  mov rax, 1
> 
> --
> 2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111530): https://edk2.groups.io/g/devel/message/111530
Mute This Topic: https://groups.io/mt/102724277/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 6/6] MdePkg: Use macro CR4_CET_BIT to replace hard code value.

2023-11-20 Thread Sheng Wei
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/BaseLib/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 @@
 ;--
 
 %include "Nasm.inc"
+%include "Cet.inc"
 
 SECTION .text
 
@@ -34,7 +35,7 @@ ASM_PFX(InternalLongJump):
 testeax, eax
 jz  CetDone
 mov eax, cr4
-bt  eax, 23; check if CET is enabled
+bt  eax, CR4_CET_BIT   ; check if CET is enabled
 jnc CetDone
 
 mov edx, [esp + 4] ; edx = JumpBuffer
diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.nasm 
b/MdePkg/Library/BaseLib/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 @@
 ;--
 
 %include "Nasm.inc"
+%include "Cet.inc"
 
 SECTION .text
 
@@ -42,7 +43,7 @@ ASM_PFX(SetJump):
 testeax, eax
 jz  CetDone
 mov eax, cr4
-bt  eax, 23; check if CET is enabled
+bt  eax, CR4_CET_BIT   ; check if CET is enabled
 jnc CetDone
 
 mov eax, 1
diff --git a/MdePkg/Library/BaseLib/X64/LongJump.nasm 
b/MdePkg/Library/BaseLib/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 @@
 ;--
 
 %include "Nasm.inc"
+%include "Cet.inc"
 
 DEFAULT REL
 SECTION .text
@@ -35,7 +36,7 @@ ASM_PFX(InternalLongJump):
 testeax, eax
 jz  CetDone
 mov rax, cr4
-bt  eax, 23  ; check if CET is enabled
+bt  eax, CR4_CET_BIT ; check if CET is enabled
 jnc CetDone
 
 pushrdx  ; save rdx
diff --git a/MdePkg/Library/BaseLib/X64/SetJump.nasm 
b/MdePkg/Library/BaseLib/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 @@
 ;--
 
 %include "Nasm.inc"
+%include "Cet.inc"
 
 DEFAULT REL
 SECTION .text
@@ -44,7 +45,7 @@ ASM_PFX(SetJump):
 testeax, eax
 jz  CetDone
 mov rax, cr4
-bt  eax, 23  ; check if CET is enabled
+bt  eax, CR4_CET_BIT ; check if CET is enabled
 jnc CetDone
 
 mov rax, 1
-- 
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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-