Browse Source
only use MAP_FIXED_NOREPLACE on linux
remotes/1785372757367212240/tmp_refs/heads/variable-page-size
Exverge
1 month ago
No known key found for this signature in database
GPG Key ID: DAD399BCC5FB77E4
1 changed files with
6 additions and
0 deletions
-
src/common/host_memory.cpp
|
|
|
@ -399,6 +399,10 @@ private: |
|
|
|
#ifdef ARCHITECTURE_arm64
|
|
|
|
|
|
|
|
#ifndef __APPLE__
|
|
|
|
|
|
|
|
#ifndef MAP_FIXED_NOREPLACE
|
|
|
|
#define MAP_FIXED_NOREPLACE 0
|
|
|
|
#endif
|
|
|
|
static void* ChooseVirtualBase(size_t virtual_size) { |
|
|
|
constexpr uintptr_t Map39BitSize = (1ULL << 39); |
|
|
|
constexpr uintptr_t Map36BitSize = (1ULL << 36); |
|
|
|
@ -427,11 +431,13 @@ static void* ChooseVirtualBase(size_t virtual_size) { |
|
|
|
return map_pointer; |
|
|
|
} |
|
|
|
|
|
|
|
#if MAP_FIXED_NOREPLACE == 0
|
|
|
|
// Unmap if necessary, and try again.
|
|
|
|
if (map_pointer != MAP_FAILED) { |
|
|
|
munmap(map_pointer, virtual_size); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
return MAP_FAILED; |
|
|
|
} |
|
|
|
|