Skip to content

Commit

Permalink
RISCV: Fix InternalLongJump to return correct value
Browse files Browse the repository at this point in the history
InternalLongJump was not returning the 2nd parameter passed
to LongJmp (Value) as the return value from SetJmp.

Seen with code compiled with -Os, where an LongJmp (Buffer, -1)
somehow translated to SetJmp returning 0...

Cc: Yong Li <[email protected]>
Cc: Sunil V L <[email protected]>
Cc: Tuan Phan <[email protected]>
Cc: Daniel Schaefer <[email protected]>
Signed-off-by: Andrei Warkentin <[email protected]>
Reviewed-by: Sunil V L <[email protected]>
  • Loading branch information
andreiw authored and mergify[bot] committed Sep 21, 2023
1 parent 89dad77 commit ea628f2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Set/Long jump for RISC-V
//
// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
// Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -47,9 +48,5 @@ InternalLongJump:
REG_L s10, 11*SZREG(a0)
REG_L s11, 12*SZREG(a0)
REG_L sp, 13*SZREG(a0)

add a0, s0, 0
add a1, s1, 0
add a2, s2, 0
add a3, s3, 0
mv a0, a1
ret

0 comments on commit ea628f2

Please sign in to comment.