Hi all,

Please find the attached patch which adds an ARM64 stub for the `sigsetjmp ` 
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 fdb970f6f..f85c8cf74 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -611,7 +611,28 @@ EOF
        # TODO: These are only stubs, they need to be implemented properly for 
AArch64.
        return <<EOF;
        .globl  sigsetjmp
+       .seh_proc sigsetjmp
 sigsetjmp:
+       // prologue
+       stp             fp, lr, [sp, #-0x10]!   // save FP and LR registers
+       mov             fp, sp                  // set FP to current SP
+       .seh_endprologue
+       str     w1, [x0, #0x100]                // buf->savemask = savemask
+       cbz     w1, 1f                          // If savemask == 0, skip 
fetching sigmask
+       mov     x3, x0                          // save buf in x3
+       sub     sp, sp, #32                     // Allocate 32 bytes on stack 
call
+       mov     x0, #0                          // SIG_SETMASK
+       mov     x1, xzr                         // newmask = NULL
+       add     x2, x3, #0x108                  // &buf->sigmask
+       bl      pthread_sigmask
+       add     sp, sp, #32
+1:
+       bl      setjmp
+       // epilogue
+       ldp     fp, lr, [sp], #0x10             // restore saved FP and LR 
registers
+       ret
+       .seh_endproc
+

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

Reply via email to