1 /* -----------------------------------------------------------------------
2 v8.S - Copyright (c) 1996, 1997 Cygnus Solutions
4 Sparc Foreign Function Interface
6 $Id: v8.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 CYGNUS SOLUTIONS 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 ----------------------------------------------------------------------- */
31 #define STACKFRAME 96 /* Minimum stack framesize for SPARC */
32 #define ARGS (64+4) /* Offset of register area in frame */
41 save %sp, -STACKFRAME, %sp
43 sub %sp, %i2, %sp ! alloca() space in stack for frame to set up
44 add %sp, STACKFRAME, %l0 ! %l0 has start of
47 mov %l0, %o0 ! call routine to set up frame
49 mov %i1, %o1 ! (delay)
51 ld [%l0+ARGS], %o0 ! call foreign function
58 mov %l0, %sp ! (delay) switch to frame
59 nop ! STRUCT returning functions skip 12 instead of 8 bytes
61 ! If the return value pointer is NULL, assume no return value.
68 st %o0, [%i4] ! (delay)
70 cmp %i3, FFI_TYPE_FLOAT
72 st %f0, [%i4+0] ! (delay)
74 cmp %i3, FFI_TYPE_SINT64
77 cmp %i3, FFI_TYPE_DOUBLE
94 .size ffi_call_V8,.ffi_call_V8_end-ffi_call_V8