memory fix

This commit is contained in:
Nekotekina 2017-02-10 22:56:16 +03:00
parent 73906f9f29
commit bb111d325f
5 changed files with 15 additions and 8 deletions

View file

@ -207,9 +207,9 @@ struct MemoryManager final : llvm::RTDyldMemoryManager
LOG_FATAL(GENERAL, "VirtualFree(%p) failed! Error %u", s_memory, GetLastError());
}
#else
if (::mprotect(s_memory, s_memory_size, PROT_NONE))
if (!::mmap(s_memory, s_memory_size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0))
{
LOG_FATAL(GENERAL, "mprotect(%p) failed! Error %d", s_memory, errno);
LOG_FATAL(GENERAL, "mmap(%p) failed! Error %d", s_memory, errno);
}
// TODO: unregister EH frames if necessary