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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libffi/] [src/] [powerpc/] [sysv.S] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* -----------------------------------------------------------------------
2
   sysv.h - Copyright (c) 1998 Geoffrey Keating
3
 
4
   PowerPC 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
#include 
30
 
31
#ifndef __powerpc64__
32
        .globl ffi_prep_args_SYSV
33
ENTRY(ffi_call_SYSV)
34
.LFB1:
35
        /* Save the old stack pointer as AP.  */
36
        mr      %r8,%r1
37
 
38
.LCFI0:
39
        /* Allocate the stack space we need.  */
40
        stwux   %r1,%r1,%r4
41
        /* Save registers we use.  */
42
        mflr    %r9
43
        stw     %r28,-16(%r8)
44
.LCFI1:
45
        stw     %r29,-12(%r8)
46
.LCFI2:
47
        stw     %r30, -8(%r8)
48
.LCFI3:
49
        stw     %r31, -4(%r8)
50
.LCFI4:
51
        stw     %r9,   4(%r8)
52
.LCFI5:
53
 
54
        /* Save arguments over call...  */
55
        mr      %r31,%r5        /* flags, */
56
        mr      %r30,%r6        /* rvalue, */
57
        mr      %r29,%r7        /* function address, */
58
        mr      %r28,%r8        /* our AP. */
59
.LCFI6:
60
 
61
        /* Call ffi_prep_args_SYSV.  */
62
        mr      %r4,%r1
63
        bl      ffi_prep_args_SYSV@local
64
 
65
        /* Now do the call.  */
66
        /* Set up cr1 with bits 4-7 of the flags.  */
67
        mtcrf   0x40,%r31
68
        /* Get the address to call into CTR.  */
69
        mtctr   %r29
70
        /* Load all those argument registers.  */
71
        lwz     %r3,-16-(8*4)(%r28)
72
        lwz     %r4,-16-(7*4)(%r28)
73
        lwz     %r5,-16-(6*4)(%r28)
74
        lwz     %r6,-16-(5*4)(%r28)
75
        bf-     5,1f
76
        nop
77
        lwz     %r7,-16-(4*4)(%r28)
78
        lwz     %r8,-16-(3*4)(%r28)
79
        lwz     %r9,-16-(2*4)(%r28)
80
        lwz     %r10,-16-(1*4)(%r28)
81
        nop
82
1:
83
 
84
        /* Load all the FP registers.  */
85
        bf-     6,2f
86
        lfd     %f1,-16-(8*4)-(8*8)(%r28)
87
        lfd     %f2,-16-(8*4)-(7*8)(%r28)
88
        lfd     %f3,-16-(8*4)-(6*8)(%r28)
89
        lfd     %f4,-16-(8*4)-(5*8)(%r28)
90
        nop
91
        lfd     %f5,-16-(8*4)-(4*8)(%r28)
92
        lfd     %f6,-16-(8*4)-(3*8)(%r28)
93
        lfd     %f7,-16-(8*4)-(2*8)(%r28)
94
        lfd     %f8,-16-(8*4)-(1*8)(%r28)
95
2:
96
 
97
        /* Make the call.  */
98
        bctrl
99
 
100
        /* Now, deal with the return value.  */
101
        mtcrf   0x01,%r31
102
        bt-     31,L(small_struct_return_value)
103
        bt-     30,L(done_return_value)
104
        bt-     29,L(fp_return_value)
105
        stw     %r3,0(%r30)
106
        bf+     28,L(done_return_value)
107
        stw     %r4,4(%r30)
108
        /* Fall through...  */
109
 
110
L(done_return_value):
111
        /* Restore the registers we used and return.  */
112
        lwz     %r9,   4(%r28)
113
        lwz     %r31, -4(%r28)
114
        mtlr    %r9
115
        lwz     %r30, -8(%r28)
116
        lwz     %r29,-12(%r28)
117
        lwz     %r28,-16(%r28)
118
        lwz     %r1,0(%r1)
119
        blr
120
 
121
L(fp_return_value):
122
        bf      28,L(float_return_value)
123
        stfd    %f1,0(%r30)
124
        b       L(done_return_value)
125
L(float_return_value):
126
        stfs    %f1,0(%r30)
127
        b       L(done_return_value)
128
 
129
L(small_struct_return_value):
130
        mtcrf   0x10,%r31       /* cr3  */
