[newlib-cygwin/main] Cygwin: gendef: Implement siglongjmp for AArch64

Corinna Vinschen via Cygwin-cvs <[email protected]> Fri, 16 Jan 2026 18:50:52 +0000 (GMT)
Newsgroups gmane.os.cygwin.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c6e781745b74ed1d0709339ad074c92b2ff5b59f

commit c6e781745b74ed1d0709339ad074c92b2ff5b59f
Author:     Thirumalai Nagalingam <[email protected]>
AuthorDate: Sat Dec 6 18:14:08 2025 +0530
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Fri Jan 16 19:48:53 2026 +0100

    Cygwin: gendef: Implement siglongjmp for AArch64
    
    Co-authored-by: Radek BartoĊˆ <[email protected]>
    
    Signed-off-by: Thirumalai Nagalingam <[email protected]>

Diff:
---
 winsup/cygwin/scripts/gendef | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index adb3ed21741c..b0e4d2a3e507 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -611,7 +611,33 @@ sigsetjmp:
 	.globl  setjmp
 setjmp:
 	.globl	siglongjmp
+	.seh_proc siglongjmp
 siglongjmp:
+	// prologue
+	stp	fp, lr, [sp, #-0x10]!		// save FP and LR registers
+	mov	fp, sp				// set FP to current SP
+	.seh_endprologue
+	mov x19, x1				// save val
+	mov x20, x0				// save buf
+	ldr     w8, [x20, #0x100]       	// w8 = buf->savemask
+	cbz     w8, 1f                  	// if savemask == 0, skip
+	sub	sp, sp, #32			// allocate 32 bytes on stack
+	mov     x0, #0                  	// SIG_SETMASK
+	mov     x1, xzr                 	// newmask = NULL
+	add     x2, x20, #0x108         	// &buf->sigmask
+	bl      pthread_sigmask
+
+	add     sp, sp, #32			// call frame
+1:
+	mov	x0, x20				//buf
+	mov	x1, x19				//val
+	bl longjmp
+
+	// epilogue
+	ldp	fp, lr, [sp], #0x10		// restore saved FP and LR registers
+	ret
+	.seh_endproc
+
 	.globl  longjmp
 longjmp:
 EOF