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)
31 # next save fpr 1 to fpr 8 (aligned to 8)
41 # set up registers for the routine that actually does the work
42 # get the context pointer from the trampoline
45 # now load up the pointer to the result storage
48 # now load up the pointer to the saved gpr registers
51 # now load up the pointer to the saved fpr registers */
54 # now load up the pointer to the outgoing parameter
55 # stack in the previous frame
56 # i.e. the previous frame pointer + 8
60 bl ffi_closure_helper_SYSV@local
62 # now r3 contains the return type
63 # so use it to look up in a table
64 # so we know how to deal with each type
66 # look up the proper starting point in table
67 # by using return type as offset
68 addi %r6,%r1,112 # get pointer to results area
69 bl .Lget_ret_type0_addr # get pointer to .Lret_type0 into LR
71 slwi %r3,%r3,4 # now multiply return type by 16
72 add %r3,%r3,%r4 # add contents of table to table address
77 # Each of the ret_typeX code fragments has to be exactly 16 bytes long
78 # (4 instructions). For cache effectiveness we align to a 16 byte boundary
102 # case FFI_TYPE_FLOAT
109 # case FFI_TYPE_DOUBLE
116 # case FFI_TYPE_LONGDOUBLE
123 # case FFI_TYPE_UINT8
130 # case FFI_TYPE_SINT8
137 # case FFI_TYPE_UINT16
144 # case FFI_TYPE_SINT16
151 # case FFI_TYPE_UINT32
158 # case FFI_TYPE_SINT32
165 # case FFI_TYPE_UINT64
172 # case FFI_TYPE_SINT64
179 # case FFI_TYPE_STRUCT
186 # case FFI_TYPE_POINTER
193 # The return types below are only used when the ABI type is FFI_SYSV.
194 # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
202 # case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct.
210 # case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct.
218 # case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct.
220 # this one handles the structs from above too.
226 # case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct.
234 # case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct.
242 # case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct.
250 # case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct.
252 # this one handles the above unhandled structs.
273 END(ffi_closure_SYSV)
275 .section ".eh_frame",EH_FRAME_FLAGS,@progbits
277 .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
279 .4byte 0x0 # CIE Identifier Tag
280 .byte 0x1 # CIE Version
281 #if defined _RELOCATABLE || defined __PIC__
282 .ascii "zR\0" # CIE Augmentation
284 .ascii "\0" # CIE Augmentation
286 .uleb128 0x1 # CIE Code Alignment Factor
287 .sleb128 -4 # CIE Data Alignment Factor
288 .byte 0x41 # CIE RA Column
289 #if defined _RELOCATABLE || defined __PIC__
290 .uleb128 0x1 # Augmentation size
291 .byte 0x1b # FDE Encoding (pcrel sdata4)
293 .byte 0xc # DW_CFA_def_cfa
299 .4byte .LEFDE1-.LASFDE1 # FDE Length
301 .4byte .LASFDE1-.Lframe1 # FDE CIE offset
302 #if defined _RELOCATABLE || defined __PIC__
303 .4byte .LFB1-. # FDE initial location
305 .4byte .LFB1 # FDE initial location
307 .4byte .LFE1-.LFB1 # FDE address range
308 #if defined _RELOCATABLE || defined __PIC__
309 .uleb128 0x0 # Augmentation size
311 .byte 0x4 # DW_CFA_advance_loc4
313 .byte 0xe # DW_CFA_def_cfa_offset
315 .byte 0x4 # DW_CFA_advance_loc4
317 .byte 0x11 # DW_CFA_offset_extended_sf