Mercurial > repos > blastem
diff gen_x86.c @ 1828:37afb9cf58be
Get 64-bit builds working for Windows target
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 07 Apr 2019 00:06:29 -0700 |
parents | 5453aafa0656 |
children | a79e92929044 |
line wrap: on
line diff
--- a/gen_x86.c Sat Apr 06 21:38:11 2019 -0700 +++ b/gen_x86.c Sun Apr 07 00:06:29 2019 -0700 @@ -2111,7 +2111,12 @@ } #ifdef X86_64 uint32_t stack_args = 0; +#ifdef _WIN32 + //Microsoft is too good for the ABI that everyone else uses on x86-64 apparently + uint8_t abi_regs[] = {RCX, RDX, R8, R9}; +#else uint8_t abi_regs[] = {RDI, RSI, RDX, RCX, R8, R9}; +#endif int8_t reg_swap[R15+1]; uint32_t usage = 0; memset(reg_swap, -1, sizeof(reg_swap)); @@ -2153,6 +2158,11 @@ push_r(code, arg_arr[i]); } free(arg_arr); +#if defined(X86_64) && defined(_WIN32) + sub_ir(code, 32, RSP, SZ_PTR); + code->stack_off += 32; + adjust += 32; +#endif return stack_args * sizeof(void *) + adjust; }