[PATCH 1/1] Cygwin: signal: Fix stabilize_sig_stack/setjmp/longjmp on AArch64
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Mar 11 14:54:22 GMT 2026
On Feb 19 08:44, Igor Podgainoi wrote:
> This commit fixes the AArch64 implementation of the following three
> functions: stabilize_sig_stack, setjmp and longjmp.
>
> Changes made:
>
> * Fixed code indentation in all three functions.
> * Corrected some comments and added additional ones.
> * Added missing SEH directives.
> * Changed the locking algorithm in stabilize_sig_stack to Test and
> Test-and-Set (TTAS).
> * Stopped returning a value in x0 in stabilize_sig_stack to avoid
> unnecessary clobbering. This should make it more similar to the
> x86_64 version.
> * Using x10 instead of x0 in setjmp and longjmp where needed as per
> the previous change.
> * Fixed bug in setjmp where the SP value after the prologue was used,
> instead of the original one.
> * Fixed bug in setjmp where the stackptr was saved at the wrong offset
> into jmp_buf (should be 0).
> * Now saving and restoring x0 in setjmp and x0/x1 in longjmp around the
> call to stabilize_sig_stack. This should make it more similar to the
> x86_64 version.
> * Removed the prologue and epilogue in longjmp, as the function never
> returns.
> * Changed logic in longjmp to take the return value directly from the
> second argument. This should make it more similar to the x86_64
> version.
> * Fixed bug in longjmp where the TLS stack pointer restoration used an
> invalid base register.
> * Using zero registers instead of an immediate 0 where possible.
>
> Tests fixed on AArch64:
> winsup.api/mmaptest02.exe
> winsup.api/mmaptest03.exe
> winsup.api/ltp/mmap05.exe
>
> Signed-off-by: Igor Podgainoi <igor.podgainoi@arm.com>
> ---
> winsup/cygwin/scripts/gendef | 277 ++++++++++++++++++-----------------
> 1 file changed, 142 insertions(+), 135 deletions(-)
Pushed on top of Thirumalai's patches.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list