[PATCH v3] Cygwin: stack base initialization for AArch64
Radek Barton
radek.barton@microsoft.com
Tue Jun 24 19:21:36 GMT 2025
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.barton@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.barton@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__)
__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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-Cygwin-stack-base-initialization-for-AArch64.patch
Type: application/octet-stream
Size: 1351 bytes
Desc: v3-0001-Cygwin-stack-base-initialization-for-AArch64.patch
URL: <https://cygwin.com/pipermail/cygwin-patches/attachments/20250624/c2af8823/attachment-0001.obj>
More information about the Cygwin-patches
mailing list