diff --git a/basis/cpu/x86/32/bootstrap.factor b/basis/cpu/x86/32/bootstrap.factor index afcae6d4d9..8a5e43da31 100644 --- a/basis/cpu/x86/32/bootstrap.factor +++ b/basis/cpu/x86/32/bootstrap.factor @@ -126,12 +126,13 @@ IN: bootstrap.x86 ! Compute new stack pointer -- 'dst' for memcpy EAX EDX SUB ! Install new stack pointer - RSP EAX MOV + ESP EAX MOV ! Call memcpy - ESP 8 [+] EDX MOV - ESP 4 [+] EBP MOV - ESP [] EAX MOV - 0 CALL "memcpy" f rc-relative jit-dlsym + EDX PUSH + EBP PUSH + EAX PUSH + 0 CALL "factor_memcpy" f rc-relative jit-dlsym + ESP 12 ADD ! Return with new callstack 0 RET ] \ set-callstack define-sub-primitive diff --git a/basis/cpu/x86/64/bootstrap.factor b/basis/cpu/x86/64/bootstrap.factor index 55dba215d7..2d0296e159 100644 --- a/basis/cpu/x86/64/bootstrap.factor +++ b/basis/cpu/x86/64/bootstrap.factor @@ -121,8 +121,12 @@ IN: bootstrap.x86 ! Install new stack pointer RSP arg1 MOV ! Call memcpy; arguments are now in the correct registers - safe-reg 0 MOV "memcpy" f rc-absolute-cell jit-dlsym + ! Create register shadow area for Win64 + RSP 32 SUB + safe-reg 0 MOV "factor_memcpy" f rc-absolute-cell jit-dlsym safe-reg CALL + ! Tear down register shadow area + RSP 32 ADD ! Return with new callstack 0 RET ] \ set-callstack define-sub-primitive diff --git a/vm/utilities.cpp b/vm/utilities.cpp index 8f063a9ad4..3e976d0619 100755 --- a/vm/utilities.cpp +++ b/vm/utilities.cpp @@ -18,4 +18,11 @@ cell read_cell_hex() return cell; } +/* On Windows, memcpy() is in a different DLL and the non-optimizing +compiler can't find it */ +VM_C_API void *factor_memcpy(void *dst, void *src, size_t len) +{ + return memcpy(dst,src,len); +} + }