URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [src/] [avr32/] [sysv.S] - Rev 732
Compare with Previous | Blame | View Log
/* -----------------------------------------------------------------------sysv.S - Copyright (c) 2009 Bradley Smith <brad@brad-smith.co.uk>AVR32 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 AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.--------------------------------------------------------------------- */#define LIBFFI_ASM#include <fficonfig.h>#include <ffi.h>/* r12: ffi_prep_args* r11: &ecif* r10: size* r9: cif->flags* r8: ecif.rvalue* sp+0: cif->rstruct_flag* sp+4: fn */.text.align 1.globl ffi_call_SYSV.type ffi_call_SYSV, @functionffi_call_SYSV:stm --sp, r0,r1,lrstm --sp, r8-r12mov r0, sp/* Make room for all of the new args. */sub sp, r10/* Pad to make way for potential skipped registers */sub sp, 20/* Call ffi_prep_args(stack, &ecif). *//* r11 already set */mov r1, r12mov r12, spicall r1/* Save new argument size */mov r1, r12/* Move first 5 parameters in registers. */ldm sp++, r8-r12/* call (fn) (...). */ld.w r1, r0[36]icall r1/* Remove the space we pushed for the args. */mov sp, r0/* Load r1 with the rstruct flag. */ld.w r1, sp[32]/* Load r9 with the return type code. */ld.w r9, sp[12]/* Load r8 with the return value pointer. */ld.w r8, sp[16]/* If the return value pointer is NULL, assume no return value. */cp.w r8, 0breq .Lend/* Check if return type is actually a struct */cp.w r1, 0breq 1f/* Return 8bit */cp.w r9, FFI_TYPE_UINT8breq .Lstore8/* Return 16bit */cp.w r9, FFI_TYPE_UINT16breq .Lstore161:/* Return 32bit */cp.w r9, FFI_TYPE_UINT32breq .Lstore32cp.w r9, FFI_TYPE_UINT16breq .Lstore32cp.w r9, FFI_TYPE_UINT8breq .Lstore32/* Return 64bit */cp.w r9, FFI_TYPE_UINT64breq .Lstore64/* Didn't match anything */bral .Lend.Lstore64:st.w r8[0], r11st.w r8[4], r10bral .Lend.Lstore32:st.w r8[0], r12bral .Lend.Lstore16:st.h r8[0], r12bral .Lend.Lstore8:st.b r8[0], r12bral .Lend.Lend:sub sp, -20ldm sp++, r0,r1,pc.size ffi_call_SYSV, . - ffi_call_SYSV/* r12: __ctx* r11: __rstruct_flag* r10: __inner */.align 1.globl ffi_closure_SYSV.type ffi_closure_SYSV, @functionffi_closure_SYSV:stm --sp, r0,lrmov r0, r11mov r8, r10sub r10, sp, -8sub sp, 12st.w sp[8], spsub r11, sp, -8icall r8/* Check if return type is actually a struct */cp.w r0, 0breq 1f/* Return 8bit */cp.w r12, FFI_TYPE_UINT8breq .Lget8/* Return 16bit */cp.w r12, FFI_TYPE_UINT16breq .Lget161:/* Return 32bit */cp.w r12, FFI_TYPE_UINT32breq .Lget32cp.w r12, FFI_TYPE_UINT16breq .Lget32cp.w r12, FFI_TYPE_UINT8breq .Lget32/* Return 64bit */cp.w r12, FFI_TYPE_UINT64breq .Lget64/* Didn't match anything */bral .Lclend.Lget64:ld.w r11, sp[0]ld.w r10, sp[4]bral .Lclend.Lget32:ld.w r12, sp[0]bral .Lclend.Lget16:ld.uh r12, sp[0]bral .Lclend.Lget8:ld.ub r12, sp[0]bral .Lclend.Lclend:sub sp, -12ldm sp++, r0,lrsub sp, -20mov pc, lr.size ffi_closure_SYSV, . - ffi_closure_SYSV#if defined __ELF__ && defined __linux__.section .note.GNU-stack,"",@progbits#endif
