Index: lib/libc/riscv/gen/setjmp.S =================================================================== --- lib/libc/riscv/gen/setjmp.S +++ lib/libc/riscv/gen/setjmp.S @@ -100,6 +100,11 @@ END(setjmp) ENTRY(longjmp) + /* Check the magic value */ + ld t0, 0(a0) + ld t1, .Lmagic + bne t0, t1, botch + addi sp, sp, -(4 * 8) sd a0, (0 * 8)(sp) sd ra, (1 * 8)(sp) @@ -116,11 +121,6 @@ ld a0, (0 * 8)(sp) addi sp, sp, (4 * 8) - /* Check the magic value */ - ld t0, 0(a0) - ld t1, .Lmagic - bne t0, t1, botch - /* Restore the stack pointer */ ld t0, 8(a0) mv sp, t0