Setjmp, longjmp was converted from calling sigprocmask to invoking sigprocmask directly. The ABI for the function call and the syscall are not the same and the register manipulation code was not updated in the change.
This diff moves the jmpbuf to x2 for the duration of the sigprocmask syscall and loads x0/x1 with the appropriate values and saves the returned x0 as the signal mask. Other than storing x0 and x30 (lr) on the stack, this should be equivalent to calling sigprocmask 'bl sigprocmaskB instead of 'SYSTRAP(sigprocmask)' diff --git a/lib/libc/arch/aarch64/gen/setjmp.S b/lib/libc/arch/aarch64/gen/setjmp.S index ba4010be7ff..76c1be5b9b5 100644 --- a/lib/libc/arch/aarch64/gen/setjmp.S +++ b/lib/libc/arch/aarch64/gen/setjmp.S @@ -34,16 +34,15 @@ #include <machine/setjmp.h> ENTRY(setjmp) - stp x0, x30, [sp, #-16]! + mov x2, x0 /* save jmpbuf in x2 */ /* Store the signal mask */ - add x2, x0, #(_JB_SIGMASK * 8) /* oset */ - mov x1, #0 /* set */ + mov w1, #0 /* set */ mov x0, #1 /* SIG_BLOCK */ SYSTRAP(sigprocmask) + str w0, [x2, #(_JB_SIGMASK * 8)] /* oset */ - ldp x0, x30, [sp], #16 - + mov x0, x2 /* Store the magic value and stack pointer */ ldr x8, .Lmagic mov x9, sp @@ -73,18 +72,15 @@ ENTRY(setjmp) END_STRONG(setjmp) ENTRY(longjmp) - stp x0, x1, [sp, #-32]! - str x30, [sp, #24] + mov x2, x0 /* move jmpbuf */ + mov x3, x1 /* final return value */ /* Restore the signal mask */ - mov x2, #0 /* oset */ - add x1, x0, #(_JB_SIGMASK * 8) /* set */ + ldr x1, [x2, #(_JB_SIGMASK * 8)] /* set */ mov x0, #3 /* SIG_SETMASK */ SYSTRAP(sigprocmask) - ldr x30, [sp, #24] - ldp x0, x1, [sp], #32 - + mov x0, x2 /* Check the magic value */ ldr x8, [x0], #8 ldr x9, .Lmagic @@ -110,7 +106,7 @@ ENTRY(longjmp) ldp d14, d15, [x0] /* Load the return value */ - mov x0, x1 + mov x0, x3 ret botch: Dale Rahn dr...@dalerahn.com