6 #if defined(HAVE_AS_CFI_PSEUDO_OP)
7 .cfi_sections .debug_frame
15 #ifdef SYMBOL_UNDERSCORE
16 #define SYMBOL_NAME(name) _##name
18 #define SYMBOL_NAME(name) name
28 /* ffi_call_win64 (void *stack, struct win64_call_frame *frame, void *r10)
30 Bit o trickiness here -- FRAME is the base of the stack frame
31 for this function. This has been allocated by ffi_call. We also
32 deallocate some of the stack that has been alloca'd. */
37 .seh_proc ffi_call_win64
40 /* Set up the local stack frame and install it in rbp/rsp. */
46 cfi_rel_offset(%rbp, 0)
54 /* Load all slots into both general and xmm registers. */
69 cmpl $FFI_TYPE_SMALL_STRUCT_4B, %ecx
70 leaq (%r10, %rcx, 8), %r10
74 /* Below, we're space constrained most of the time. Thus we eschew the
75 modern "mov, pop, ret" sequence (5 bytes) for "leave, ret" (2 bytes). */
136 E FFI_TYPE_SMALL_STRUCT_1B
139 E FFI_TYPE_SMALL_STRUCT_2B
142 E FFI_TYPE_SMALL_STRUCT_4B
155 /* 32 bytes of outgoing register stack space, 8 bytes of alignment,
156 16 bytes of result, 32 bytes of xmm registers. */
157 #define ffi_clo_FS (32+8+16+32)
158 #define ffi_clo_OFF_R (32+8)
159 #define ffi_clo_OFF_X (32+8+16)
162 .globl ffi_go_closure_win64
164 .seh_proc ffi_go_closure_win64
165 ffi_go_closure_win64:
167 /* Save all integer arguments into the incoming reg stack space. */
173 movq 8(%r10), arg0 /* load cif */
174 movq 16(%r10), arg1 /* load fun */
175 movq %r10, arg2 /* closure is user_data */
181 .globl ffi_closure_win64
183 .seh_proc ffi_closure_win64
186 /* Save all integer arguments into the incoming reg stack space. */
192 movq FFI_TRAMPOLINE_SIZE(%r10), arg0 /* load cif */
193 movq FFI_TRAMPOLINE_SIZE+8(%r10), arg1 /* load fun */
194 movq FFI_TRAMPOLINE_SIZE+16(%r10), arg2 /* load user_data */
196 subq $ffi_clo_FS, %rsp
197 cfi_adjust_cfa_offset(ffi_clo_FS)
198 .seh_stackalloc ffi_clo_FS
201 /* Save all sse arguments into the stack frame. */
202 movsd %xmm0, ffi_clo_OFF_X(%rsp)
203 movsd %xmm1, ffi_clo_OFF_X+8(%rsp)
204 movsd %xmm2, ffi_clo_OFF_X+16(%rsp)
205 movsd %xmm3, ffi_clo_OFF_X+24(%rsp)
207 leaq ffi_clo_OFF_R(%rsp), arg3
208 call ffi_closure_win64_inner
210 /* Load the result into both possible result registers. */
211 movq ffi_clo_OFF_R(%rsp), %rax
212 movsd ffi_clo_OFF_R(%rsp), %xmm0
214 addq $ffi_clo_FS, %rsp
215 cfi_adjust_cfa_offset(-ffi_clo_FS)