mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-22 10:45:06 +00:00
Fix: secure JIT and huge pages are incompatible on Windows
This commit is contained in:
parent
cc5c2c41be
commit
f89f6a8abf
1 changed files with 9 additions and 3 deletions
|
@ -175,11 +175,11 @@ namespace randomx {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompilerX86::enableWriting() const {
|
void JitCompilerX86::enableWriting() const {
|
||||||
xmrig::VirtualMemory::protectRW(allocatedCode, allocatedSize);
|
xmrig::VirtualMemory::protectRW(code, CodeSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompilerX86::enableExecution() const {
|
void JitCompilerX86::enableExecution() const {
|
||||||
xmrig::VirtualMemory::protectRX(allocatedCode, allocatedSize);
|
xmrig::VirtualMemory::protectRX(code, CodeSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void cpuid(uint32_t level, int32_t output[4])
|
static inline void cpuid(uint32_t level, int32_t output[4])
|
||||||
|
@ -213,7 +213,13 @@ namespace randomx {
|
||||||
hasXOP = ((info[2] & (1 << 11)) != 0);
|
hasXOP = ((info[2] & (1 << 11)) != 0);
|
||||||
|
|
||||||
allocatedSize = CodeSize * 2;
|
allocatedSize = CodeSize * 2;
|
||||||
allocatedCode = static_cast<uint8_t*>(allocExecutableMemory(allocatedSize, hugePagesJIT && hugePagesEnable));
|
allocatedCode = static_cast<uint8_t*>(allocExecutableMemory(allocatedSize,
|
||||||
|
# ifdef XMRIG_SECURE_JIT
|
||||||
|
false
|
||||||
|
# else
|
||||||
|
hugePagesJIT && hugePagesEnable
|
||||||
|
# endif
|
||||||
|
));
|
||||||
|
|
||||||
// Shift code base address to improve caching - all threads will use different L2/L3 cache sets
|
// Shift code base address to improve caching - all threads will use different L2/L3 cache sets
|
||||||
code = allocatedCode + (codeOffset.fetch_add(codeOffsetIncrement) % CodeSize);
|
code = allocatedCode + (codeOffset.fetch_add(codeOffsetIncrement) % CodeSize);
|
||||||
|
|
Loading…
Reference in a new issue