Hi Leif,

Thank you for this patch.

This patch looks good to me.

Just a question, should we also do the same for the AArch32 builds?

In either case,

Reviewed-by: Sami Mujawar <sami.muja...@arm.com>

Regards,

Sami Mujawar

On 26/09/2023 06:15 pm, Leif Lindholm wrote:
The SetJump comment header states that:
   If JumpBuffer is NULL, then ASSERT().

However, this was not currently done.
Add a call to InternalAssertJumpBuffer.

Signed-off-by: Leif Lindholm <quic_llind...@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Sami Mujawar <sami.muja...@arm.com>
---
  MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S   | 8 ++++++++
  MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm | 8 ++++++++
  2 files changed, 16 insertions(+)

diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S 
b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S
index 78db9b3d1e78..de79ad3a0a3e 100644
--- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S
+++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S
@@ -46,6 +46,14 @@ GCC_ASM_EXPORT(InternalLongJump)
  #
  ASM_PFX(SetJump):
          AARCH64_BTI(c)
+#ifndef MDEPKG_NDEBUG
+        stp     x29, x30, [sp, #-32]!
+        mov     x29, sp
+        str     x0, [sp, #16]
+        bl      InternalAssertJumpBuffer
+        ldr     x0, [sp, #16]
+        ldp     x29, x30, [sp], #32
+#endif
          mov     x16, sp // use IP0 so save SP
  #define REG_PAIR(REG1, REG2, OFFS)      stp REG1, REG2, [x0, OFFS]
  #define REG_ONE(REG1, OFFS)             str REG1, [x0, OFFS]
diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm 
b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm
index d8b267addc1a..c2774eece311 100644
--- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm
+++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm
@@ -44,6 +44,14 @@
  ;  );
  ;
  SetJump
+#ifndef MDEPKG_NDEBUG
+        stp     x29, x30, [sp, #-32]!
+        mov     x29, sp
+        str     x0, [sp, #16]
+        bl      InternalAssertJumpBuffer
+        ldr     x0, [sp, #16]
+        ldp     x29, x30, [sp], #32
+#endif
          mov     x16, sp // use IP0 so save SP
  #define REG_PAIR(REG1, REG2, OFFS)      stp REG1, REG2, [x0, OFFS]
  #define REG_ONE(REG1, OFFS)             str REG1, [x0, OFFS]


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


Reply via email to