1 /* -----------------------------------------------------------------------
2 eabi.S - Copyright (c) 2004 Anthony Green
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>
30 .globl ffi_prep_args_EABI
35 .type ffi_call_EABI, @function
50 /* Make room for the new arguments. */
51 /* subi sp, fp, gr10 */
53 /* Store return address and incoming args on stack. */
64 /* Call ffi_prep_args. */
75 /* ffi_prep_args returns the new stack pointer. */
85 /* Always copy the return value pointer into the hidden
86 parameter register. This is only strictly necessary
87 when we're returning an aggregate type, but it doesn't
88 hurt to do this all the time, and it saves a branch. */
91 /* Use the ffi_prep_args return value for the new sp. */
94 /* Call the target function. */
103 /* Store the result. */
104 ldi @(fp, #-16), gr10 /* fig->flags */
105 ldi @(fp, #-20), gr4 /* ecif.rvalue */
107 /* Is the return value stored in two registers? */
110 /* Yes, save them. */
115 /* Is the return value a structure? */
118 /* No, save a 4 byte return value. */
122 /* Restore the stack, and return. */
127 .size ffi_call_EABI, .-ffi_call_EABI