Hi Radek,

On Jun 24 19:21, Radek Barton via Cygwin-patches wrote:
> Hello
> 
> Finally we've managed to rule out that the regressions were actually 
> introduced by 
> https://sourceware.org/pipermail/cygwin-patches/2025q2/013832.html, Thiru 
> will send the fix soon.
> 
> Radek
> 
> ---
> >From c33f2e1b0037f9e5a3dbae4a0c82070db851cb33 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.bar...@microsoft.com>
> Date: Thu, 5 Jun 2025 13:15:22 +0200
> Subject: [PATCH v3] Cygwin: stack base initialization for AArch64
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Signed-off-by: Radek BartoĊˆ <radek.bar...@microsoft.com>
> ---
>  winsup/cygwin/dcrt0.cc | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
> index f4c09befd..3dceae654 100644
> --- a/winsup/cygwin/dcrt0.cc
> +++ b/winsup/cygwin/dcrt0.cc
> @@ -1030,14 +1030,20 @@ _dll_crt0 ()
>         PVOID stackaddr = create_new_main_thread_stack (allocationbase);
>         if (stackaddr)
>           {
> -#ifdef __x86_64__
>             /* Set stack pointer to new address.  Set frame pointer to
>                stack pointer and subtract 32 bytes for shadow space. */
> +#if defined(__x86_64__)

The comment in terms of the 32 byte shadow space is now in the wrong spot.
Splitting out this part would probably help the reader.

>             __asm__ ("\n\
>                      movq %[ADDR], %%rsp \n\
>                      movq  %%rsp, %%rbp  \n\
>                      subq  $32,%%rsp     \n"
>                      : : [ADDR] "r" (stackaddr));
> +#elif defined(__aarch64__)
> +           __asm__ ("\n\
> +                    mov fp, %[ADDR] \n\
> +                    mov sp, fp      \n"
> +                    : : [ADDR] "r" (stackaddr)
> +                    : "memory");
>  #else
>  #error unimplemented for this target
>  #endif
> -- 
> 2.49.0.vfs.0.4

Thanks,
Corinna

Reply via email to