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 <yong.li@intel.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Tuan Phan <tphan@ventanamicro.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com>
  • Loading branch information
andreiw committed Sep 19, 2023
1 parent cbcf042 commit 56871e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CryptoPkg/Library/OpensslLib/openssl
Submodule openssl updated 9069 files
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 56871e7

Please sign in to comment.