diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc index e18cd5508..b839c8cd4 100644 --- a/winsup/cygwin/heap.cc +++ b/winsup/cygwin/heap.cc @@ -34,9 +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. - So we let the heap start at 0x6:00000000L. */ - uintptr_t start_address = 0x600000000L; + in the region from 0x4:00000000L up to 0x6:00000000L. Leave another + 8 Gigs slack space, so lets start the heap at 0x8:00000000L. */ + uintptr_t start_address = 0x800000000L; #else /* Windows performs heap ASLR. This spoils the entire region below 0x20000000 for us, because that region is used by Windows to randomize diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 9eb1643a0..8b1aedc48 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -801,8 +801,10 @@ mmap_worker (mmap_list *map_list, fhandler_base *fh, caddr_t base, size_t len, #ifdef __x86_64__ /* The memory region used for memory maps */ -#define MMAP_STORAGE_LOW 0x00800000000L /* Leave 8 Gigs for heap. */ -#define MMAP_STORAGE_HIGH 0x70000000000L /* Leave enough room for OS. */ +#define MMAP_STORAGE_LOW 0x001000000000L /* Leave 32 Gigs for heap. */ +/* Up to Win 8 only supporting 44 bit address space, starting with Win 8.1 + 48 bit address space. */ +#define MMAP_STORAGE_HIGH wincap.mmap_storage_high () /* FIXME? Unfortunately the OS doesn't support a top down allocation with a ceiling value. The ZeroBits mechanism only works for diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 17e0cf1be..5c6e6428e 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -20,6 +20,7 @@ details. */ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:1, + mmap_storage_high:0x070000000000LL, { is_server:false, needs_count_in_si_lpres2:true, @@ -46,6 +47,7 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:1, + mmap_storage_high:0x070000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -72,6 +74,7 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x070000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -98,6 +101,7 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x700000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -124,6 +128,7 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x700000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -150,6 +155,7 @@ wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared)) wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x700000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -176,6 +182,7 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) = wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x700000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -202,6 +209,7 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) = wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x700000000000LL, { is_server:false, needs_count_in_si_lpres2:false, @@ -228,6 +236,7 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) = wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) = { def_guard_pages:2, + mmap_storage_high:0x700000000000LL, { is_server:false, needs_count_in_si_lpres2:false, diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 73b6f5ffc..ba01a1565 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -12,6 +12,7 @@ details. */ struct wincaps { DWORD def_guard_pages; + int64_t mmap_storage_high; /* 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))) { @@ -71,6 +72,9 @@ public: { return ((wincaps *) this->caps)->def_guard_pages * page_size (); } +#ifdef __x86_64__ + intptr_t IMPLEMENT (mmap_storage_high) +#endif bool IMPLEMENT (is_server) bool IMPLEMENT (needs_count_in_si_lpres2) bool IMPLEMENT (needs_query_information)