Fix Windows detection (#58)

This commit is contained in:
hyc 2019-06-10 14:59:25 +01:00 committed by tevador
parent cc2551b02b
commit eb6f6bb041

View File

@ -33,6 +33,10 @@
#define DECL(x) x #define DECL(x) x
#endif #endif
#if defined(__WIN32__) || defined(__CYGWIN__)
#define WINABI
#endif
.global DECL(randomx_program_prologue) .global DECL(randomx_program_prologue)
.global DECL(randomx_program_loop_begin) .global DECL(randomx_program_loop_begin)
.global DECL(randomx_program_loop_load) .global DECL(randomx_program_loop_load)
@ -61,7 +65,7 @@
.balign 64 .balign 64
DECL(randomx_program_prologue): DECL(randomx_program_prologue):
#if defined(__CYGWIN__) #if defined(WINABI)
#include "asm/program_prologue_win64.inc" #include "asm/program_prologue_win64.inc"
#else #else
#include "asm/program_prologue_linux.inc" #include "asm/program_prologue_linux.inc"
@ -107,7 +111,7 @@ DECL(randomx_dataset_init):
push r13 push r13
push r14 push r14
push r15 push r15
#if defined(__CYGWIN__) #if defined(WINABI)
push rdi push rdi
push rsi push rsi
mov rdi, qword ptr [rcx] ;# cache->memory mov rdi, qword ptr [rcx] ;# cache->memory
@ -140,7 +144,7 @@ call_offset:
cmp rbp, qword ptr [rsp] cmp rbp, qword ptr [rsp]
jb init_block_loop jb init_block_loop
pop rax pop rax
#if defined(__CYGWIN__) #if defined(WINABI)
pop rsi pop rsi
pop rdi pop rdi
#endif #endif
@ -155,7 +159,7 @@ call_offset:
.balign 64 .balign 64
DECL(randomx_program_epilogue): DECL(randomx_program_epilogue):
#include "asm/program_epilogue_store.inc" #include "asm/program_epilogue_store.inc"
#if defined(__CYGWIN__) #if defined(WINABI)
#include "asm/program_epilogue_win64.inc" #include "asm/program_epilogue_win64.inc"
#else #else
#include "asm/program_epilogue_linux.inc" #include "asm/program_epilogue_linux.inc"
@ -200,7 +204,7 @@ DECL(randomx_program_end):
nop nop
DECL(randomx_reciprocal_fast): DECL(randomx_reciprocal_fast):
#if !defined(__CYGWIN__) #if !defined(WINABI)
mov rcx, rdi mov rcx, rdi
#endif #endif
#include "asm/randomx_reciprocal.inc" #include "asm/randomx_reciprocal.inc"