mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 18:11:05 +00:00
Fixed crash in patchCode() on Linux
This commit is contained in:
parent
118e547175
commit
6425c53d61
5 changed files with 18 additions and 65 deletions
|
@ -23,10 +23,7 @@ FN_PREFIX(cnv2_mainloop_ivybridge_asm):
|
||||||
#include "cn2/cnv2_main_loop_ivybridge.inc"
|
#include "cn2/cnv2_main_loop_ivybridge.inc"
|
||||||
add rsp, 48
|
add rsp, 48
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
FN_PREFIX(cnv2_mainloop_ryzen_asm):
|
FN_PREFIX(cnv2_mainloop_ryzen_asm):
|
||||||
|
@ -35,10 +32,7 @@ FN_PREFIX(cnv2_mainloop_ryzen_asm):
|
||||||
#include "cn2/cnv2_main_loop_ryzen.inc"
|
#include "cn2/cnv2_main_loop_ryzen.inc"
|
||||||
add rsp, 48
|
add rsp, 48
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
FN_PREFIX(cnv2_mainloop_bulldozer_asm):
|
FN_PREFIX(cnv2_mainloop_bulldozer_asm):
|
||||||
|
@ -47,10 +41,7 @@ FN_PREFIX(cnv2_mainloop_bulldozer_asm):
|
||||||
#include "cn2/cnv2_main_loop_bulldozer.inc"
|
#include "cn2/cnv2_main_loop_bulldozer.inc"
|
||||||
add rsp, 48
|
add rsp, 48
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
FN_PREFIX(cnv2_double_mainloop_sandybridge_asm):
|
FN_PREFIX(cnv2_double_mainloop_sandybridge_asm):
|
||||||
|
@ -60,7 +51,4 @@ FN_PREFIX(cnv2_double_mainloop_sandybridge_asm):
|
||||||
#include "cn2/cnv2_double_main_loop_sandybridge.inc"
|
#include "cn2/cnv2_double_main_loop_sandybridge.inc"
|
||||||
add rsp, 48
|
add rsp, 48
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
|
@ -8,40 +8,28 @@ ALIGN(64)
|
||||||
cnv2_mainloop_ivybridge_asm PROC
|
cnv2_mainloop_ivybridge_asm PROC
|
||||||
INCLUDE cn2/cnv2_main_loop_ivybridge.inc
|
INCLUDE cn2/cnv2_main_loop_ivybridge.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_mainloop_ivybridge_asm ENDP
|
cnv2_mainloop_ivybridge_asm ENDP
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
cnv2_mainloop_ryzen_asm PROC
|
cnv2_mainloop_ryzen_asm PROC
|
||||||
INCLUDE cn2/cnv2_main_loop_ryzen.inc
|
INCLUDE cn2/cnv2_main_loop_ryzen.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_mainloop_ryzen_asm ENDP
|
cnv2_mainloop_ryzen_asm ENDP
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
cnv2_mainloop_bulldozer_asm PROC
|
cnv2_mainloop_bulldozer_asm PROC
|
||||||
INCLUDE cn2/cnv2_main_loop_bulldozer.inc
|
INCLUDE cn2/cnv2_main_loop_bulldozer.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_mainloop_bulldozer_asm ENDP
|
cnv2_mainloop_bulldozer_asm ENDP
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
cnv2_double_mainloop_sandybridge_asm PROC
|
cnv2_double_mainloop_sandybridge_asm PROC
|
||||||
INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc
|
INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_double_mainloop_sandybridge_asm ENDP
|
cnv2_double_mainloop_sandybridge_asm ENDP
|
||||||
|
|
||||||
_TEXT_CNV2_MAINLOOP ENDS
|
_TEXT_CNV2_MAINLOOP ENDS
|
||||||
|
|
|
@ -10,34 +10,22 @@ ALIGN(64)
|
||||||
cnv2_mainloop_ivybridge_asm:
|
cnv2_mainloop_ivybridge_asm:
|
||||||
#include "../cn2/cnv2_main_loop_ivybridge.inc"
|
#include "../cn2/cnv2_main_loop_ivybridge.inc"
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
cnv2_mainloop_ryzen_asm:
|
cnv2_mainloop_ryzen_asm:
|
||||||
#include "../cn2/cnv2_main_loop_ryzen.inc"
|
#include "../cn2/cnv2_main_loop_ryzen.inc"
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
cnv2_mainloop_bulldozer_asm:
|
cnv2_mainloop_bulldozer_asm:
|
||||||
#include "../cn2/cnv2_main_loop_bulldozer.inc"
|
#include "../cn2/cnv2_main_loop_bulldozer.inc"
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
ALIGN(64)
|
ALIGN(64)
|
||||||
cnv2_double_mainloop_sandybridge_asm:
|
cnv2_double_mainloop_sandybridge_asm:
|
||||||
#include "../cn2/cnv2_double_main_loop_sandybridge.inc"
|
#include "../cn2/cnv2_double_main_loop_sandybridge.inc"
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
|
@ -8,40 +8,28 @@ ALIGN 64
|
||||||
cnv2_mainloop_ivybridge_asm PROC
|
cnv2_mainloop_ivybridge_asm PROC
|
||||||
INCLUDE cn2/cnv2_main_loop_ivybridge.inc
|
INCLUDE cn2/cnv2_main_loop_ivybridge.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_mainloop_ivybridge_asm ENDP
|
cnv2_mainloop_ivybridge_asm ENDP
|
||||||
|
|
||||||
ALIGN 64
|
ALIGN 64
|
||||||
cnv2_mainloop_ryzen_asm PROC
|
cnv2_mainloop_ryzen_asm PROC
|
||||||
INCLUDE cn2/cnv2_main_loop_ryzen.inc
|
INCLUDE cn2/cnv2_main_loop_ryzen.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_mainloop_ryzen_asm ENDP
|
cnv2_mainloop_ryzen_asm ENDP
|
||||||
|
|
||||||
ALIGN 64
|
ALIGN 64
|
||||||
cnv2_mainloop_bulldozer_asm PROC
|
cnv2_mainloop_bulldozer_asm PROC
|
||||||
INCLUDE cn2/cnv2_main_loop_bulldozer.inc
|
INCLUDE cn2/cnv2_main_loop_bulldozer.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_mainloop_bulldozer_asm ENDP
|
cnv2_mainloop_bulldozer_asm ENDP
|
||||||
|
|
||||||
ALIGN 64
|
ALIGN 64
|
||||||
cnv2_double_mainloop_sandybridge_asm PROC
|
cnv2_double_mainloop_sandybridge_asm PROC
|
||||||
INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc
|
INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc
|
||||||
ret 0
|
ret 0
|
||||||
nop
|
mov eax, 0xDEADC0DE
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
cnv2_double_mainloop_sandybridge_asm ENDP
|
cnv2_double_mainloop_sandybridge_asm ENDP
|
||||||
|
|
||||||
_TEXT_CNV2_MAINLOOP ENDS
|
_TEXT_CNV2_MAINLOOP ENDS
|
||||||
|
|
|
@ -69,9 +69,10 @@ static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t ma
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
while (*(uint32_t*)(p + size) != 0x90909090) {
|
while (*(uint32_t*)(p + size) != 0xDEADC0DE) {
|
||||||
++size;
|
++size;
|
||||||
}
|
}
|
||||||
|
size += sizeof(uint32_t);
|
||||||
|
|
||||||
memcpy((void*) dst, (const void*) src, size);
|
memcpy((void*) dst, (const void*) src, size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue