mirror of
https://github.com/xmrig/xmrig.git
synced 2024-10-30 04:57:39 +00:00
Fixed RandomX initialization for VS debug builds
This commit is contained in:
parent
70c7f33a20
commit
5bc89fdc8b
1 changed files with 21 additions and 10 deletions
|
@ -165,32 +165,43 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase()
|
||||||
fillAes4Rx4_Key[6] = rx_set_int_vec_i128(0xf63befa7, 0x2ba9660a, 0xf765a38b, 0xf273c9e7);
|
fillAes4Rx4_Key[6] = rx_set_int_vec_i128(0xf63befa7, 0x2ba9660a, 0xf765a38b, 0xf273c9e7);
|
||||||
fillAes4Rx4_Key[7] = rx_set_int_vec_i128(0xc0b0762d, 0x0c06d1fd, 0x915839de, 0x7a7cd609);
|
fillAes4Rx4_Key[7] = rx_set_int_vec_i128(0xc0b0762d, 0x0c06d1fd, 0x915839de, 0x7a7cd609);
|
||||||
|
|
||||||
|
// 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 (p[0] == 0xE9) {
|
||||||
|
p += *(const int32_t*)(p + 1) + 5;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
return p;
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(_M_X64) || defined(__x86_64__)
|
#if defined(_M_X64) || defined(__x86_64__)
|
||||||
{
|
{
|
||||||
const uint8_t* a = (const uint8_t*)&randomx_sshash_prefetch;
|
const uint8_t* a = addr(randomx_sshash_prefetch);
|
||||||
const uint8_t* b = (const uint8_t*)&randomx_sshash_end;
|
const uint8_t* b = addr(randomx_sshash_end);
|
||||||
memcpy(codeShhPrefetchTweaked, a, b - a);
|
memcpy(codeShhPrefetchTweaked, a, b - a);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const uint8_t* a = (const uint8_t*)&randomx_program_read_dataset;
|
const uint8_t* a = addr(randomx_program_read_dataset);
|
||||||
const uint8_t* b = (const uint8_t*)&randomx_program_read_dataset_ryzen;
|
const uint8_t* b = addr(randomx_program_read_dataset_ryzen);
|
||||||
memcpy(codeReadDatasetTweaked, a, b - a);
|
memcpy(codeReadDatasetTweaked, a, b - a);
|
||||||
codeReadDatasetTweakedSize = b - a;
|
codeReadDatasetTweakedSize = b - a;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const uint8_t* a = (const uint8_t*)&randomx_program_read_dataset_ryzen;
|
const uint8_t* a = addr(randomx_program_read_dataset_ryzen);
|
||||||
const uint8_t* b = (const uint8_t*)&randomx_program_read_dataset_sshash_init;
|
const uint8_t* b = addr(randomx_program_read_dataset_sshash_init);
|
||||||
memcpy(codeReadDatasetRyzenTweaked, a, b - a);
|
memcpy(codeReadDatasetRyzenTweaked, a, b - a);
|
||||||
codeReadDatasetRyzenTweakedSize = b - a;
|
codeReadDatasetRyzenTweakedSize = b - a;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const uint8_t* a = (const uint8_t*)&randomx_program_read_dataset_sshash_init;
|
const uint8_t* a = addr(randomx_program_read_dataset_sshash_init);
|
||||||
const uint8_t* b = (const uint8_t*)&randomx_program_read_dataset_sshash_fin;
|
const uint8_t* b = addr(randomx_program_read_dataset_sshash_fin);
|
||||||
memcpy(codeReadDatasetLightSshInitTweaked, a, b - a);
|
memcpy(codeReadDatasetLightSshInitTweaked, a, b - a);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const uint8_t* a = (const uint8_t*)&randomx_prefetch_scratchpad;
|
const uint8_t* a = addr(randomx_prefetch_scratchpad);
|
||||||
const uint8_t* b = (const uint8_t*)&randomx_prefetch_scratchpad_end;
|
const uint8_t* b = addr(randomx_prefetch_scratchpad_end);
|
||||||
memcpy(codePrefetchScratchpadTweaked, a, b - a);
|
memcpy(codePrefetchScratchpadTweaked, a, b - a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue