URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [src/] [m68k/] [sysv.S] - Rev 732
Compare with Previous | Blame | View Log
/* -----------------------------------------------------------------------sysv.S - Copyright (c) 1998, 2012 Andreas SchwabCopyright (c) 2008 Red Hat, Inc.m68k Foreign Function InterfacePermission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the``Software''), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:The above copyright notice and this permission notice shall be includedin all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHERDEALINGS IN THE SOFTWARE.----------------------------------------------------------------------- */#define LIBFFI_ASM#include <fficonfig.h>#include <ffi.h>#ifdef HAVE_AS_CFI_PSEUDO_OP#define CFI_STARTPROC() .cfi_startproc#define CFI_OFFSET(reg,off) .cfi_offset reg,off#define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off#define CFI_ENDPROC() .cfi_endproc#else#define CFI_STARTPROC()#define CFI_OFFSET(reg,off)#define CFI_DEF_CFA(reg,off)#define CFI_ENDPROC()#endif.text.globl ffi_call_SYSV.type ffi_call_SYSV,@function.align 4ffi_call_SYSV:CFI_STARTPROC()link %fp,#0CFI_OFFSET(14,-8)CFI_DEF_CFA(14,8)move.l %d2,-(%sp)CFI_OFFSET(2,-12)| Make room for all of the new args.sub.l 12(%fp),%sp| Call ffi_prep_argsmove.l 8(%fp),-(%sp)pea 4(%sp)#if !defined __PIC__jsr ffi_prep_args#elsebsr.l ffi_prep_args@PLTPC#endifaddq.l #8,%sp| Pass pointer to struct value, if anymove.l %a0,%a1| Call the functionmove.l 24(%fp),%a0jsr (%a0)| Remove the space we pushed for the argsadd.l 12(%fp),%sp| Load the pointer to storage for the return valuemove.l 20(%fp),%a1| Load the return type codemove.l 16(%fp),%d2| If the return value pointer is NULL, assume no return value.| NOTE: On the mc68000, tst on an address register is not supported.#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)cmp.w #0, %a1#elsetst.l %a1#endifjbeq noretvalbtst #0,%d2jbeq retlongintmove.l %d0,(%a1)jbra epilogueretlongint:btst #1,%d2jbeq retfloatmove.l %d0,(%a1)move.l %d1,4(%a1)jbra epilogueretfloat:btst #2,%d2jbeq retdouble#if defined(__MC68881__) || defined(__HAVE_68881__)fmove.s %fp0,(%a1)#elsemove.l %d0,(%a1)#endifjbra epilogueretdouble:btst #3,%d2jbeq retlongdouble#if defined(__MC68881__) || defined(__HAVE_68881__)fmove.d %fp0,(%a1)#elsemove.l %d0,(%a1)+move.l %d1,(%a1)#endifjbra epilogueretlongdouble:btst #4,%d2jbeq retpointer#if defined(__MC68881__) || defined(__HAVE_68881__)fmove.x %fp0,(%a1)#elsemove.l %d0,(%a1)+move.l %d1,(%a1)+move.l %d2,(%a1)#endifjbra epilogueretpointer:btst #5,%d2jbeq retstruct1move.l %a0,(%a1)jbra epilogueretstruct1:btst #6,%d2jbeq retstruct2move.b %d0,(%a1)jbra epilogueretstruct2:btst #7,%d2jbeq noretvalmove.w %d0,(%a1)noretval:epilogue:move.l (%sp)+,%d2unlk %fprtsCFI_ENDPROC().size ffi_call_SYSV,.-ffi_call_SYSV.globl ffi_closure_SYSV.type ffi_closure_SYSV, @function.align 4ffi_closure_SYSV:CFI_STARTPROC()link %fp,#-12CFI_OFFSET(14,-8)CFI_DEF_CFA(14,8)move.l %sp,-12(%fp)pea 8(%fp)pea -12(%fp)move.l %a0,-(%sp)#if !defined __PIC__jsr ffi_closure_SYSV_inner#elsebsr.l ffi_closure_SYSV_inner@PLTPC#endiflsr.l #1,%d0jne 1fjcc .Lcls_epiloguemove.l -12(%fp),%d0.Lcls_epilogue:unlk %fprts1:lea -12(%fp),%a0lsr.l #2,%d0jne 1fjcs .Lcls_ret_floatmove.l (%a0)+,%d0move.l (%a0),%d1jra .Lcls_epilogue.Lcls_ret_float:#if defined(__MC68881__) || defined(__HAVE_68881__)fmove.s (%a0),%fp0#elsemove.l (%a0),%d0#endifjra .Lcls_epilogue1:lsr.l #2,%d0jne 1fjcs .Lcls_ret_ldouble#if defined(__MC68881__) || defined(__HAVE_68881__)fmove.d (%a0),%fp0#elsemove.l (%a0)+,%d0move.l (%a0),%d1#endifjra .Lcls_epilogue.Lcls_ret_ldouble:#if defined(__MC68881__) || defined(__HAVE_68881__)fmove.x (%a0),%fp0#elsemove.l (%a0)+,%d0move.l (%a0)+,%d1move.l (%a0),%d2#endifjra .Lcls_epilogue1:lsr.l #2,%d0jne .Lcls_ret_struct2jcs .Lcls_ret_struct1move.l (%a0),%a0move.l %a0,%d0jra .Lcls_epilogue.Lcls_ret_struct1:move.b (%a0),%d0jra .Lcls_epilogue.Lcls_ret_struct2:move.w (%a0),%d0jra .Lcls_epilogueCFI_ENDPROC().size ffi_closure_SYSV,.-ffi_closure_SYSV.globl ffi_closure_struct_SYSV.type ffi_closure_struct_SYSV, @function.align 4ffi_closure_struct_SYSV:CFI_STARTPROC()link %fp,#0CFI_OFFSET(14,-8)CFI_DEF_CFA(14,8)move.l %sp,-12(%fp)pea 8(%fp)move.l %a1,-(%sp)move.l %a0,-(%sp)#if !defined __PIC__jsr ffi_closure_SYSV_inner#elsebsr.l ffi_closure_SYSV_inner@PLTPC#endifunlk %fprtsCFI_ENDPROC().size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV#if defined __ELF__ && defined __linux__.section .note.GNU-stack,"",@progbits#endif
