[PATCH] Cygwin: stack base initialization for AArch64
Radek Barton
radek.barton@microsoft.com
Wed Jun 18 16:02:31 GMT 2025
Hello.
This patch ports stack base initialization at dcrt0.cc to AArch64.
Radek
---
>From 5d470261d9b865bf709f9f4d8da350e3536e6251 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] 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..15b3479d3 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\
+ sub sp, fp, #32 \n"
+ : : [ADDR] "r" (stackaddr)
+ : "memory");
#else
#error unimplemented for this target
#endif
--
2.49.0.vfs.0.4
More information about the Cygwin-patches
mailing list