This patch implements setjmp and longjmp in riscv using inline asm. The
following changes were required:
- Omit frame pointer: otherwise gcc won't allow us to use s0
- Use attribute((naked)): otherwise both gcc and clang will generate
function prologue and epilogue in both functions. This doesn't happen
in x86_64, so we guard it to only riscv
Furthermore, using attribute((naked)) causes two problems: we
can't use return 0 (both gcc and clang) and the function arguments in
the function body (clang only), so we had to use a0 and a1 directly.
Your comment is in the previous diff but thanks for the explanation. I think we have missed the val check for zero in the x86_64 case and should be fixed separately.
For the above two instructions, in the interest of reducing the amount of logic in inline assembly, can we do: