URL
https://opencores.org/ocsvn/scarts/scarts/trunk
Subversion Repositories scarts
[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libffi/] [src/] [sh/] [sysv.S] - Rev 14
Compare with Previous | Blame | View Log
/* -----------------------------------------------------------------------sysv.S - Copyright (c) 2002, 2003, 2004 Kaz KojimaSuperH 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, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OROTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE.----------------------------------------------------------------------- */#define LIBFFI_ASM#include <fficonfig.h>#include <ffi.h>#ifdef HAVE_MACHINE_ASM_H#include <machine/asm.h>#else/* XXX these lose for some platforms, I'm sure. */#define CNAME(x) x#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):#endif#if defined(__HITACHI__)#define STRUCT_VALUE_ADDRESS_WITH_ARG 1#else#define STRUCT_VALUE_ADDRESS_WITH_ARG 0#endif.text# r4: ffi_prep_args# r5: &ecif# r6: bytes# r7: flags# sp+0: rvalue# sp+4: fn# This assumes we are using gas.ENTRY(ffi_call_SYSV)# Save registers.LFB1:mov.l r8,@-r15.LCFI0:mov.l r9,@-r15.LCFI1:mov.l r10,@-r15.LCFI2:mov.l r12,@-r15.LCFI3:mov.l r14,@-r15.LCFI4:sts.l pr,@-r15.LCFI5:mov r15,r14.LCFI6:#if defined(__SH4__)mov r6,r8mov r7,r9sub r6,r15add #-16,r15mov #~7,r0and r0,r15mov r4,r0jsr @r0mov r15,r4mov r9,r1shlr8 r9shlr8 r9shlr8 r9mov #FFI_TYPE_STRUCT,r2cmp/eq r2,r9bf 1f#if STRUCT_VALUE_ADDRESS_WITH_ARGmov.l @r15+,r4bra 2fmov #5,r2#elsemov.l @r15+,r10#endif1:mov #4,r22:mov #4,r3L_pass:cmp/pl r8bf L_call_itmov r1,r0and #3,r0L_pass_d:cmp/eq #FFI_TYPE_DOUBLE,r0bf L_pass_fmov r3,r0and #1,r0tst r0,r0bt 1fadd #1,r31:mov #12,r0cmp/hs r0,r3bt/s 3fshlr2 r1bsr L_pop_dnop3:add #2,r3bra L_passadd #-8,r8L_pop_d:mov r3,r0add r0,r0add r3,r0add #-12,r0braf r0nop#ifdef __LITTLE_ENDIAN__fmov.s @r15+,fr5rtsfmov.s @r15+,fr4fmov.s @r15+,fr7rtsfmov.s @r15+,fr6fmov.s @r15+,fr9rtsfmov.s @r15+,fr8fmov.s @r15+,fr11rtsfmov.s @r15+,fr10#elsefmov.s @r15+,fr4rtsfmov.s @r15+,fr5fmov.s @r15+,fr6rtsfmov.s @r15+,fr7fmov.s @r15+,fr8rtsfmov.s @r15+,fr9fmov.s @r15+,fr10rtsfmov.s @r15+,fr11#endifL_pass_f:cmp/eq #FFI_TYPE_FLOAT,r0bf L_pass_imov #12,r0cmp/hs r0,r3bt/s 2fshlr2 r1bsr L_pop_fnop2:add #1,r3bra L_passadd #-4,r8L_pop_f:mov r3,r0shll2 r0add #-16,r0braf r0nop#ifdef __LITTLE_ENDIAN__rtsfmov.s @r15+,fr5rtsfmov.s @r15+,fr4rtsfmov.s @r15+,fr7rtsfmov.s @r15+,fr6rtsfmov.s @r15+,fr9rtsfmov.s @r15+,fr8rtsfmov.s @r15+,fr11rtsfmov.s @r15+,fr10#elsertsfmov.s @r15+,fr4rtsfmov.s @r15+,fr5rtsfmov.s @r15+,fr6rtsfmov.s @r15+,fr7rtsfmov.s @r15+,fr8rtsfmov.s @r15+,fr9rtsfmov.s @r15+,fr10rtsfmov.s @r15+,fr11#endifL_pass_i:cmp/eq #FFI_TYPE_INT,r0bf L_call_itmov #8,r0cmp/hs r0,r2bt/s 2fshlr2 r1bsr L_pop_inop2:add #1,r2bra L_passadd #-4,r8L_pop_i:mov r2,r0shll2 r0add #-16,r0braf r0noprtsmov.l @r15+,r4rtsmov.l @r15+,r5rtsmov.l @r15+,r6rtsmov.l @r15+,r7L_call_it:# call function#if (! STRUCT_VALUE_ADDRESS_WITH_ARG)mov r10, r2#endifmov.l @(28,r14),r1jsr @r1nopL_ret_d:mov #FFI_TYPE_DOUBLE,r2cmp/eq r2,r9bf L_ret_llmov.l @(24,r14),r1#ifdef __LITTLE_ENDIAN__fmov.s fr1,@r1add #4,r1bra L_epiloguefmov.s fr0,@r1#elsefmov.s fr0,@r1add #4,r1bra L_epiloguefmov.s fr1,@r1#endifL_ret_ll:mov #FFI_TYPE_SINT64,r2cmp/eq r2,r9bt/s 1fmov #FFI_TYPE_UINT64,r2cmp/eq r2,r9bf L_ret_f1:mov.l @(24,r14),r2mov.l r0,@r2bra L_epiloguemov.l r1,@(4,r2)L_ret_f:mov #FFI_TYPE_FLOAT,r2cmp/eq r2,r9bf L_ret_imov.l @(24,r14),r1bra L_epiloguefmov.s fr0,@r1L_ret_i:mov #FFI_TYPE_INT,r2cmp/eq r2,r9bf L_epiloguemov.l @(24,r14),r1bra L_epiloguemov.l r0,@r1L_epilogue:# Remove the space we pushed for the argsmov r14,r15lds.l @r15+,prmov.l @r15+,r14mov.l @r15+,r12mov.l @r15+,r10mov.l @r15+,r9rtsmov.l @r15+,r8#elsemov r6,r8mov r7,r9sub r6,r15add #-16,r15mov #~7,r0and r0,r15mov r4,r0jsr @r0mov r15,r4mov r9,r3shlr8 r9shlr8 r9shlr8 r9mov #FFI_TYPE_STRUCT,r2cmp/eq r2,r9bf 1f#if STRUCT_VALUE_ADDRESS_WITH_ARGmov.l @r15+,r4bra 2fmov #5,r2#elsemov.l @r15+,r10#endif1:mov #4,r22:L_pass:cmp/pl r8bf L_call_itmov r3,r0and #3,r0L_pass_d:cmp/eq #FFI_TYPE_DOUBLE,r0bf L_pass_imov r15,r0and #7,r0tst r0,r0bt 1fadd #4,r151:mov #8,r0cmp/hs r0,r2bt/s 2fshlr2 r3bsr L_pop_dnop2:add #2,r2bra L_passadd #-8,r8L_pop_d:mov r2,r0add r0,r0add r2,r0add #-12,r0add r0,r0braf r0nopmov.l @r15+,r4rtsmov.l @r15+,r5mov.l @r15+,r5rtsmov.l @r15+,r6mov.l @r15+,r6rtsmov.l @r15+,r7rtsmov.l @r15+,r7L_pass_i:cmp/eq #FFI_TYPE_INT,r0bf L_call_itmov #8,r0cmp/hs r0,r2bt/s 2fshlr2 r3bsr L_pop_inop2:add #1,r2bra L_passadd #-4,r8L_pop_i:mov r2,r0shll2 r0add #-16,r0braf r0noprtsmov.l @r15+,r4rtsmov.l @r15+,r5rtsmov.l @r15+,r6rtsmov.l @r15+,r7L_call_it:# call function#if (! STRUCT_VALUE_ADDRESS_WITH_ARG)mov r10, r2#endifmov.l @(28,r14),r1jsr @r1nopL_ret_d:mov #FFI_TYPE_DOUBLE,r2cmp/eq r2,r9bf L_ret_llmov.l @(24,r14),r2mov.l r0,@r2bra L_epiloguemov.l r1,@(4,r2)L_ret_ll:mov #FFI_TYPE_SINT64,r2cmp/eq r2,r9bt/s 1fmov #FFI_TYPE_UINT64,r2cmp/eq r2,r9bf L_ret_i1:mov.l @(24,r14),r2mov.l r0,@r2bra L_epiloguemov.l r1,@(4,r2)L_ret_i:mov #FFI_TYPE_FLOAT,r2cmp/eq r2,r9bt 1fmov #FFI_TYPE_INT,r2cmp/eq r2,r9bf L_epilogue1:mov.l @(24,r14),r1bra L_epiloguemov.l r0,@r1L_epilogue:# Remove the space we pushed for the argsmov r14,r15lds.l @r15+,prmov.l @r15+,r14mov.l @r15+,r12mov.l @r15+,r10mov.l @r15+,r9rtsmov.l @r15+,r8#endif.LFE1:.ffi_call_SYSV_end:.size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV).globl ffi_closure_helper_SYSVENTRY(ffi_closure_SYSV).LFB2:mov.l r7,@-r15.LCFI7:mov.l r6,@-r15.LCFI8:mov.l r5,@-r15.LCFI9:mov.l r4,@-r15.LCFIA:mov.l r14,@-r15.LCFIB:sts.l pr,@-r15/* Stack layout:xx bytes (on stack parameters)16 bytes (register parameters)4 bytes (saved frame pointer)4 bytes (saved return address)32 bytes (floating register parameters, SH-4 only)8 bytes (result)4 bytes (pad)4 bytes (5th arg)<- new stack pointer*/.LCFIC:#if defined(__SH4__)add #-48,r15#elseadd #-16,r15#endif.LCFID:mov r15,r14.LCFIE:#if defined(__SH4__)mov r14,r1add #48,r1#ifdef __LITTLE_ENDIAN__fmov.s fr10,@-r1fmov.s fr11,@-r1fmov.s fr8,@-r1fmov.s fr9,@-r1fmov.s fr6,@-r1fmov.s fr7,@-r1fmov.s fr4,@-r1fmov.s fr5,@-r1#elsefmov.s fr11,@-r1fmov.s fr10,@-r1fmov.s fr9,@-r1fmov.s fr8,@-r1fmov.s fr7,@-r1fmov.s fr6,@-r1fmov.s fr5,@-r1fmov.s fr4,@-r1#endifmov r1,r7mov r14,r6add #56,r6#elsemov r14,r6add #24,r6#endifbt/s 10fmov r2, r5mov r14,r1add #8,r1mov r1,r510:mov r14,r1#if defined(__SH4__)add #72,r1#elseadd #40,r1#endifmov.l r1,@r14#ifdef PICmov.l L_got,r1mova L_got,r0add r0,r1mov.l L_helper,r0add r1,r0#elsemov.l L_helper,r0#endifjsr @r0mov r3,r4shll r0mov r0,r1mova L_table,r0add r1,r0mov.w @r0,r0mov r14,r2braf r0add #8,r20:.align 2#ifdef PICL_got:.long _GLOBAL_OFFSET_TABLE_L_helper:.long ffi_closure_helper_SYSV@GOTOFF#elseL_helper:.long ffi_closure_helper_SYSV#endifL_table:.short L_case_v - 0b /* FFI_TYPE_VOID */.short L_case_i - 0b /* FFI_TYPE_INT */#if defined(__SH4__).short L_case_f - 0b /* FFI_TYPE_FLOAT */.short L_case_d - 0b /* FFI_TYPE_DOUBLE */.short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */#else.short L_case_i - 0b /* FFI_TYPE_FLOAT */.short L_case_ll - 0b /* FFI_TYPE_DOUBLE */.short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */#endif.short L_case_uq - 0b /* FFI_TYPE_UINT8 */.short L_case_q - 0b /* FFI_TYPE_SINT8 */.short L_case_uh - 0b /* FFI_TYPE_UINT16 */.short L_case_h - 0b /* FFI_TYPE_SINT16 */.short L_case_i - 0b /* FFI_TYPE_UINT32 */.short L_case_i - 0b /* FFI_TYPE_SINT32 */.short L_case_ll - 0b /* FFI_TYPE_UINT64 */.short L_case_ll - 0b /* FFI_TYPE_SINT64 */.short L_case_v - 0b /* FFI_TYPE_STRUCT */.short L_case_i - 0b /* FFI_TYPE_POINTER */#if defined(__SH4__)L_case_d:#ifdef __LITTLE_ENDIAN__fmov.s @r2+,fr1bra L_case_vfmov.s @r2,fr0#elsefmov.s @r2+,fr0bra L_case_vfmov.s @r2,fr1#endifL_case_f:bra L_case_vfmov.s @r2,fr0#endifL_case_ll:mov.l @r2+,r0bra L_case_vmov.l @r2,r1L_case_i:bra L_case_vmov.l @r2,r0L_case_q:#ifdef __LITTLE_ENDIAN__#elseadd #3,r2#endifbra L_case_vmov.b @r2,r0L_case_uq:#ifdef __LITTLE_ENDIAN__#elseadd #3,r2#endifmov.b @r2,r0bra L_case_vextu.b r0,r0L_case_h:#ifdef __LITTLE_ENDIAN__#elseadd #2,r2#endifbra L_case_vmov.w @r2,r0L_case_uh:#ifdef __LITTLE_ENDIAN__#elseadd #2,r2#endifmov.w @r2,r0extu.w r0,r0/* fall through */L_case_v:#if defined(__SH4__)add #48,r15#elseadd #16,r15#endiflds.l @r15+,prmov.l @r15+,r14rtsadd #16,r15.LFE2:.ffi_closure_SYSV_end:.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV).section ".eh_frame","aw",@progbits__FRAME_BEGIN__:.4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */.LSCIE1:.4byte 0x0 /* CIE Identifier Tag */.byte 0x1 /* CIE Version */#ifdef PIC.ascii "zR\0" /* CIE Augmentation */#else.byte 0x0 /* CIE Augmentation */#endif.byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */.byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */.byte 0x11 /* CIE RA Column */#ifdef PIC.uleb128 0x1 /* Augmentation size */.byte 0x10 /* FDE Encoding (pcrel) */#endif.byte 0xc /* DW_CFA_def_cfa */.byte 0xf /* uleb128 0xf */.byte 0x0 /* uleb128 0x0 */.align 2.LECIE1:.LSFDE1:.4byte .LEFDE1-.LASFDE1 /* FDE Length */.LASFDE1:.4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */#ifdef PIC.4byte .LFB1-. /* FDE initial location */#else.4byte .LFB1 /* FDE initial location */#endif.4byte .LFE1-.LFB1 /* FDE address range */#ifdef PIC.uleb128 0x0 /* Augmentation size */#endif.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI0-.LFB1.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x4 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI1-.LCFI0.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x8 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI2-.LCFI1.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0xc /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI3-.LCFI2.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x10 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI4-.LCFI3.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x14 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI5-.LCFI4.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x18 /* uleb128 0x4 */.byte 0x91 /* DW_CFA_offset, column 0x11 */.byte 0x6 /* uleb128 0x6 */.byte 0x8e /* DW_CFA_offset, column 0xe */.byte 0x5 /* uleb128 0x5 */.byte 0x8c /* DW_CFA_offset, column 0xc */.byte 0x4 /* uleb128 0x4 */.byte 0x8a /* DW_CFA_offset, column 0xa */.byte 0x3 /* uleb128 0x3 */.byte 0x89 /* DW_CFA_offset, column 0x9 */.byte 0x2 /* uleb128 0x2 */.byte 0x88 /* DW_CFA_offset, column 0x8 */.byte 0x1 /* uleb128 0x1 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI6-.LCFI5.byte 0xd /* DW_CFA_def_cfa_register */.byte 0xe /* uleb128 0xe */.align 2.LEFDE1:.LSFDE3:.4byte .LEFDE3-.LASFDE3 /* FDE Length */.LASFDE3:.4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */#ifdef PIC.4byte .LFB2-. /* FDE initial location */#else.4byte .LFB2 /* FDE initial location */#endif.4byte .LFE2-.LFB2 /* FDE address range */#ifdef PIC.uleb128 0x0 /* Augmentation size */#endif.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI7-.LFB2.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x4 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI8-.LCFI7.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x8 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFI9-.LCFI8.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0xc /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFIA-.LCFI9.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x10 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFIB-.LCFIA.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x14 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFIC-.LCFIB.byte 0xe /* DW_CFA_def_cfa_offset */.byte 0x18 /* uleb128 0x4 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFID-.LCFIC.byte 0xe /* DW_CFA_def_cfa_offset */#if defined(__SH4__).byte 24+48 /* uleb128 24+48 */#else.byte 24+16 /* uleb128 24+16 */#endif.byte 0x91 /* DW_CFA_offset, column 0x11 */.byte 0x6 /* uleb128 0x6 */.byte 0x8e /* DW_CFA_offset, column 0xe */.byte 0x5 /* uleb128 0x5 */.byte 0x8b /* DW_CFA_offset, column 0xb */.byte 0x4 /* uleb128 0x4 */.byte 0x8a /* DW_CFA_offset, column 0xa */.byte 0x3 /* uleb128 0x3 */.byte 0x89 /* DW_CFA_offset, column 0x9 */.byte 0x2 /* uleb128 0x2 */.byte 0x88 /* DW_CFA_offset, column 0x8 */.byte 0x1 /* uleb128 0x1 */.byte 0x4 /* DW_CFA_advance_loc4 */.4byte .LCFIE-.LCFID.byte 0xd /* DW_CFA_def_cfa_register */.byte 0xe /* uleb128 0xe */.align 2.LEFDE3:
