4 #include <powerpc/asm.h>
10 ENTRY(ffi_closure_SYSV)
18 # we want to build up an areas for the parameters passed
19 # in registers (both floating point and integer)
21 # so first save gpr 3 to gpr 10 (aligned to 4)
32 # next save fpr 1 to fpr 8 (aligned to 8)
43 # set up registers for the routine that actually does the work
44 # get the context pointer from the trampoline
47 # now load up the pointer to the result storage
50 # now load up the pointer to the saved gpr registers
53 # now load up the pointer to the saved fpr registers */
56 # now load up the pointer to the outgoing parameter
57 # stack in the previous frame
58 # i.e. the previous frame pointer + 8
62 bl ffi_closure_helper_SYSV@local
64 # now r3 contains the return type
65 # so use it to look up in a table
66 # so we know how to deal with each type
68 # look up the proper starting point in table
69 # by using return type as offset
71 mflr %r4 # move address of .Lret to r4
72 slwi %r3,%r3,4 # now multiply return type by 16
73 addi %r4, %r4, .Lret_type0 - .Lret
75 add %r3,%r3,%r4 # add contents of table to table address
80 # Each of the ret_typeX code fragments has to be exactly 16 bytes long
81 # (4 instructions). For cache effectiveness we align to a 16 byte boundary
104 # case FFI_TYPE_DOUBLE
110 # case FFI_TYPE_LONGDOUBLE
116 # case FFI_TYPE_UINT8
122 # case FFI_TYPE_SINT8
128 # case FFI_TYPE_UINT16
134 # case FFI_TYPE_SINT16
140 # case FFI_TYPE_UINT32
146 # case FFI_TYPE_SINT32
152 # case FFI_TYPE_UINT64
158 # case FFI_TYPE_SINT64
164 # case FFI_TYPE_STRUCT
170 # case FFI_TYPE_POINTER
176 # case FFI_TYPE_UINT128
182 # The return types below are only used when the ABI type is FFI_SYSV.
183 # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
189 # case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct.
195 # case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct.
201 # case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct.
207 # case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct.
213 # case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct.
219 # case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct.
225 # case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct.
247 END(ffi_closure_SYSV)
249 .section ".eh_frame",EH_FRAME_FLAGS,@progbits
251 .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
253 .4byte 0x0 # CIE Identifier Tag
254 .byte 0x1 # CIE Version
255 #if defined _RELOCATABLE || defined __PIC__
256 .ascii "zR\0" # CIE Augmentation
258 .ascii "\0" # CIE Augmentation
260 .uleb128 0x1 # CIE Code Alignment Factor
261 .sleb128 -4 # CIE Data Alignment Factor
262 .byte 0x41 # CIE RA Column
263 #if defined _RELOCATABLE || defined __PIC__
264 .uleb128 0x1 # Augmentation size
265 .byte 0x1b # FDE Encoding (pcrel sdata4)
267 .byte 0xc # DW_CFA_def_cfa
273 .4byte .LEFDE1-.LASFDE1 # FDE Length
275 .4byte .LASFDE1-.Lframe1 # FDE CIE offset
276 #if defined _RELOCATABLE || defined __PIC__
277 .4byte .LFB1-. # FDE initial location
279 .4byte .LFB1 # FDE initial location
281 .4byte .LFE1-.LFB1 # FDE address range
282 #if defined _RELOCATABLE || defined __PIC__
283 .uleb128 0x0 # Augmentation size
285 .byte 0x4 # DW_CFA_advance_loc4
287 .byte 0xe # DW_CFA_def_cfa_offset
289 .byte 0x4 # DW_CFA_advance_loc4
291 .byte 0x11 # DW_CFA_offset_extended_sf