Unlike userland, the OpenBSD kernel longjmp() function does not take a
return value for setjmp as second argument, but is guaranteed to return
nonzero.
The following diff makes sure the code matches this expectation.
Completely untested, yadda yadda.
Index: support.S
===================================================================
RCS file: /OpenBSD/src/sys/arch/riscv64/riscv64/support.S,v
retrieving revision 1.2
diff -u -p -r1.2 support.S
--- support.S 12 May 2021 01:20:52 -0000 1.2
+++ support.S 21 Mar 2022 20:02:03 -0000
@@ -58,7 +58,7 @@ ENTRY(setjmp)
sd s11, (11 * 8)(a0)
sd ra, (12 * 8)(a0)
- /* Return value */
+ /* Return zero */
li a0, 0
ret
END(setjmp)
@@ -83,7 +83,7 @@ ENTRY(longjmp)
ld s11, (11 * 8)(a0)
ld ra, (12 * 8)(a0)
- /* Load the return value */
- mv a0, a1
+ /* Return nonzero */
+ li a0, 1
ret
END(longjmp)