1 /* -----------------------------------------------------------------------
2 osf.S - Copyright (c) 1998, 2001 Red Hat
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 ----------------------------------------------------------------------- */
34 /* ffi_call_osf (void *args, unsigned long bytes, unsigned flags,
35 void *raddr, void (*fnaddr)());
37 Bit o trickiness here -- ARGS+BYTES is the base of the stack frame
38 for this function. This has been allocated by ffi_call. We also
39 deallocate some of the stack that has been alloca'd. */
45 .frame $15, 32, $26, 0
62 # Load up all of the (potential) argument registers.
76 # Deallocate the register argument area.
82 # If the return value pointer is NULL, assume no return value.
88 # Store the return value out in the proper type.
89 cmpeq $18, FFI_TYPE_INT, $1
91 cmpeq $18, FFI_TYPE_FLOAT, $2
93 cmpeq $18, FFI_TYPE_DOUBLE, $3
121 /* ffi_closure_osf(...)
123 Receives the closure argument in $1. */
126 .globl ffi_closure_osf
129 .frame $30, 16*8, $26, 0
130 .mask 0x4000000, -16*8
139 # Store all of the potential argument registers in va_list format.
153 # Call ffi_closure_osf_inner to do the bulk of the work.
157 jsr $26, ffi_closure_osf_inner
161 # Load up the return value in the proper type.
166 jmp $31, ($1), $load_32
260 .gprel32 $load_none # FFI_TYPE_VOID
261 .gprel32 $load_32 # FFI_TYPE_INT
262 .gprel32 $load_float # FFI_TYPE_FLOAT
263 .gprel32 $load_double # FFI_TYPE_DOUBLE
264 .gprel32 $load_double # FFI_TYPE_LONGDOUBLE
265 .gprel32 $load_u8 # FFI_TYPE_UINT8
266 .gprel32 $load_s8 # FFI_TYPE_SINT8
267 .gprel32 $load_u16 # FFI_TYPE_UINT16
268 .gprel32 $load_s16 # FFI_TYPE_SINT16
269 .gprel32 $load_32 # FFI_TYPE_UINT32
270 .gprel32 $load_32 # FFI_TYPE_SINT32
271 .gprel32 $load_64 # FFI_TYPE_UINT64
272 .gprel32 $load_64 # FFI_TYPE_SINT64
273 .gprel32 $load_none # FFI_TYPE_STRUCT
274 .gprel32 $load_64 # FFI_TYPE_POINTER
276 /* Assert that the table above is in sync with ffi.h. */
278 #if FFI_TYPE_FLOAT != 2 \
279 || FFI_TYPE_DOUBLE != 3 \
280 || FFI_TYPE_UINT8 != 5 \
281 || FFI_TYPE_SINT8 != 6 \
282 || FFI_TYPE_UINT16 != 7 \
283 || FFI_TYPE_SINT16 != 8 \
284 || FFI_TYPE_UINT32 != 9 \
285 || FFI_TYPE_SINT32 != 10 \
286 || FFI_TYPE_UINT64 != 11 \
287 || FFI_TYPE_SINT64 != 12 \
288 || FFI_TYPE_STRUCT != 13 \
289 || FFI_TYPE_POINTER != 14 \
290 || FFI_TYPE_LAST != 14
291 #error "osf.S out of sync with ffi.h"
295 .section .eh_frame,"aw",@progbits
297 .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry
299 .4byte 0x0 # CIE Identifier Tag
300 .byte 0x1 # CIE Version
301 .ascii "zR\0" # CIE Augmentation
302 .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor
303 .byte 0x78 # sleb128 -8; CIE Data Alignment Factor
304 .byte 0x1a # CIE RA Column
305 .byte 0x1 # uleb128 0x1; Augmentation size
306 .byte 0x1b # FDE Encoding (pcrel sdata4)
307 .byte 0xc # DW_CFA_def_cfa
308 .byte 0x1e # uleb128 0x1e
309 .byte 0x0 # uleb128 0x0
313 .4byte $LEFDE1-$LASFDE1 # FDE Length
315 .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset
316 .4byte $LFB1-. # FDE initial location
317 .4byte $LFE1-$LFB1 # FDE address range
318 .byte 0x0 # uleb128 0x0; Augmentation size
319 .byte 0x4 # DW_CFA_advance_loc4
321 .byte 0xe # DW_CFA_def_cfa_offset
322 .byte 0x30 # uleb128 0x30
323 .byte 0x4 # DW_CFA_advance_loc4
325 .byte 0x9a # DW_CFA_offset, column 0x1a
326 .byte 0x6 # uleb128 0x6
327 .byte 0x8f # DW_CFA_offset, column 0xf
328 .byte 0x5 # uleb128 0x5
329 .byte 0x4 # DW_CFA_advance_loc4
331 .byte 0xc # DW_CFA_def_cfa
332 .byte 0xf # uleb128 0xf
333 .byte 0x30 # uleb128 0x30
338 .4byte $LEFDE3-$LASFDE3 # FDE Length
340 .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset
341 .4byte $LFB2-. # FDE initial location
342 .4byte $LFE2-$LFB2 # FDE address range
343 .byte 0x0 # uleb128 0x0; Augmentation size
344 .byte 0x4 # DW_CFA_advance_loc4
346 .byte 0xe # DW_CFA_def_cfa_offset
347 .byte 0x90,0x1 # uleb128 0x90
348 .byte 0x4 # DW_CFA_advance_loc4
350 .byte 0x9a # DW_CFA_offset, column 0x1a
351 .byte 0x12 # uleb128 0x12