In dlls/ntdlls/virtual.c around line 1033 in NtAllocateVirtualMemory:
NTSTATUS res=anon_mmap_aligned( &base, size,VIRTUAL_GetUnixProt( vprot ), 0 ); if (res) return res;
Why is mmap used here rather than just a malloc/calloc to the OS ? If I can convert this call to a calloc then the ADDRESS_SPACE_LIMIT test will pass on Solaris.
Can someone give me some insight here ?
Bob
Robert Lunnon bob@yarrabee.net.au writes:
In dlls/ntdlls/virtual.c around line 1033 in NtAllocateVirtualMemory:
NTSTATUS res=anon_mmap_aligned( &base, size,VIRTUAL_GetUnixProt( vprot ), 0 ); if (res) return res;
Why is mmap used here rather than just a malloc/calloc to the OS ? If I can convert this call to a calloc then the ADDRESS_SPACE_LIMIT test will pass on Solaris.
No, you need an mmap. What you have to do is write a routine that allocates (with mmap) all available memory above ADDRESS_SPACE_LIMIT to make sure following mmap calls can't allocate there; and that routine can then be called the first time mmap returns such an address, so that it will work for all platforms that may have that problem.