mirror of
https://github.com/xmrig/xmrig.git
synced 2026-02-02 02:03:03 -05:00
Support for Cryptonight variant 4 (Monero)
This commit is contained in:
@@ -58,7 +58,7 @@ static inline void add_random_math(uint8_t* &p, const V4_Instruction* code, int
|
||||
|
||||
const uint32_t a = inst.dst_index;
|
||||
const uint32_t b = inst.src_index;
|
||||
const uint8_t c = opcode | (dst_index << V4_OPCODE_BITS) | (src_index << (V4_OPCODE_BITS + V4_DST_INDEX_BITS));
|
||||
const uint8_t c = opcode | (dst_index << V4_OPCODE_BITS) | (((src_index == 8) ? dst_index : src_index) << (V4_OPCODE_BITS + V4_DST_INDEX_BITS));
|
||||
|
||||
switch (inst.opcode) {
|
||||
case ROR:
|
||||
@@ -99,6 +99,20 @@ static inline void add_random_math(uint8_t* &p, const V4_Instruction* code, int
|
||||
}
|
||||
}
|
||||
|
||||
void wow_compile_code(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
|
||||
{
|
||||
uint8_t* p0 = reinterpret_cast<uint8_t*>(machine_code);
|
||||
uint8_t* p = p0;
|
||||
|
||||
add_code(p, CryptonightWOW_template_part1, CryptonightWOW_template_part2);
|
||||
add_random_math(p, code, code_size, instructions, instructions_mov, false, ASM);
|
||||
add_code(p, CryptonightWOW_template_part2, CryptonightWOW_template_part3);
|
||||
*(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);
|
||||
}
|
||||
|
||||
void v4_compile_code(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
|
||||
{
|
||||
uint8_t* p0 = reinterpret_cast<uint8_t*>(machine_code);
|
||||
@@ -113,6 +127,22 @@ void v4_compile_code(const V4_Instruction* code, int code_size, void* machine_co
|
||||
Mem::flushInstructionCache(machine_code, p - p0);
|
||||
}
|
||||
|
||||
void wow_compile_code_double(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
|
||||
{
|
||||
uint8_t* p0 = reinterpret_cast<uint8_t*>(machine_code);
|
||||
uint8_t* p = p0;
|
||||
|
||||
add_code(p, CryptonightWOW_template_double_part1, CryptonightWOW_template_double_part2);
|
||||
add_random_math(p, code, code_size, instructions, instructions_mov, false, ASM);
|
||||
add_code(p, CryptonightWOW_template_double_part2, CryptonightWOW_template_double_part3);
|
||||
add_random_math(p, code, code_size, instructions, instructions_mov, false, ASM);
|
||||
add_code(p, CryptonightWOW_template_double_part3, CryptonightWOW_template_double_part4);
|
||||
*(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);
|
||||
}
|
||||
|
||||
void v4_compile_code_double(const V4_Instruction* code, int code_size, void* machine_code, xmrig::Assembly ASM)
|
||||
{
|
||||
uint8_t* p0 = reinterpret_cast<uint8_t*>(machine_code);
|
||||
|
||||
Reference in New Issue
Block a user