diff --git a/winsup/cygwin/local_includes/memory_layout.h b/winsup/cygwin/local_includes/memory_layout.h index 6a4b7a28a..481215b06 100644 --- a/winsup/cygwin/local_includes/memory_layout.h +++ b/winsup/cygwin/local_includes/memory_layout.h @@ -56,3 +56,6 @@ details. */ Set the lowest address to leave ~32 Gigs for heap. */ #define MMAP_STORAGE_LOW 0x001000000000UL #define MMAP_STORAGE_HIGH 0x700000000000UL + +/* Default number of pages used as thread stack guard pages. */ +#define DEFAULT_GUARD_PAGE_COUNT 3 diff --git a/winsup/cygwin/local_includes/wincap.h b/winsup/cygwin/local_includes/wincap.h index d5579e7ea..c6dbd2311 100644 --- a/winsup/cygwin/local_includes/wincap.h +++ b/winsup/cygwin/local_includes/wincap.h @@ -9,9 +9,10 @@ details. */ #ifndef _WINCAP_H #define _WINCAP_H +#include "memory_layout.h" + struct wincaps { - DWORD def_guard_pages; /* The bitfields must be 8 byte aligned on x86_64, otherwise the bitfield ops generated by gcc are off by 4 bytes. */ struct __attribute__ ((aligned (8))) { @@ -64,7 +65,7 @@ public: DWORD def_guard_page_size () const { - return ((wincaps *) this->caps)->def_guard_pages * page_size (); + return DEFAULT_GUARD_PAGE_COUNT * page_size (); } bool IMPLEMENT (is_server) bool IMPLEMENT (has_new_pebteb_region) diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 7aefde48c..702d99e15 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -20,7 +20,6 @@ details. */ puzzled that this has never been noticed before... */ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:2, { is_server:false, has_new_pebteb_region:false, @@ -43,7 +42,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { }; wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:false, @@ -66,7 +64,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { }; wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:false, @@ -89,7 +86,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = { }; wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:false, @@ -112,7 +108,6 @@ wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared)) }; wincaps wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:false, @@ -135,7 +130,6 @@ wincaps wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared)) }; wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true, @@ -158,7 +152,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) = }; wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true, @@ -181,7 +174,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) = }; wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true, @@ -204,7 +196,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) = }; wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true, @@ -227,7 +218,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) = }; wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true, @@ -250,7 +240,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) = }; wincaps wincap_10_2004 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true, @@ -273,7 +262,6 @@ wincaps wincap_10_2004 __attribute__((section (".cygwin_dll_common"), shared)) = }; wincaps wincap_11 __attribute__((section (".cygwin_dll_common"), shared)) = { - def_guard_pages:3, { is_server:false, has_new_pebteb_region:true,