]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: simplify create_new_main_thread_stack
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 3 May 2022 12:34:42 +0000 (14:34 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 3 May 2022 12:39:28 +0000 (14:39 +0200)
Originally the function was designed to be used in forked
processes as well, but it has never been used this way. Drop
the parameter only required for forkees.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/dcrt0.cc
winsup/cygwin/miscfuncs.cc
winsup/cygwin/miscfuncs.h

index e757c47ecaa8c3b1ab511955b1edf1ba4e6797c3..dee8482c274ecb61689fdae594acea169bdf531d 100644 (file)
@@ -1064,11 +1064,7 @@ _dll_crt0 ()
          /* Must be static since it's referenced after the stack and frame
             pointer registers have been changed. */
          static PVOID allocationbase;
-         SIZE_T commitsize = in_forkee ? (PBYTE) fork_info->stackbase
-                                         - (PBYTE) fork_info->stacklimit
-                                       : 0;
-         PVOID stackaddr = create_new_main_thread_stack (allocationbase,
-                                                         commitsize);
+         PVOID stackaddr = create_new_main_thread_stack (allocationbase);
          if (stackaddr)
            {
              /* Set stack pointer to new address.  Set frame pointer to
index fcb08221691299546d8c07296c818a1a694c5b37..905c242c53f16245b73102145881400b605bc6d5 100644 (file)
@@ -629,7 +629,7 @@ thread_allocator thr_alloc NO_COPY;
    maintained by the thr_alloc class.  See the description in the x86_64-only
    code in _dll_crt0 to understand why we have to do this. */
 PVOID
-create_new_main_thread_stack (PVOID &allocationbase, SIZE_T parent_commitsize)
+create_new_main_thread_stack (PVOID &allocationbase)
 {
   PIMAGE_DOS_HEADER dosheader;
   PIMAGE_NT_HEADERS ntheader;
@@ -647,10 +647,7 @@ create_new_main_thread_stack (PVOID &allocationbase, SIZE_T parent_commitsize)
   allocationbase
        = thr_alloc.alloc (ntheader->OptionalHeader.SizeOfStackReserve);
   guardsize = wincap.def_guard_page_size ();
-  if (parent_commitsize)
-    commitsize = (SIZE_T) parent_commitsize;
-  else
-    commitsize = ntheader->OptionalHeader.SizeOfStackCommit;
+  commitsize = ntheader->OptionalHeader.SizeOfStackCommit;
   commitsize = roundup2 (commitsize, wincap.page_size ());
   if (commitsize > stacksize - guardsize - wincap.page_size ())
     commitsize = stacksize - guardsize - wincap.page_size ();
index 47cef6f20c0a547439a39a805581147a51c17a7a..f571031ebe7619a2d12cabdf5ed6911c25c1be10 100644 (file)
@@ -109,8 +109,7 @@ ssize_t __reg3 check_iovec (const struct iovec *, int, bool);
 #define check_iovec_for_write(a, b) check_iovec ((a), (b), true)
 
 #ifdef __x86_64__
-extern PVOID create_new_main_thread_stack (PVOID &allocationbase,
-                                          SIZE_T parent_commitsize);
+extern PVOID create_new_main_thread_stack (PVOID &allocationbase);
 #endif
 
 extern "C" DWORD WINAPI pthread_wrapper (PVOID arg);
This page took 0.031058 seconds and 5 git commands to generate.