Moved common memory primitives to new VirtualMemory class.

This commit is contained in:
XMRig 2019-06-02 19:43:56 +07:00
parent 4b3592f60f
commit fc655d1b8d
10 changed files with 242 additions and 72 deletions

View file

@ -29,6 +29,7 @@
typedef void(*void_func)();
#include "crypto/asm/CryptonightR_template.h"
#include "crypto/common/VirtualMemory.h"
#include "Mem.h"
@ -109,7 +110,7 @@ void wow_compile_code(const V4_Instruction* code, int code_size, void* machine_c
*(int*)(p - 4) = static_cast<int>((((const uint8_t*)CryptonightWOW_template_mainloop) - ((const uint8_t*)CryptonightWOW_template_part1)) - (p - p0));
add_code(p, CryptonightWOW_template_part3, CryptonightWOW_template_end);
Mem::flushInstructionCache(machine_code, p - p0);
xmrig::VirtualMemory::flushInstructionCache(machine_code, p - p0);
}
void v4_compile_code(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
@ -123,7 +124,7 @@ void v4_compile_code(const V4_Instruction* code, int code_size, void* machine_co
*(int*)(p - 4) = static_cast<int>((((const uint8_t*)CryptonightR_template_mainloop) - ((const uint8_t*)CryptonightR_template_part1)) - (p - p0));
add_code(p, CryptonightR_template_part3, CryptonightR_template_end);
Mem::flushInstructionCache(machine_code, p - p0);
xmrig::VirtualMemory::flushInstructionCache(machine_code, p - p0);
}
void wow_compile_code_double(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
@ -139,7 +140,7 @@ void wow_compile_code_double(const V4_Instruction* code, int code_size, void* ma
*(int*)(p - 4) = static_cast<int>((((const uint8_t*)CryptonightWOW_template_double_mainloop) - ((const uint8_t*)CryptonightWOW_template_double_part1)) - (p - p0));
add_code(p, CryptonightWOW_template_double_part4, CryptonightWOW_template_double_end);
Mem::flushInstructionCache(machine_code, p - p0);
xmrig::VirtualMemory::flushInstructionCache(machine_code, p - p0);
}
void v4_compile_code_double(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
@ -155,7 +156,7 @@ void v4_compile_code_double(const V4_Instruction* code, int code_size, void* mac
*(int*)(p - 4) = static_cast<int>((((const uint8_t*)CryptonightR_template_double_mainloop) - ((const uint8_t*)CryptonightR_template_double_part1)) - (p - p0));
add_code(p, CryptonightR_template_double_part4, CryptonightR_template_double_end);
Mem::flushInstructionCache(machine_code, p - p0);
xmrig::VirtualMemory::flushInstructionCache(machine_code, p - p0);
}
void wow_soft_aes_compile_code(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
@ -169,7 +170,7 @@ void wow_soft_aes_compile_code(const V4_Instruction* code, int code_size, void*
*(int*)(p - 4) = static_cast<int>((((const uint8_t*)CryptonightWOW_soft_aes_template_mainloop) - ((const uint8_t*)CryptonightWOW_soft_aes_template_part1)) - (p - p0));
add_code(p, CryptonightWOW_soft_aes_template_part3, CryptonightWOW_soft_aes_template_end);
Mem::flushInstructionCache(machine_code, p - p0);
xmrig::VirtualMemory::flushInstructionCache(machine_code, p - p0);
}
void v4_soft_aes_compile_code(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
@ -183,5 +184,5 @@ void v4_soft_aes_compile_code(const V4_Instruction* code, int code_size, void* m
*(int*)(p - 4) = static_cast<int>((((const uint8_t*)CryptonightR_soft_aes_template_mainloop) - ((const uint8_t*)CryptonightR_soft_aes_template_part1)) - (p - p0));
add_code(p, CryptonightR_soft_aes_template_part3, CryptonightR_soft_aes_template_end);
Mem::flushInstructionCache(machine_code, p - p0);
xmrig::VirtualMemory::flushInstructionCache(machine_code, p - p0);
}