mirror of
https://codeberg.org/wownero/RandomWOW.git
synced 2026-10-18 05:51:40 +02:00
Optional W^X policy for JIT pages (#112)
This commit is contained in:
@@ -32,23 +32,39 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
namespace randomx {
|
||||
|
||||
template<class Allocator, bool softAes>
|
||||
void CompiledLightVm<Allocator, softAes>::setCache(randomx_cache* cache) {
|
||||
template<class Allocator, bool softAes, bool secureJit>
|
||||
void CompiledLightVm<Allocator, softAes, secureJit>::setCache(randomx_cache* cache) {
|
||||
cachePtr = cache;
|
||||
mem.memory = cache->memory;
|
||||
if (secureJit) {
|
||||
compiler.enableWriting();
|
||||
}
|
||||
compiler.generateSuperscalarHash(cache->programs, cache->reciprocalCache);
|
||||
if (secureJit) {
|
||||
compiler.enableExecution();
|
||||
}
|
||||
}
|
||||
|
||||
template<class Allocator, bool softAes>
|
||||
void CompiledLightVm<Allocator, softAes>::run(void* seed) {
|
||||
template<class Allocator, bool softAes, bool secureJit>
|
||||
void CompiledLightVm<Allocator, softAes, secureJit>::run(void* seed) {
|
||||
VmBase<Allocator, softAes>::generateProgram(seed);
|
||||
randomx_vm::initialize();
|
||||
if (secureJit) {
|
||||
compiler.enableWriting();
|
||||
}
|
||||
compiler.generateProgramLight(program, config, datasetOffset);
|
||||
CompiledVm<Allocator, softAes>::execute();
|
||||
if (secureJit) {
|
||||
compiler.enableExecution();
|
||||
}
|
||||
CompiledVm<Allocator, softAes, secureJit>::execute();
|
||||
}
|
||||
|
||||
template class CompiledLightVm<AlignedAllocator<CacheLineSize>, false>;
|
||||
template class CompiledLightVm<AlignedAllocator<CacheLineSize>, true>;
|
||||
template class CompiledLightVm<LargePageAllocator, false>;
|
||||
template class CompiledLightVm<LargePageAllocator, true>;
|
||||
template class CompiledLightVm<AlignedAllocator<CacheLineSize>, false, false>;
|
||||
template class CompiledLightVm<AlignedAllocator<CacheLineSize>, true, false>;
|
||||
template class CompiledLightVm<LargePageAllocator, false, false>;
|
||||
template class CompiledLightVm<LargePageAllocator, true, false>;
|
||||
template class CompiledLightVm<AlignedAllocator<CacheLineSize>, false, true>;
|
||||
template class CompiledLightVm<AlignedAllocator<CacheLineSize>, true, true>;
|
||||
template class CompiledLightVm<LargePageAllocator, false, true>;
|
||||
template class CompiledLightVm<LargePageAllocator, true, true>;
|
||||
}
|
||||
Reference in New Issue
Block a user