Hi all,

Please find the attached patch which adds an ARM64 stub for the `siglongjmp ` 
routine
in the gendef script.

Any feedback or nits are very welcome. The changes are documented with inline
comments intended to be self-explanatory. please let me know if any part
of this patch should be adjusted.

Thanks for your time and review.

Thanks & regards
Thirumalai Nagalingam <[email protected]>

In-lined patch:

diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index f85c8cf74..40f473bb6 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -690,7 +690,33 @@ setjmp:
        .seh_endproc

        .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
+


Attachment: Cygwin-gendef-Implement-siglongjmp-for-AArch64.patch
Description: Cygwin-gendef-Implement-siglongjmp-for-AArch64.patch

Reply via email to