1 /* -----------------------------------------------------------------------
2 darwin.S - Copyright (c) 2000 John Hornkvist
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 ``Software''), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
14 The above copyright notice and this permission notice shall be included
15 in all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 OTHER DEALINGS IN THE SOFTWARE.
24 ----------------------------------------------------------------------- */
27 #include <fficonfig.h>
29 #define JUMPTARGET(name) name
37 .globl _ffi_call_DARWIN
42 mr r12,r8 /* We only need r12 until the call,
43 so it doesn't have to be saved... */
45 /* Save the old stack pointer as AP. */
48 /* Allocate the stack space we need. */
51 /* Save registers we use. */
63 /* Save arguments over call... */
64 mr r31,r5 /* flags, */
65 mr r30,r6 /* rvalue, */
66 mr r29,r7 /* function address, */
67 mr r28,r8 /* our AP. */
69 /* Call ffi_prep_args. */
73 mtctr r12 // r12 holds address of _ffi_prep_args
78 Set up cr1 with bits 4-7 of the flags. */
80 /* Get the address to call into CTR. */
82 /* Load all those argument registers.
83 We have set up a nice stack frame, just load it into registers. */
95 /* Load all the FP registers. */
97 lfd f1,-16-(13*8)(r28)
98 lfd f2,-16-(12*8)(r28)
99 lfd f3,-16-(11*8)(r28)
100 lfd f4,-16-(10*8)(r28)
102 lfd f5,-16-(9*8)(r28)
103 lfd f6,-16-(8*8)(r28)
104 lfd f7,-16-(7*8)(r28)
105 lfd f8,-16-(6*8)(r28)
107 lfd f9,-16-(5*8)(r28)
108 lfd f10,-16-(4*8)(r28)
109 lfd f11,-16-(3*8)(r28)
110 lfd f12,-16-(2*8)(r28)
112 lfd f13,-16-(1*8)(r28)
115 mr r12,r29 /* Put the target address in r12 as specified. */
122 /* Now, deal with the return value. */
125 bt 30,L(done_return_value)
126 bt 29,L(fp_return_value)
128 bf 28,L(done_return_value)
131 /* Fall through... */
133 L(done_return_value):
134 /* Restore the registers we used and return. */
145 bf 28,L(float_return_value)
147 b L(done_return_value)
148 L(float_return_value):
150 b L(done_return_value)
152 /* END(_ffi_call_DARWIN) */
154 /* Provide a null definition of _ffi_call_AIX. */
162 /* END(_ffi_call_AIX) */
165 .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms
167 .set L$set$0,LECIE1-LSCIE1
168 .long L$set$0 ; Length of Common Information Entry
170 .long 0x0 ; CIE Identifier Tag
171 .byte 0x1 ; CIE Version
172 .ascii "zR\0" ; CIE Augmentation
173 .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
174 .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
175 .byte 0x41 ; CIE RA Column
176 .byte 0x1 ; uleb128 0x1; Augmentation size
177 .byte 0x90 ; FDE Encoding (indirect pcrel)
178 .byte 0xc ; DW_CFA_def_cfa
179 .byte 0x1 ; uleb128 0x1
180 .byte 0x0 ; uleb128 0x0
183 .globl _ffi_call_DARWIN.eh
186 .set L$set$1,LEFDE1-LASFDE1
187 .long L$set$1 ; FDE Length
189 .long LASFDE1-EH_frame1 ; FDE CIE offset
190 .long LFB0-. ; FDE initial location
191 .set L$set$3,LFE1-LFB0
192 .long L$set$3 ; FDE address range
193 .byte 0x0 ; uleb128 0x0; Augmentation size
194 .byte 0x4 ; DW_CFA_advance_loc4
195 .set L$set$4,LCFI0-LFB1
197 .byte 0xd ; DW_CFA_def_cfa_register
198 .byte 0x08 ; uleb128 0x08
199 .byte 0x4 ; DW_CFA_advance_loc4
200 .set L$set$5,LCFI1-LCFI0
202 .byte 0x11 ; DW_CFA_offset_extended_sf
203 .byte 0x41 ; uleb128 0x41
204 .byte 0x7e ; sleb128 -2
205 .byte 0x9f ; DW_CFA_offset, column 0x1f
206 .byte 0x1 ; uleb128 0x1
207 .byte 0x9e ; DW_CFA_offset, column 0x1e
208 .byte 0x2 ; uleb128 0x2
209 .byte 0x9d ; DW_CFA_offset, column 0x1d
210 .byte 0x3 ; uleb128 0x3
211 .byte 0x9c ; DW_CFA_offset, column 0x1c
212 .byte 0x4 ; uleb128 0x4
213 .byte 0x4 ; DW_CFA_advance_loc4
214 .set L$set$6,LCFI2-LCFI1
216 .byte 0xd ; DW_CFA_def_cfa_register
217 .byte 0x1c ; uleb128 0x1c