5 .file "linux64_closure.S"
8 .hidden ffi_closure_LINUX64, .ffi_closure_LINUX64
9 .globl ffi_closure_LINUX64, .ffi_closure_LINUX64
13 .quad .ffi_closure_LINUX64,.TOC.@tocbase,0
14 .size ffi_closure_LINUX64,24
15 .type .ffi_closure_LINUX64,@function
19 # save general regs into parm save area
32 # mandatory 48 bytes special reg save area + 64 bytes parm save area
33 # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
37 # next save fpr 1 to fpr 13
38 stfd %f1, 128+(0*8)(%r1)
39 stfd %f2, 128+(1*8)(%r1)
40 stfd %f3, 128+(2*8)(%r1)
41 stfd %f4, 128+(3*8)(%r1)
42 stfd %f5, 128+(4*8)(%r1)
43 stfd %f6, 128+(5*8)(%r1)
44 stfd %f7, 128+(6*8)(%r1)
45 stfd %f8, 128+(7*8)(%r1)
46 stfd %f9, 128+(8*8)(%r1)
47 stfd %f10, 128+(9*8)(%r1)
48 stfd %f11, 128+(10*8)(%r1)
49 stfd %f12, 128+(11*8)(%r1)
50 stfd %f13, 128+(12*8)(%r1)
52 # set up registers for the routine that actually does the work
53 # get the context pointer from the trampoline
56 # now load up the pointer to the result storage
59 # now load up the pointer to the parameter save area
60 # in the previous frame
61 addi %r5, %r1, 240 + 48
63 # now load up the pointer to the saved fpr registers */
67 bl .ffi_closure_helper_LINUX64
70 # now r3 contains the return type
71 # so use it to look up in a table
72 # so we know how to deal with each type
74 # look up the proper starting point in table
75 # by using return type as offset
76 mflr %r4 # move address of .Lret to r4
77 sldi %r3, %r3, 4 # now multiply return type by 16
78 addi %r4, %r4, .Lret_type0 - .Lret
80 add %r3, %r3, %r4 # add contents of table to table address
84 # Each of the ret_typeX code fragments has to be exactly 16 bytes long
85 # (4 instructions). For cache effectiveness we align to a 16 byte boundary
100 # case FFI_TYPE_FLOAT
105 # case FFI_TYPE_DOUBLE
110 # case FFI_TYPE_LONGDOUBLE
115 # case FFI_TYPE_UINT8
120 # case FFI_TYPE_SINT8
125 # 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
169 .byte 0,12,0,1,128,0,0,0
170 .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
172 .section .eh_frame,EH_FRAME_FLAGS,@progbits
174 .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
176 .4byte 0x0 # CIE Identifier Tag
177 .byte 0x1 # CIE Version
178 .ascii "zR\0" # CIE Augmentation
179 .uleb128 0x1 # CIE Code Alignment Factor
180 .sleb128 -8 # CIE Data Alignment Factor
181 .byte 0x41 # CIE RA Column
182 .uleb128 0x1 # Augmentation size
183 .byte 0x14 # FDE Encoding (pcrel udata8)
184 .byte 0xc # DW_CFA_def_cfa
190 .4byte .LEFDE1-.LASFDE1 # FDE Length
192 .4byte .LASFDE1-.Lframe1 # FDE CIE offset
193 .8byte .LFB1-. # FDE initial location
194 .8byte .LFE1-.LFB1 # FDE address range
195 .uleb128 0x0 # Augmentation size
196 .byte 0x2 # DW_CFA_advance_loc1
198 .byte 0xe # DW_CFA_def_cfa_offset
200 .byte 0x11 # DW_CFA_offset_extended_sf