Skip to content

Commit

Permalink
MdePkg/BaseLib: ensure ARM LongJump never returns 0
Browse files Browse the repository at this point in the history
The ARM implementation of InternalLongJump always returned the value
Value - but it is not supposed to ever return 0. Add the test to prevent
that, and return 1 if Value is 0 - as is already present in AArch64.

Signed-off-by: Leif Lindholm <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Sami Mujawar <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
  • Loading branch information
leiflindholm authored and mergify[bot] committed Oct 2, 2023
1 parent 2b27053 commit 1a66bd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ ASM_PFX(SetJump):
ASM_PFX(InternalLongJump):
ldmia r0, {r3-r12,r14}
mov r13, r3
cmp r1, #0
moveq r1, #1
mov r0, r1
bx lr

Expand Down
2 changes: 2 additions & 0 deletions MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ SetJump
InternalLongJump
LDM R0, {R3-R12,R14}
MOV R13, R3
CMP R1, #0
MOVEQ R1, #1
MOV R0, R1
BX LR

Expand Down

0 comments on commit 1a66bd5

Please sign in to comment.