1 /* -----------------------------------------------------------------------
2 eabi.S - Copyright (c) 2004 Anthony Green
6 $Id: sysv.S,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 ``Software''), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice shall be included
17 in all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 OTHER DEALINGS IN THE SOFTWARE.
26 ----------------------------------------------------------------------- */
29 #include <fficonfig.h>
32 .globl ffi_prep_args_EABI
37 .type ffi_call_EABI, @function
52 /* Make room for the new arguments. */
53 /* subi sp, fp, gr10 */
55 /* Store return address and incoming args on stack. */
66 /* Call ffi_prep_args. */
77 /* ffi_prep_args returns the new stack pointer. */
87 /* Always copy the return value pointer into the hidden
88 parameter register. This is only strictly necessary
89 when we're returning an aggregate type, but it doesn't
90 hurt to do this all the time, and it saves a branch. */
93 /* Use the ffi_prep_args return value for the new sp. */
96 /* Call the target function. */
105 /* Store the result. */
106 ldi @(fp, #-16), gr10 /* fig->flags */
107 ldi @(fp, #-20), gr4 /* ecif.rvalue */
109 /* Is the return value stored in two registers? */
112 /* Yes, save them. */
117 /* Is the return value a structure? */
120 /* No, save a 4 byte return value. */
124 /* Restore the stack, and return. */
129 .size ffi_call_EABI, .-ffi_call_EABI