1 /* -----------------------------------------------------------------------
3 sysv.S - Copyright (c) 2012 Alan Hourihane
4 Copyright (c) 1998, 2012 Andreas Schwab
5 Copyright (c) 2008 Red Hat, Inc.
6 Copyright (c) 2012 Thorsten Glaser
8 m68k Foreign Function Interface
10 Permission is hereby granted, free of charge, to any person obtaining
11 a copy of this software and associated documentation files (the
12 ``Software''), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sublicense, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
18 The above copyright notice and this permission notice shall be included
19 in all copies or substantial portions of the Software.
21 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 DEALINGS IN THE SOFTWARE.
29 ----------------------------------------------------------------------- */
32 #include <fficonfig.h>
35 #ifdef HAVE_AS_CFI_PSEUDO_OP
36 #define CFI_STARTPROC() .cfi_startproc
37 #define CFI_OFFSET(reg,off) .cfi_offset reg,off
38 #define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off
39 #define CFI_ENDPROC() .cfi_endproc
41 #define CFI_STARTPROC()
42 #define CFI_OFFSET(reg,off)
43 #define CFI_DEF_CFA(reg,off)
48 #define CALLFUNC(funcname) _ ## funcname
50 #define CALLFUNC(funcname) funcname
55 .globl CALLFUNC(ffi_call_SYSV)
56 .type CALLFUNC(ffi_call_SYSV),@function
59 CALLFUNC(ffi_call_SYSV):
67 | Make room for all of the new args.
74 jsr CALLFUNC(ffi_prep_args)
76 bsr.l CALLFUNC(ffi_prep_args@PLTPC)
80 | Pass pointer to struct value, if any
91 | Remove the space we pushed for the args
94 | Load the pointer to storage for the return value
97 | Load the return type code
100 | If the return value pointer is NULL, assume no return value.
101 | NOTE: On the mc68000, tst on an address register is not supported.
102 #if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
124 #if defined(__MC68881__) || defined(__HAVE_68881__)
134 #if defined(__MC68881__) || defined(__HAVE_68881__)
145 #if defined(__MC68881__) || defined(__HAVE_68881__)
179 | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32.
180 #if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
201 .size CALLFUNC(ffi_call_SYSV),.-CALLFUNC(ffi_call_SYSV)
203 .globl CALLFUNC(ffi_closure_SYSV)
204 .type CALLFUNC(ffi_closure_SYSV), @function
207 CALLFUNC(ffi_closure_SYSV):
217 jsr CALLFUNC(ffi_closure_SYSV_inner)
219 bsr.l CALLFUNC(ffi_closure_SYSV_inner@PLTPC)
241 #if defined(__MC68881__) || defined(__HAVE_68881__)
250 jcs .Lcls_ret_ldouble
252 #if defined(__MC68881__) || defined(__HAVE_68881__)
260 #if defined(__MC68881__) || defined(__HAVE_68881__)
271 jcs .Lcls_ret_struct1
288 | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32.
289 #if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
303 .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV)
305 .globl CALLFUNC(ffi_closure_struct_SYSV)
306 .type CALLFUNC(ffi_closure_struct_SYSV), @function
309 CALLFUNC(ffi_closure_struct_SYSV):
319 jsr CALLFUNC(ffi_closure_SYSV_inner)
321 bsr.l CALLFUNC(ffi_closure_SYSV_inner@PLTPC)
326 .size CALLFUNC(ffi_closure_struct_SYSV),.-CALLFUNC(ffi_closure_struct_SYSV)
328 #if defined __ELF__ && defined __linux__
329 .section .note.GNU-stack,"",@progbits