xmrig v6.3.2 merge

This commit is contained in:
MoneroOcean 2020-08-20 08:57:55 -07:00
commit 651306a57a
25 changed files with 473 additions and 57 deletions

View file

@ -193,18 +193,18 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase()
fillAes4Rx4_Key[6] = rx_set_int_vec_i128(0xf63befa7, 0x2ba9660a, 0xf765a38b, 0xf273c9e7);
fillAes4Rx4_Key[7] = rx_set_int_vec_i128(0xc0b0762d, 0x0c06d1fd, 0x915839de, 0x7a7cd609);
# if defined(_M_X64) || defined(__x86_64__)
// Workaround for Visual Studio placing trampoline in debug builds.
auto addr = [](void (*func)()) {
const uint8_t* p = reinterpret_cast<const uint8_t*>(func);
# if defined(_MSC_VER)
# if defined(_MSC_VER)
if (p[0] == 0xE9) {
p += *(const int32_t*)(p + 1) + 5;
}
# endif
# endif
return p;
};
#if defined(_M_X64) || defined(__x86_64__)
{
const uint8_t* a = addr(randomx_sshash_prefetch);
const uint8_t* b = addr(randomx_sshash_end);
@ -232,17 +232,21 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase()
const uint8_t* b = addr(randomx_prefetch_scratchpad_end);
memcpy(codePrefetchScratchpadTweaked, a, b - a);
}
#endif
# endif
}
static uint32_t Log2(size_t value) { return (value > 1) ? (Log2(value / 2) + 1) : 0; }
void RandomX_ConfigurationBase::Apply()
{
ScratchpadL1Mask_Calculated = (ScratchpadL1_Size / sizeof(uint64_t) - 1) * 8;
ScratchpadL1Mask16_Calculated = (ScratchpadL1_Size / sizeof(uint64_t) / 2 - 1) * 16;
ScratchpadL2Mask_Calculated = (ScratchpadL2_Size / sizeof(uint64_t) - 1) * 8;
ScratchpadL2Mask16_Calculated = (ScratchpadL2_Size / sizeof(uint64_t) / 2 - 1) * 16;
const uint32_t ScratchpadL1Mask_Calculated = (ScratchpadL1_Size / sizeof(uint64_t) - 1) * 8;
const uint32_t ScratchpadL2Mask_Calculated = (ScratchpadL2_Size / sizeof(uint64_t) - 1) * 8;
AddressMask_Calculated[0] = ScratchpadL2Mask_Calculated;
AddressMask_Calculated[1] = ScratchpadL1Mask_Calculated;
AddressMask_Calculated[2] = ScratchpadL1Mask_Calculated;
AddressMask_Calculated[3] = ScratchpadL1Mask_Calculated;
ScratchpadL3Mask_Calculated = (((ScratchpadL3_Size / sizeof(uint64_t)) - 1) * 8);
ScratchpadL3Mask64_Calculated = ((ScratchpadL3_Size / sizeof(uint64_t)) / 8 - 1) * 64;