diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /contrib/restricted/libffi/src/x86/win64.S | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/libffi/src/x86/win64.S')
-rw-r--r-- | contrib/restricted/libffi/src/x86/win64.S | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/contrib/restricted/libffi/src/x86/win64.S b/contrib/restricted/libffi/src/x86/win64.S index 2c334c82f9..ed60453d94 100644 --- a/contrib/restricted/libffi/src/x86/win64.S +++ b/contrib/restricted/libffi/src/x86/win64.S @@ -1,50 +1,50 @@ #ifdef __x86_64__ -#define LIBFFI_ASM -#include <fficonfig.h> -#include <ffi.h> +#define LIBFFI_ASM +#include <fficonfig.h> +#include <ffi.h> #include <ffi_cfi.h> #include "asmnames.h" - + #if defined(HAVE_AS_CFI_PSEUDO_OP) .cfi_sections .debug_frame #endif - + #ifdef X86_WIN64 #define SEH(...) __VA_ARGS__ #define arg0 %rcx #define arg1 %rdx #define arg2 %r8 #define arg3 %r9 -#else +#else #define SEH(...) #define arg0 %rdi #define arg1 %rsi #define arg2 %rdx #define arg3 %rcx #endif - + /* This macro allows the safe creation of jump tables without an actual table. The entry points into the table are all 8 bytes. The use of ORG asserts that we're at the correct location. */ /* ??? The clang assembler doesn't handle .org with symbolic expressions. */ #if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__)) # define E(BASE, X) .balign 8 -#else +#else # define E(BASE, X) .balign 8; .org BASE + X * 8 -#endif - +#endif + .text - + /* ffi_call_win64 (void *stack, struct win64_call_frame *frame, void *r10) - + Bit o trickiness here -- FRAME is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ - + .align 8 .globl C(ffi_call_win64) FFI_HIDDEN(C(ffi_call_win64)) - + SEH(.seh_proc ffi_call_win64) C(ffi_call_win64): cfi_startproc @@ -59,9 +59,9 @@ C(ffi_call_win64): SEH(.seh_setframe %rbp, 0) SEH(.seh_endprologue) movq arg0, %rsp - + movq arg2, %r10 - + /* Load all slots into both general and xmm registers. */ movq (%rsp), %rcx movsd (%rsp), %xmm0 @@ -71,9 +71,9 @@ C(ffi_call_win64): movsd 16(%rsp), %xmm2 movq 24(%rsp), %r9 movsd 24(%rsp), %xmm3 - + call *16(%rbp) - + movl 24(%rbp), %ecx movq 32(%rbp), %r8 leaq 0f(%rip), %r10 @@ -81,7 +81,7 @@ C(ffi_call_win64): leaq (%r10, %rcx, 8), %r10 ja 99f jmp *%r10 - + /* Below, we're space constrained most of the time. Thus we eschew the modern "mov, pop, ret" sequence (5 bytes) for "leave, ret" (2 bytes). */ .macro epilogue @@ -92,7 +92,7 @@ C(ffi_call_win64): ret cfi_restore_state .endm - + .align 8 0: E(0b, FFI_TYPE_VOID) @@ -153,26 +153,26 @@ E(0b, FFI_TYPE_SMALL_STRUCT_2B) E(0b, FFI_TYPE_SMALL_STRUCT_4B) movl %eax, (%r8) epilogue - + .align 8 99: call PLT(C(abort)) - + epilogue - + cfi_endproc SEH(.seh_endproc) - - + + /* 32 bytes of outgoing register stack space, 8 bytes of alignment, 16 bytes of result, 32 bytes of xmm registers. */ #define ffi_clo_FS (32+8+16+32) #define ffi_clo_OFF_R (32+8) #define ffi_clo_OFF_X (32+8+16) - + .align 8 .globl C(ffi_go_closure_win64) FFI_HIDDEN(C(ffi_go_closure_win64)) - + SEH(.seh_proc ffi_go_closure_win64) C(ffi_go_closure_win64): cfi_startproc @@ -181,18 +181,18 @@ C(ffi_go_closure_win64): movq %rdx, 16(%rsp) movq %r8, 24(%rsp) movq %r9, 32(%rsp) - + movq 8(%r10), %rcx /* load cif */ movq 16(%r10), %rdx /* load fun */ movq %r10, %r8 /* closure is user_data */ jmp 0f cfi_endproc SEH(.seh_endproc) - + .align 8 .globl C(ffi_closure_win64) FFI_HIDDEN(C(ffi_closure_win64)) - + SEH(.seh_proc ffi_closure_win64) C(ffi_closure_win64): cfi_startproc @@ -201,7 +201,7 @@ C(ffi_closure_win64): movq %rdx, 16(%rsp) movq %r8, 24(%rsp) movq %r9, 32(%rsp) - + movq FFI_TRAMPOLINE_SIZE(%r10), %rcx /* load cif */ movq FFI_TRAMPOLINE_SIZE+8(%r10), %rdx /* load fun */ movq FFI_TRAMPOLINE_SIZE+16(%r10), %r8 /* load user_data */ @@ -210,28 +210,28 @@ C(ffi_closure_win64): cfi_adjust_cfa_offset(ffi_clo_FS) SEH(.seh_stackalloc ffi_clo_FS) SEH(.seh_endprologue) - + /* Save all sse arguments into the stack frame. */ movsd %xmm0, ffi_clo_OFF_X(%rsp) movsd %xmm1, ffi_clo_OFF_X+8(%rsp) movsd %xmm2, ffi_clo_OFF_X+16(%rsp) movsd %xmm3, ffi_clo_OFF_X+24(%rsp) - + leaq ffi_clo_OFF_R(%rsp), %r9 call PLT(C(ffi_closure_win64_inner)) - + /* Load the result into both possible result registers. */ movq ffi_clo_OFF_R(%rsp), %rax movsd ffi_clo_OFF_R(%rsp), %xmm0 - + addq $ffi_clo_FS, %rsp cfi_adjust_cfa_offset(-ffi_clo_FS) ret - + cfi_endproc SEH(.seh_endproc) #endif /* __x86_64__ */ - + #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif |