OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [src/] [frv/] [eabi.S] - Blame information for rev 735

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 732 jeremybenn
/* -----------------------------------------------------------------------
2
   eabi.S - Copyright (c) 2004  Anthony Green
3
 
4
   FR-V Assembly glue.
5
 
6
   Permission is hereby granted, free of charge, to any person obtaining
7
   a copy of this software and associated documentation files (the
8
   ``Software''), to deal in the Software without restriction, including
9
   without limitation the rights to use, copy, modify, merge, publish,
10
   distribute, sublicense, and/or sell copies of the Software, and to
11
   permit persons to whom the Software is furnished to do so, subject to
12
   the following conditions:
13
 
14
   The above copyright notice and this permission notice shall be included
15
   in all copies or substantial portions of the Software.
16
 
17
   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
   IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
   OTHER DEALINGS IN THE SOFTWARE.
24
   ----------------------------------------------------------------------- */
25
 
26
#define LIBFFI_ASM
27
#include 
28
#include 
29
 
30
        .globl ffi_prep_args_EABI
31
 
32
        .text
33
        .p2align 4
34
        .globl ffi_call_EABI
35
        .type ffi_call_EABI, @function
36
 
37
        # gr8 :   ffi_prep_args
38
        # gr9 :   &ecif
39
        # gr10:   cif->bytes
40
        # gr11:   fig->flags
41
        # gr12:   ecif.rvalue
42
        # gr13:   fn
43
 
44
ffi_call_EABI:
45
        addi    sp, #-80, sp
46
        sti     fp, @(sp, #24)
47
        addi    sp, #24, fp
48
        movsg   lr, gr5
49
 
50
        /* Make room for the new arguments.  */
51
        /* subi sp, fp, gr10 */
52
 
53
        /* Store return address and incoming args on stack.  */
54
        sti     gr5, @(fp, #8)
55
        sti     gr8, @(fp, #-4)
56
        sti     gr9, @(fp, #-8)
57
        sti     gr10, @(fp, #-12)
58
        sti     gr11, @(fp, #-16)
59
        sti     gr12, @(fp, #-20)
60
        sti     gr13, @(fp, #-24)
61
 
62
        sub     sp, gr10, sp
63
 
64
        /* Call ffi_prep_args.  */
65
        ldi     @(fp, #-4), gr4
66
        addi    sp, #0, gr8
67
        ldi     @(fp, #-8), gr9
68
#ifdef __FRV_FDPIC__
69
        ldd     @(gr4, gr0), gr14
70
        calll   @(gr14, gr0)
71
#else
72
        calll   @(gr4, gr0)
73
#endif
74
 
75
        /* ffi_prep_args returns the new stack pointer.  */
76
        mov     gr8, gr4
77
 
78
        ldi     @(sp, #0), gr8
79
        ldi     @(sp, #4), gr9
80
        ldi     @(sp, #8), gr10
81
        ldi     @(sp, #12), gr11
82
        ldi     @(sp, #16), gr12
83
        ldi     @(sp, #20), gr13
84
 
85
        /* Always copy the return value pointer into the hidden
86
           parameter register.  This is only strictly necessary
87
           when we're returning an aggregate type, but it doesn't
88
           hurt to do this all the time, and it saves a branch.  */
89
        ldi     @(fp, #-20), gr3
90
 
91
        /* Use the ffi_prep_args return value for the new sp.  */
92
        mov     gr4, sp
93
 
94
        /* Call the target function.  */
95
        ldi     @(fp, -24), gr4
96
#ifdef __FRV_FDPIC__
97
        ldd     @(gr4, gr0), gr14
98
        calll   @(gr14, gr0)
99
#else
100
        calll   @(gr4, gr0)
101
#endif
102
 
103
        /* Store the result. */
104
        ldi     @(fp, #-16), gr10  /* fig->flags */
105
        ldi     @(fp, #-20), gr4   /* ecif.rvalue */
106
 
107
        /* Is the return value stored in two registers?  */
108
        cmpi    gr10, #8, icc0
109
        bne     icc0, 0, .L2
110
        /*   Yes, save them.  */
111
        sti     gr8, @(gr4, #0)
112
        sti     gr9, @(gr4, #4)
113
        bra     .L3
114
.L2:
115
        /* Is the return value a structure?  */
116
        cmpi    gr10, #-1, icc0
117
        beq     icc0, 0, .L3
118
        /*   No, save a 4 byte return value.  */
119
        sti     gr8, @(gr4, #0)
120
.L3:
121
 
122
        /* Restore the stack, and return.  */
123
        ldi     @(fp, 8), gr5
124
        ld      @(fp, gr0), fp
125
        addi    sp,#80,sp
126
        jmpl    @(gr5,gr0)
127
        .size ffi_call_EABI, .-ffi_call_EABI
128
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.