Merge pull request #2080 from SChernykh/dev

This commit is contained in:
xmrig 2021-02-04 04:29:59 +07:00 committed by GitHub
commit 1c63e9efba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,18 +65,13 @@
#endif
namespace xmrig {
#ifdef XMRIG_OS_LINUX
#if defined(XMRIG_OS_LINUX) || (!defined(XMRIG_OS_APPLE) && !defined(__FreeBSD__))
static inline int hugePagesFlag(size_t size)
{
return (static_cast<int>(log2(size)) & MAP_HUGE_MASK) << MAP_HUGE_SHIFT;
}
#endif
} // namespace xmrig
bool xmrig::VirtualMemory::isHugepagesAvailable()
{
@ -165,7 +160,7 @@ void *xmrig::VirtualMemory::allocateExecutableMemory(size_t size, bool hugePages
void *xmrig::VirtualMemory::allocateLargePagesMemory(size_t size)
{
# if defined(__APPLE__)
# if defined(XMRIG_OS_APPLE)
void *mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0);
# elif defined(__FreeBSD__)
void *mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER | MAP_PREFAULT_READ, -1, 0);