1 .file "linux64_closure.S"
4 .hidden ffi_closure_LINUX64, .ffi_closure_LINUX64
5 .globl ffi_closure_LINUX64, .ffi_closure_LINUX64
9 .quad .ffi_closure_LINUX64,.TOC.@tocbase,0
10 .size ffi_closure_LINUX64,24
11 .type .ffi_closure_LINUX64,@function
15 # save general regs into parm save area
28 # mandatory 48 bytes special reg save area + 64 bytes parm save area
29 # + 8 bytes retval area + 13*8 bytes fpr save area
33 # next save fpr 1 to fpr 13
34 stfd %f1, 120+(0*8)(%r1)
35 stfd %f2, 120+(1*8)(%r1)
36 stfd %f3, 120+(2*8)(%r1)
37 stfd %f4, 120+(3*8)(%r1)
38 stfd %f5, 120+(4*8)(%r1)
39 stfd %f6, 120+(5*8)(%r1)
40 stfd %f7, 120+(6*8)(%r1)
41 stfd %f8, 120+(7*8)(%r1)
42 stfd %f9, 120+(8*8)(%r1)
43 stfd %f10, 120+(9*8)(%r1)
44 stfd %f11, 120+(10*8)(%r1)
45 stfd %f12, 120+(11*8)(%r1)
46 stfd %f13, 120+(12*8)(%r1)
48 # set up registers for the routine that actually does the work
49 # get the context pointer from the trampoline
52 # now load up the pointer to the result storage
55 # now load up the pointer to the parameter save area
56 # in the previous frame
57 addi %r5, %r1, 224 + 48
59 # now load up the pointer to the saved fpr registers */
63 bl .ffi_closure_helper_LINUX64
65 # now r3 contains the return type
66 # so use it to look up in a table
67 # so we know how to deal with each type
69 # look up the proper starting point in table
70 # by using return type as offset
71 addi %r5, %r1, 112 # get pointer to results area
72 bl .Lget_ret_type0_addr # get pointer to .Lret_type0 into LR
74 sldi %r3, %r3, 4 # now multiply return type by 16
75 add %r3, %r3, %r4 # add contents of table to table address
79 # Each of the ret_typeX code fragments has to be exactly 16 bytes long
80 # (4 instructions). For cache effectiveness we align to a 16 byte boundary
101 # case FFI_TYPE_FLOAT
106 # case FFI_TYPE_DOUBLE
111 # case FFI_TYPE_LONGDOUBLE
116 # case FFI_TYPE_UINT8
121 # case FFI_TYPE_SINT8
126 # case FFI_TYPE_UINT16
131 # case FFI_TYPE_SINT16
136 # case FFI_TYPE_UINT32
141 # case FFI_TYPE_SINT32
146 # case FFI_TYPE_UINT64
151 # case FFI_TYPE_SINT64
156 # case FFI_TYPE_STRUCT
161 # case FFI_TYPE_POINTER
174 .byte 0,12,0,1,128,0,0,0
175 .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
177 .section .eh_frame,"aw",@progbits
179 .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
181 .4byte 0x0 # CIE Identifier Tag
182 .byte 0x1 # CIE Version
183 .ascii "zR\0" # CIE Augmentation
184 .uleb128 0x1 # CIE Code Alignment Factor
185 .sleb128 -8 # CIE Data Alignment Factor
186 .byte 0x41 # CIE RA Column
187 .uleb128 0x1 # Augmentation size
188 .byte 0x14 # FDE Encoding (pcrel udata8)
189 .byte 0xc # DW_CFA_def_cfa
195 .4byte .LEFDE1-.LASFDE1 # FDE Length
197 .4byte .LASFDE1-.Lframe1 # FDE CIE offset
198 .8byte .LFB1-. # FDE initial location
199 .8byte .LFE1-.LFB1 # FDE address range
200 .uleb128 0x0 # Augmentation size
201 .byte 0x2 # DW_CFA_advance_loc1
203 .byte 0xe # DW_CFA_def_cfa_offset
205 .byte 0x11 # DW_CFA_offset_extended_sf