1 /* -----------------------------------------------------------------------
2 sysv.S - Copyright (c) 2004 Renesas Technology
4 M32R Foreign Function Interface
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 RENESAS TECHNOLOGY 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 #ifdef HAVE_MACHINE_ASM_H
30 #include <machine/asm.h>
32 /* XXX these lose for some platforms, I'm sure. */
34 #define ENTRY(x) .globl CNAME(x)! .type CNAME(x),%function! CNAME(x):
39 /* R0: ffi_prep_args */
43 /* sp+0: ecif.rvalue */
46 /* This assumes we are using gas. */
57 /* Make room for all of the new args. */
60 /* Place all of the ffi_prep_args in position. */
68 /* Move first 4 parameters in registers... */
74 /* ...and adjust the stack. */
82 /* Call the function. */
86 /* Remove the space we pushed for the args. */
89 /* Load R2 with the pointer to storage for the return value. */
92 /* Load R3 with the return type code. */
95 /* If the return value pointer is NULL, assume no return value. */
100 bne r3, r4, return_double
105 /* Return DOUBLE or LONGDOUBLE. */
106 ldi r4, #FFI_TYPE_DOUBLE
121 .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)