diff --git a/src/crypto/asm/cn_main_loop.S b/src/crypto/asm/cn_main_loop.S index 417fd414..e9ac64f5 100644 --- a/src/crypto/asm/cn_main_loop.S +++ b/src/crypto/asm/cn_main_loop.S @@ -19,7 +19,10 @@ FN_PREFIX(cnv2_mainloop_ivybridge_asm): #include "cn2/cnv2_main_loop_ivybridge.inc" add rsp, 48 ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop ALIGN 16 FN_PREFIX(cnv2_mainloop_ryzen_asm): @@ -28,7 +31,10 @@ FN_PREFIX(cnv2_mainloop_ryzen_asm): #include "cn2/cnv2_main_loop_ryzen.inc" add rsp, 48 ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop ALIGN 16 FN_PREFIX(cnv2_mainloop_bulldozer_asm): @@ -37,7 +43,10 @@ FN_PREFIX(cnv2_mainloop_bulldozer_asm): #include "cn2/cnv2_main_loop_bulldozer.inc" add rsp, 48 ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop ALIGN 16 FN_PREFIX(cnv2_double_mainloop_sandybridge_asm): @@ -47,4 +56,7 @@ FN_PREFIX(cnv2_double_mainloop_sandybridge_asm): #include "cn2/cnv2_double_main_loop_sandybridge.inc" add rsp, 48 ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop diff --git a/src/crypto/asm/cn_main_loop.asm b/src/crypto/asm/cn_main_loop.asm index 9d4cede0..9c8a6ea9 100644 --- a/src/crypto/asm/cn_main_loop.asm +++ b/src/crypto/asm/cn_main_loop.asm @@ -8,28 +8,40 @@ ALIGN 64 cnv2_mainloop_ivybridge_asm PROC INCLUDE cn2/cnv2_main_loop_ivybridge.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_mainloop_ivybridge_asm ENDP ALIGN 64 cnv2_mainloop_ryzen_asm PROC INCLUDE cn2/cnv2_main_loop_ryzen.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_mainloop_ryzen_asm ENDP ALIGN 64 cnv2_mainloop_bulldozer_asm PROC INCLUDE cn2/cnv2_main_loop_bulldozer.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_mainloop_bulldozer_asm ENDP ALIGN 64 cnv2_double_mainloop_sandybridge_asm PROC INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_double_mainloop_sandybridge_asm ENDP _TEXT_CNV2_MAINLOOP ENDS diff --git a/src/crypto/asm/win64/cn_main_loop.S b/src/crypto/asm/win64/cn_main_loop.S index 4caaa1a1..ea5a63b8 100644 --- a/src/crypto/asm/win64/cn_main_loop.S +++ b/src/crypto/asm/win64/cn_main_loop.S @@ -10,22 +10,34 @@ ALIGN 16 cnv2_mainloop_ivybridge_asm: #include "../cn2/cnv2_main_loop_ivybridge.inc" ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop ALIGN 16 cnv2_mainloop_ryzen_asm: #include "../cn2/cnv2_main_loop_ryzen.inc" ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop ALIGN 16 cnv2_mainloop_bulldozer_asm: #include "../cn2/cnv2_main_loop_bulldozer.inc" ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop ALIGN 16 cnv2_double_mainloop_sandybridge_asm: #include "../cn2/cnv2_double_main_loop_sandybridge.inc" ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop diff --git a/src/crypto/asm/win64/cn_main_loop.asm b/src/crypto/asm/win64/cn_main_loop.asm index 9d4cede0..9c8a6ea9 100644 --- a/src/crypto/asm/win64/cn_main_loop.asm +++ b/src/crypto/asm/win64/cn_main_loop.asm @@ -8,28 +8,40 @@ ALIGN 64 cnv2_mainloop_ivybridge_asm PROC INCLUDE cn2/cnv2_main_loop_ivybridge.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_mainloop_ivybridge_asm ENDP ALIGN 64 cnv2_mainloop_ryzen_asm PROC INCLUDE cn2/cnv2_main_loop_ryzen.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_mainloop_ryzen_asm ENDP ALIGN 64 cnv2_mainloop_bulldozer_asm PROC INCLUDE cn2/cnv2_main_loop_bulldozer.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_mainloop_bulldozer_asm ENDP ALIGN 64 cnv2_double_mainloop_sandybridge_asm PROC INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc ret 0 - nop;nop;nop;nop; + nop + nop + nop + nop cnv2_double_mainloop_sandybridge_asm ENDP _TEXT_CNV2_MAINLOOP ENDS diff --git a/src/workers/CpuThread.cpp b/src/workers/CpuThread.cpp index 8f3457dc..cf366860 100644 --- a/src/workers/CpuThread.cpp +++ b/src/workers/CpuThread.cpp @@ -57,10 +57,15 @@ xmrig::CpuThread::CpuThread(size_t index, Algo algorithm, AlgoVariant av, Multiw #ifndef XMRIG_NO_ASM template -static void patchCode(T& dst, U src, const uint32_t iterations, const uint32_t mask) +static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t mask) { const uint8_t* p = reinterpret_cast(src); + // Workaround for Visual Studio placing trampoline in debug builds + if (p[0] == 0xE9) { + p += *(int32_t*)(p + 1) + 5; + } + size_t size = 0; while (*(uint32_t*)(p + size) != 0x90909090) { ++size;