1
/* -----------------------------------------------------------------------
2
aix.S - Copyright (c) 2002 Free Software Foundation, Inc.
3
based on darwin.S by John Hornkvist
7
Permission is hereby granted, free of charge, to any person obtaining
8
a copy of this software and associated documentation files (the
9
``Software''), to deal in the Software without restriction, including
10
without limitation the rights to use, copy, modify, merge, publish,
11
distribute, sublicense, and/or sell copies of the Software, and to
12
permit persons to whom the Software is furnished to do so, subject to
13
the following conditions:
15
The above copyright notice and this permission notice shall be included
16
in all copies or substantial portions of the Software.
18
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
19
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
22
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
OTHER DEALINGS IN THE SOFTWARE.
25
----------------------------------------------------------------------- */
83
#include <fficonfig.h>
85
#define JUMPTARGET(name) name
97
.csect ffi_call_AIX[DS]
99
.long .ffi_call_AIX, TOC[tc0], 0
102
mr r12,r8 // We only need r12 until the call, so it doesn't have to be saved...
103
/* Save the old stack pointer as AP. */
106
/* Allocate the stack space we need. */
109
/* Save registers we use. */
120
/* Save arguments over call... */
121
mr r31,r5 /* flags, */
122
mr r30,r6 /* rvalue, */
123
mr r29,r7 /* function address, */
124
mr r28,r8 /* our AP. */
126
/* Call ffi_prep_args. */
132
mtctr r12 // r12 holds address of _ffi_prep_args
136
/* Now do the call. */
138
/* Set up cr1 with bits 4-7 of the flags. */
143
/* Load all those argument registers. */
144
// We have set up a nice stack frame, just load it into registers.
156
/* Load all the FP registers. */
158
lfd f1,-16-(13*8)(r28)
159
lfd f2,-16-(12*8)(r28)
160
lfd f3,-16-(11*8)(r28)
161
lfd f4,-16-(10*8)(r28)
163
lfd f5,-16-(9*8)(r28)
164
lfd f6,-16-(8*8)(r28)
165
lfd f7,-16-(7*8)(r28)
166
lfd f8,-16-(6*8)(r28)
168
lfd f9,-16-(5*8)(r28)
169
lfd f10,-16-(4*8)(r28)
170
lfd f11,-16-(3*8)(r28)
171
lfd f12,-16-(2*8)(r28)
173
lfd f13,-16-(1*8)(r28)
180
/* Now, deal with the return value. */
183
bt 30,L(done_return_value)
184
bt 29,L(fp_return_value)
186
bf 28,L(done_return_value)
189
/* Fall through... */
191
L(done_return_value):
192
/* Restore the registers we used and return. */
203
bf 28,L(float_return_value)
205
b L(done_return_value)
206
L(float_return_value):
208
b L(done_return_value)
210
.byte 0,0,0,1,128,4,0,0
215
.globl ffi_call_DARWIN
216
.globl .ffi_call_DARWIN
217
.csect ffi_call_DARWIN[DS]
219
.long .ffi_call_DARWIN, TOC[tc0], 0
224
.byte 0,0,0,0,0,0,0,0
225
//END(ffi_call_DARWIN)