aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-12-15 16:00:20 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-06-24 16:02:40 +0200
commit23a556f2c50c00dccec06f11d32eb9ca2d5e22f8 (patch)
treed255ccd3ebd011f89b65c7a141758b1f609cc484 /winsup
parent8b8c6c014bd9807c248ffe0cb8211e7714cc2241 (diff)
downloadnewlib-23a556f2c50c00dccec06f11d32eb9ca2d5e22f8.zip
newlib-23a556f2c50c00dccec06f11d32eb9ca2d5e22f8.tar.gz
newlib-23a556f2c50c00dccec06f11d32eb9ca2d5e22f8.tar.bz2
Drop has_set_thread_stack_guarantee flag
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/autoload.cc1
-rw-r--r--winsup/cygwin/dcrt0.cc8
-rw-r--r--winsup/cygwin/exceptions.cc7
-rw-r--r--winsup/cygwin/miscfuncs.cc84
-rw-r--r--winsup/cygwin/wincap.cc7
-rw-r--r--winsup/cygwin/wincap.h2
6 files changed, 37 insertions, 72 deletions
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index d9bf96b..a4a872e 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -588,7 +588,6 @@ LoadDLLfuncEx (IdnToUnicode, 20, kernel32, 1)
LoadDLLfunc (LocaleNameToLCID, 8, kernel32)
LoadDLLfuncEx (PrefetchVirtualMemory, 16, kernel32, 1)
LoadDLLfunc (SetThreadGroupAffinity, 12, kernel32)
-LoadDLLfunc (SetThreadStackGuarantee, 4, kernel32)
/* ldap functions are cdecl! */
#pragma push_macro ("mangle")
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 822e36e..2b8b9f5 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -443,11 +443,9 @@ child_info_fork::alloc_stack ()
api_fatal ("fork: couldn't allocate new stack guard page %p, %E",
stack_ptr);
}
- /* On post-XP systems, set thread stack guarantee matching the
- guardsize. Note that the guardsize is one page bigger than
- the guarantee. */
- if (wincap.has_set_thread_stack_guarantee ()
- && real_guardsize > wincap.def_guard_page_size ())
+ /* Set thread stack guarantee matching the guardsize.
+ Note that the guardsize is one page bigger than the guarantee. */
+ if (real_guardsize > wincap.def_guard_page_size ())
{
real_guardsize -= wincap.page_size ();
SetThreadStackGuarantee (&real_guardsize);
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 504fae4..d65f56e 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1581,10 +1581,9 @@ altstack_wrapper (int sig, siginfo_t *siginfo, ucontext_t *sigctx,
/* ...restore guard pages in original stack as if MSVCRT::_resetstkovlw
has been called.
- Compute size of guard pages. If SetThreadStackGuarantee isn't
- supported, or if it returns 0, use the default guard page size. */
- if (wincap.has_set_thread_stack_guarantee ())
- SetThreadStackGuarantee (&guard_size);
+ Compute size of guard pages. If SetThreadStackGuarantee returns 0,
+ use the default guard page size. */
+ SetThreadStackGuarantee (&guard_size);
if (!guard_size)
guard_size = wincap.def_guard_page_size ();
else
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 80fa954..d0e4bf7 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -609,10 +609,9 @@ pthread_wrapper (PVOID arg)
The below assembler code will release the OS stack after switching to our
new stack. */
wrapper_arg.stackaddr = dealloc_addr;
- /* On post-XP systems, set thread stack guarantee matching the guardsize.
+ /* Set thread stack guarantee matching the guardsize.
Note that the guardsize is one page bigger than the guarantee. */
- if (wincap.has_set_thread_stack_guarantee ()
- && wrapper_arg.guardsize > wincap.def_guard_page_size ())
+ if (wrapper_arg.guardsize > wincap.def_guard_page_size ())
{
wrapper_arg.guardsize -= wincap.page_size ();
SetThreadStackGuarantee (&wrapper_arg.guardsize);
@@ -877,59 +876,38 @@ CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
#endif
if (!real_stackaddr)
return NULL;
- /* Set up committed region. We have two cases: */
- if (!wincap.has_set_thread_stack_guarantee ()
- && real_guardsize != wincap.def_guard_page_size ())
+ /* Set up committed region. We set up the stack like the OS does,
+ with a reserved region, the guard pages, and a commited region.
+ We commit the stack commit size from the executable header, but
+ at least PTHREAD_STACK_MIN (64K). */
+ static ULONG exe_commitsize;
+
+ if (!exe_commitsize)
{
- /* If guardsize is set to something other than the default guard page
- size, and if we're running on Windows XP 32 bit, we commit the
- entire stack, and, if guardsize is > 0, set up a guard page. */
- real_stacklimit = (PBYTE) real_stackaddr + wincap.page_size ();
- if (real_guardsize
- && !VirtualAlloc (real_stacklimit, real_guardsize, MEM_COMMIT,
- PAGE_READWRITE | PAGE_GUARD))
- goto err;
- real_stacklimit += real_guardsize;
- if (!VirtualAlloc (real_stacklimit, real_stacksize - real_guardsize
- - wincap.page_size (),
- MEM_COMMIT, PAGE_READWRITE))
- goto err;
+ PIMAGE_DOS_HEADER dosheader;
+ PIMAGE_NT_HEADERS ntheader;
+
+ dosheader = (PIMAGE_DOS_HEADER) GetModuleHandle (NULL);
+ ntheader = (PIMAGE_NT_HEADERS)
+ ((PBYTE) dosheader + dosheader->e_lfanew);
+ exe_commitsize = ntheader->OptionalHeader.SizeOfStackCommit;
+ exe_commitsize = roundup2 (exe_commitsize, wincap.page_size ());
}
- else
- {
- /* Otherwise we set up the stack like the OS does, with a reserved
- region, the guard pages, and a commited region. We commit the
- stack commit size from the executable header, but at least
- PTHREAD_STACK_MIN (64K). */
- static ULONG exe_commitsize;
+ ULONG commitsize = exe_commitsize;
+ if (commitsize > real_stacksize - real_guardsize - wincap.page_size ())
+ commitsize = real_stacksize - real_guardsize - wincap.page_size ();
+ else if (commitsize < PTHREAD_STACK_MIN)
+ commitsize = PTHREAD_STACK_MIN;
+ real_stacklimit = (PBYTE) real_stackaddr + real_stacksize
+ - commitsize - real_guardsize;
+ if (!VirtualAlloc (real_stacklimit, real_guardsize, MEM_COMMIT,
+ PAGE_READWRITE | PAGE_GUARD))
+ goto err;
+ real_stacklimit += real_guardsize;
+ if (!VirtualAlloc (real_stacklimit, commitsize, MEM_COMMIT,
+ PAGE_READWRITE))
+ goto err;
- if (!exe_commitsize)
- {
- PIMAGE_DOS_HEADER dosheader;
- PIMAGE_NT_HEADERS ntheader;
-
- dosheader = (PIMAGE_DOS_HEADER) GetModuleHandle (NULL);
- ntheader = (PIMAGE_NT_HEADERS)
- ((PBYTE) dosheader + dosheader->e_lfanew);
- exe_commitsize = ntheader->OptionalHeader.SizeOfStackCommit;
- exe_commitsize = roundup2 (exe_commitsize, wincap.page_size ());
- }
- ULONG commitsize = exe_commitsize;
- if (commitsize > real_stacksize - real_guardsize
- - wincap.page_size ())
- commitsize = real_stacksize - real_guardsize - wincap.page_size ();
- else if (commitsize < PTHREAD_STACK_MIN)
- commitsize = PTHREAD_STACK_MIN;
- real_stacklimit = (PBYTE) real_stackaddr + real_stacksize
- - commitsize - real_guardsize;
- if (!VirtualAlloc (real_stacklimit, real_guardsize,
- MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD))
- goto err;
- real_stacklimit += real_guardsize;
- if (!VirtualAlloc (real_stacklimit, commitsize, MEM_COMMIT,
- PAGE_READWRITE))
- goto err;
- }
wrapper_arg->stackaddr = (PBYTE) real_stackaddr;
wrapper_arg->stackbase = (PBYTE) real_stackaddr + real_stacksize;
wrapper_arg->stacklimit = real_stacklimit;
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index caa3353..dd2bdff 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -29,7 +29,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
terminate_thread_frees_stack:false,
has_precise_system_time:false,
has_microsoft_accounts:false,
- has_set_thread_stack_guarantee:false,
has_broken_rtl_query_process_debug_information:false,
has_processor_groups:false,
has_broken_prefetchvm:false,
@@ -49,7 +48,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
terminate_thread_frees_stack:false,
has_precise_system_time:false,
has_microsoft_accounts:false,
- has_set_thread_stack_guarantee:true,
has_broken_rtl_query_process_debug_information:true,
has_processor_groups:false,
has_broken_prefetchvm:false,
@@ -69,7 +67,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
terminate_thread_frees_stack:true,
has_precise_system_time:false,
has_microsoft_accounts:false,
- has_set_thread_stack_guarantee:true,
has_broken_rtl_query_process_debug_information:false,
has_processor_groups:false,
has_broken_prefetchvm:false,
@@ -89,7 +86,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
terminate_thread_frees_stack:true,
has_precise_system_time:false,
has_microsoft_accounts:false,
- has_set_thread_stack_guarantee:true,
has_broken_rtl_query_process_debug_information:false,
has_processor_groups:true,
has_broken_prefetchvm:false,
@@ -109,7 +105,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
terminate_thread_frees_stack:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
- has_set_thread_stack_guarantee:true,
has_broken_rtl_query_process_debug_information:false,
has_processor_groups:true,
has_broken_prefetchvm:false,
@@ -129,7 +124,6 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = {
terminate_thread_frees_stack:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
- has_set_thread_stack_guarantee:true,
has_broken_rtl_query_process_debug_information:false,
has_processor_groups:true,
has_broken_prefetchvm:true,
@@ -149,7 +143,6 @@ wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) =
terminate_thread_frees_stack:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
- has_set_thread_stack_guarantee:true,
has_broken_rtl_query_process_debug_information:false,
has_processor_groups:true,
has_broken_prefetchvm:false,
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index d7ba0ec..b3e6134 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -22,7 +22,6 @@ struct wincaps
unsigned terminate_thread_frees_stack : 1;
unsigned has_precise_system_time : 1;
unsigned has_microsoft_accounts : 1;
- unsigned has_set_thread_stack_guarantee : 1;
unsigned has_broken_rtl_query_process_debug_information : 1;
unsigned has_processor_groups : 1;
unsigned has_broken_prefetchvm : 1;
@@ -67,7 +66,6 @@ public:
bool IMPLEMENT (terminate_thread_frees_stack)
bool IMPLEMENT (has_precise_system_time)
bool IMPLEMENT (has_microsoft_accounts)
- bool IMPLEMENT (has_set_thread_stack_guarantee)
bool IMPLEMENT (has_broken_rtl_query_process_debug_information)
bool IMPLEMENT (has_processor_groups)
bool IMPLEMENT (has_broken_prefetchvm)