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

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