1 /* -----------------------------------------------------------------------
2 osf.S - Copyright (c) 1998 Cygnus Solutions
4 Alpha/OSF Foreign Function Interface
6 $Id: osf.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 ----------------------------------------------------------------------- */
33 /* ffi_call_osf (void *args, unsigned long bytes, unsigned flags,
34 void *raddr, void (*fnaddr)());
36 Bit o trickiness here -- ARGS+BYTES is the base of the stack frame
37 for this function. This has been allocated by ffi_call. We also
38 deallocate some of the stack that has been alloca'd. */
44 .frame $15, 32, $26, 0
57 # Load up all of the (potential) argument registers.
71 # Deallocate the register argument area.
77 # If the return value pointer is NULL, assume no return value.
83 # Store the return value out in the proper type.
84 cmpeq $18, FFI_TYPE_INT, $1
86 cmpeq $18, FFI_TYPE_FLOAT, $2
88 cmpeq $18, FFI_TYPE_DOUBLE, $3
115 /* ffi_closure_osf(...)
117 Receives the closure argument in $1. */
120 .globl ffi_closure_osf
123 .frame $30, 16*8, $26, 0
124 .mask 0x4000000, -14*8
130 # Store all of the potential argument registers in va_list format.
144 # Call ffi_closure_osf_inner to do the bulk of the work.
148 jsr $26, ffi_closure_osf_inner
152 # Load up the return value in the proper type.
153 cmpeq $0, FFI_TYPE_INT, $1
155 cmpeq $0, FFI_TYPE_FLOAT, $2
157 cmpeq $18, FFI_TYPE_DOUBLE, $3