Cygwin: Allow accessing 48 bit address space in Windows 8.1 or later

64 bit Windows started out with a 44 bit address space due to a
restriction of the AMD64 CPUs at the time.  Starting with Windows
8.1, these CPUs are not supported anymore and Windows switched to
the full 48 bit address space supported by AMD64.

Cygwin didn't follow suit yet so mmaps are still restricted to
the lower 44 bit address space.  Fix that by using a system-specific
upper address for mmap allocations, 44 bit up to Windows 8, 48 bit
starting with Windows 8.1.

While at it, move the heap by another 8 Gigs to leave some space
for a potential extension of DLL address space, and restrict the
mmap lower address so the heap can grow to 32 Gigs before colliding
with mmaps.
This commit is contained in:
Corinna Vinschen
2019-06-04 16:58:53 +02:00
parent f03ea8e1c5
commit e1254add73
4 changed files with 20 additions and 5 deletions

View File

@@ -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