Fix set-callstack primitive on Windows

db4
Slava Pestov 2010-01-07 19:31:15 +13:00
parent a04b85a45e
commit 1f88a925b4
3 changed files with 18 additions and 6 deletions

View File

@ -126,12 +126,13 @@ IN: bootstrap.x86
! Compute new stack pointer -- 'dst' for memcpy ! Compute new stack pointer -- 'dst' for memcpy
EAX EDX SUB EAX EDX SUB
! Install new stack pointer ! Install new stack pointer
RSP EAX MOV ESP EAX MOV
! Call memcpy ! Call memcpy
ESP 8 [+] EDX MOV EDX PUSH
ESP 4 [+] EBP MOV EBP PUSH
ESP [] EAX MOV EAX PUSH
0 CALL "memcpy" f rc-relative jit-dlsym 0 CALL "factor_memcpy" f rc-relative jit-dlsym
ESP 12 ADD
! Return with new callstack ! Return with new callstack
0 RET 0 RET
] \ set-callstack define-sub-primitive ] \ set-callstack define-sub-primitive

View File

@ -121,8 +121,12 @@ IN: bootstrap.x86
! Install new stack pointer ! Install new stack pointer
RSP arg1 MOV RSP arg1 MOV
! Call memcpy; arguments are now in the correct registers ! 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 safe-reg CALL
! Tear down register shadow area
RSP 32 ADD
! Return with new callstack ! Return with new callstack
0 RET 0 RET
] \ set-callstack define-sub-primitive ] \ set-callstack define-sub-primitive

View File

@ -18,4 +18,11 @@ cell read_cell_hex()
return cell; 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);
}
} }