public inbox for
help / color / mirror / Atom feed
From: Corinna Vinschen <>
Subject: [newlib-cygwin] Cygwin: move x86_64 thread stack area
Date: Tue,  3 May 2022 13:16:51 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=28970dae34522059e094eb7db466404facb09460

commit 28970dae34522059e094eb7db466404facb09460
Author: Corinna Vinschen <>
Date:   Tue May 3 15:10:24 2022 +0200

    Cygwin: move x86_64 thread stack area
    The x86_64 thread stack area collides with the share user data in
    recent versions of Windows. Let's get ourselvels get out of the
    way and move the thread stack area in the former slack space
    between DLL area and heap, from 0x6:00000000 to 0x8:00000000.
    That quadruplicates the stack area, so allow bigger maximum stack
    Signed-off-by: Corinna Vinschen <>

 winsup/cygwin/      |  5 +++--
 winsup/cygwin/ | 11 ++++++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/ b/winsup/cygwin/
index f27f81bc4..fa2c8391e 100644
--- a/winsup/cygwin/
+++ b/winsup/cygwin/
@@ -34,8 +34,9 @@ eval_start_address ()
      executable starts at 0x1:00400000L, the Cygwin DLL starts at
      0x1:80040000L, other rebased DLLs are located in the region from
      0x2:00000000L up to 0x4:00000000L, -auto-image-based DLLs are located
-     in the region from 0x4:00000000L up to 0x6:00000000L.  Leave another
-     8 Gigs slack space, so lets start the heap at 0x8:00000000L. */
+     in the region from 0x4:00000000L up to 0x6:00000000L.  Thread stacks
+     are located in the region from 0x6:00000000L up to 0x8:00000000L.
+     So the heap starts at 0x8:00000000L. */
   uintptr_t start_address = 0x800000000L;
   /* Windows performs heap ASLR.  This spoils the entire region below
diff --git a/winsup/cygwin/ b/winsup/cygwin/
index 905c242c5..4a5db6f2e 100644
--- a/winsup/cygwin/
+++ b/winsup/cygwin/
@@ -513,13 +513,14 @@ pthread_wrapper (PVOID arg)
 #ifdef __x86_64__
-/* The memory region used for thread stacks */
-#define THREAD_STORAGE_LOW	0x080000000L
-#define THREAD_STORAGE_HIGH	0x100000000L
+/* The memory region used for thread stacks. The memory layout is outlined
+   in, function eval_start_address(). */
+#define THREAD_STORAGE_LOW	0x600000000L
+#define THREAD_STORAGE_HIGH	0x800000000L
 /* We provide the stacks always in 1 Megabyte slots */
-#define THREAD_STACK_SLOT	0x100000L	/* 1 Meg */
+#define THREAD_STACK_SLOT	0x000100000L	/* 1 Meg */
 /* Maximum stack size returned from the pool. */
-#define THREAD_STACK_MAX	0x10000000L	/* 256 Megs */
+#define THREAD_STACK_MAX	0x040000000L	/* 1 Gig */
 class thread_allocator

                 reply	other threads:[~2022-05-03 13:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).