131
        bt-     15,L(smst_one_register)
132
        mtcrf   0x08,%r31       /* cr4  */
133
        bt-     16,L(smst_two_register)
134
        b       L(done_return_value)
135
 
136
L(smst_one_register):
137
        rlwinm  %r5,%r31,5+23,32-5,31 /* Extract the value to shift.  */
138
        slw     %r3,%r3,%r5
139
        stw     %r3,0(%r30)
140
        b       L(done_return_value)
141
L(smst_two_register):
142
        rlwinm  %r5,%r31,5+23,32-5,31 /* Extract the value to shift.  */
143
        cmpwi   %r5,0
144
        subfic  %r9,%r5,32
145
        slw     %r29,%r3,%r5
146
        srw     %r9,%r4,%r9
147
        beq-    L(smst_8byte)
148
        or      %r3,%r9,%r29
149
        slw     %r4,%r4,%r5
150
L(smst_8byte):
151
        stw     %r3,0(%r30)
152
        stw     %r4,4(%r30)
153
        b       L(done_return_value)
154
 
155
.LFE1:
156
END(ffi_call_SYSV)
157
 
158
      .section  ".eh_frame",EH_FRAME_FLAGS,@progbits
159
.Lframe1:
160
      .4byte    .LECIE1-.LSCIE1  /*  Length of Common Information Entry */
161
.LSCIE1:
162
      .4byte    0x0      /*  CIE Identifier Tag */
163
      .byte     0x1      /*  CIE Version */
164
#if defined _RELOCATABLE || defined __PIC__
165
      .ascii    "zR\0"   /*  CIE Augmentation */
166
#else
167
      .ascii    "\0"     /*  CIE Augmentation */
168
#endif
169
      .uleb128  0x1      /*  CIE Code Alignment Factor */
170
      .sleb128  -4       /*  CIE Data Alignment Factor */
171
      .byte     0x41     /*  CIE RA Column */
172
#if defined _RELOCATABLE || defined __PIC__
173
      .uleb128  0x1      /*  Augmentation size */
174
      .byte     0x1b     /*  FDE Encoding (pcrel sdata4) */
175
#endif
176
      .byte     0xc      /*  DW_CFA_def_cfa */
177
      .uleb128  0x1
178
      .uleb128  0x0
179
      .align 2
180
.LECIE1:
181
.LSFDE1:
182
      .4byte    .LEFDE1-.LASFDE1         /*  FDE Length */
183
.LASFDE1:
184
      .4byte    .LASFDE1-.Lframe1         /*  FDE CIE offset */
185
#if defined _RELOCATABLE || defined __PIC__
186
      .4byte    .LFB1-.  /*  FDE initial location */
187
#else
188
      .4byte    .LFB1    /*  FDE initial location */
189
#endif
190
      .4byte    .LFE1-.LFB1      /*  FDE address range */
191
#if defined _RELOCATABLE || defined __PIC__
192
      .uleb128  0x0      /*  Augmentation size */
193
#endif
194
      .byte     0x4      /*  DW_CFA_advance_loc4 */
195
      .4byte    .LCFI0-.LFB1
196
      .byte     0xd      /*  DW_CFA_def_cfa_register */
197
      .uleb128  0x08
198
      .byte     0x4      /*  DW_CFA_advance_loc4 */
199
      .4byte    .LCFI5-.LCFI0
200
      .byte     0x11     /*  DW_CFA_offset_extended_sf */
201
      .uleb128  0x41
202
      .sleb128  -1
203
      .byte     0x9f     /*  DW_CFA_offset, column 0x1f */
204
      .uleb128  0x1
205
      .byte     0x9e     /*  DW_CFA_offset, column 0x1e */
206
      .uleb128  0x2
207
      .byte     0x9d     /*  DW_CFA_offset, column 0x1d */
208
      .uleb128  0x3
209
      .byte     0x9c     /*  DW_CFA_offset, column 0x1c */
210
      .uleb128  0x4
211
      .byte     0x4      /*  DW_CFA_advance_loc4 */
212
      .4byte    .LCFI6-.LCFI5
213
      .byte     0xd      /*  DW_CFA_def_cfa_register */
214
      .uleb128  0x1c
215
      .align 2
216
.LEFDE1:
217
#endif

powered by: WebSVN 2.1.0

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