Merge pull request #2378 from SChernykh/dev

Fixed broken light mode mining on x86
This commit is contained in:
xmrig 2021-05-16 07:03:57 +07:00 committed by GitHub
commit c8c40586a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -320,7 +320,7 @@ namespace randomx {
vm_flags = flags; vm_flags = flags;
generateProgramPrologue(prog, pcfg); generateProgramPrologue(prog, pcfg, false);
uint8_t* p; uint8_t* p;
uint32_t n; uint32_t n;
@ -339,7 +339,7 @@ namespace randomx {
} }
void JitCompilerX86::generateProgramLight(Program& prog, ProgramConfiguration& pcfg, uint32_t datasetOffset) { void JitCompilerX86::generateProgramLight(Program& prog, ProgramConfiguration& pcfg, uint32_t datasetOffset) {
generateProgramPrologue(prog, pcfg); generateProgramPrologue(prog, pcfg, true);
emit(RandomX_CurrentConfig.codeReadDatasetLightSshInitTweaked, readDatasetLightInitSize, code, codePos); emit(RandomX_CurrentConfig.codeReadDatasetLightSshInitTweaked, readDatasetLightInitSize, code, codePos);
*(uint32_t*)(code + codePos) = 0xc381; *(uint32_t*)(code + codePos) = 0xc381;
codePos += 2; codePos += 2;
@ -415,7 +415,7 @@ namespace randomx {
} }
} }
void JitCompilerX86::generateProgramPrologue(Program& prog, ProgramConfiguration& pcfg) { void JitCompilerX86::generateProgramPrologue(Program& prog, ProgramConfiguration& pcfg, bool light) {
codePos = ADDR(randomx_program_prologue_first_load) - ADDR(randomx_program_prologue); codePos = ADDR(randomx_program_prologue_first_load) - ADDR(randomx_program_prologue);
*(uint32_t*)(code + codePos + 4) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated; *(uint32_t*)(code + codePos + 4) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated;
*(uint32_t*)(code + codePos + 14) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated; *(uint32_t*)(code + codePos + 14) = RandomX_CurrentConfig.ScratchpadL3Mask64_Calculated;
@ -429,7 +429,7 @@ namespace randomx {
# endif # endif
imul_rcp_storage = code + (ADDR(randomx_program_imul_rcp_store) - codePrologue) + 2; imul_rcp_storage = code + (ADDR(randomx_program_imul_rcp_store) - codePrologue) + 2;
imul_rcp_storage_used = 0; imul_rcp_storage_used = light ? 0xFFFFFFFFUL : 0;
memcpy(imul_rcp_storage - 34, &pcfg.eMask, sizeof(pcfg.eMask)); memcpy(imul_rcp_storage - 34, &pcfg.eMask, sizeof(pcfg.eMask));
codePos = codePosFirst; codePos = codePosFirst;

View file

@ -107,7 +107,7 @@ namespace randomx {
uint8_t* imul_rcp_storage = nullptr; uint8_t* imul_rcp_storage = nullptr;
uint32_t imul_rcp_storage_used = 0; uint32_t imul_rcp_storage_used = 0;
void generateProgramPrologue(Program&, ProgramConfiguration&); void generateProgramPrologue(Program&, ProgramConfiguration&, bool light);
void generateProgramEpilogue(Program&, ProgramConfiguration&); void generateProgramEpilogue(Program&, ProgramConfiguration&);
template<bool rax> template<bool rax>
static void genAddressReg(const Instruction&, const uint32_t src, uint8_t* code, uint32_t& codePos); static void genAddressReg(const Instruction&, const uint32_t src, uint8_t* code, uint32_t& codePos);