Fix EXITCALL code for WIN64 (support for home/shadow space)

This commit is contained in:
Dmitry Stogov 2023-03-07 11:25:22 +03:00
parent e88b6ab92d
commit 5e13d47e38

View File

@ -7062,6 +7062,9 @@ static void ir_emit_exitcall(ir_ctx *ctx, ir_ref def, ir_insn *insn)
| mov Ra(IR_REG_INT_ARG2), rsp | mov Ra(IR_REG_INT_ARG2), rsp
| mov aword [rsp+4*8], Ra(IR_REG_INT_ARG2) | mov aword [rsp+4*8], Ra(IR_REG_INT_ARG2)
| mov Ra(IR_REG_INT_ARG1), [rsp+16*8+16*8+8] | mov Ra(IR_REG_INT_ARG1), [rsp+16*8+16*8+8]
|.if X64WIN
| sub rsp, 32 /* shadow space */
|.endif
|.else |.else
| sub esp, 8*4+8*8+12 /* CPU regs + SSE regs */ | sub esp, 8*4+8*8+12 /* CPU regs + SSE regs */
| mov aword [esp+0*4], eax | mov aword [esp+0*4], eax
@ -7105,7 +7108,9 @@ static void ir_emit_exitcall(ir_ctx *ctx, ir_ref def, ir_insn *insn)
} }
// restore SP // restore SP
|.if X64 |.if X64WIN
| add rsp, 32+16*8+16*8+16 /* shadow space + CPU regs + SSE regs */
|.elif X64
| add rsp, 16*8+16*8+16 /* CPU regs + SSE regs */ | add rsp, 16*8+16*8+16 /* CPU regs + SSE regs */
|.else |.else
| add esp, 8*4+8*8+16 /* CPU regs + SSE regs */ | add esp, 8*4+8*8+16 /* CPU regs + SSE regs */