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

Subversion Repositories scarts

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* -----------------------------------------------------------------------
2
   sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005  Red Hat, Inc.
3
 
4
   X86 Foreign Function Interface
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 CYGNUS SOLUTIONS 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
#ifndef __x86_64__
27
 
28
#define LIBFFI_ASM
29
#include 
30
#include 
31
 
32
.text
33
 
34
.globl ffi_prep_args
35
 
36
        .align 4
37
.globl ffi_call_SYSV
38
        .type    ffi_call_SYSV,@function
39
 
40
ffi_call_SYSV:
41
.LFB1:
42
        pushl %ebp
43
.LCFI0:
44
        movl  %esp,%ebp
45
.LCFI1:
46
        /* Make room for all of the new args.  */
47
        movl  16(%ebp),%ecx
48
        subl  %ecx,%esp
49
 
50
        movl  %esp,%eax
51
 
52
        /* Place all of the ffi_prep_args in position  */
53
        pushl 12(%ebp)
54
        pushl %eax
55
        call  *8(%ebp)
56
 
57
        /* Return stack to previous state and call the function  */
58
        addl  $8,%esp
59
 
60
        call  *28(%ebp)
61
 
62
        /* Remove the space we pushed for the args  */
63
        movl  16(%ebp),%ecx
64
        addl  %ecx,%esp
65
 
66
        /* Load %ecx with the return type code  */
67
        movl  20(%ebp),%ecx
68
 
69
        /* If the return value pointer is NULL, assume no return value.  */
70
        cmpl  $0,24(%ebp)
71
        jne   retint
72
 
73
        /* Even if there is no space for the return value, we are
74
           obliged to handle floating-point values.  */
75
        cmpl  $FFI_TYPE_FLOAT,%ecx
76
        jne   noretval
77
        fstp  %st(0)
78
 
79
        jmp   epilogue
80
 
81
retint:
82
        cmpl  $FFI_TYPE_INT,%ecx
83
        jne   retfloat
84
        /* Load %ecx with the pointer to storage for the return value  */
85
        movl  24(%ebp),%ecx
86
        movl  %eax,0(%ecx)
87
        jmp   epilogue
88
 
89
retfloat:
90
        cmpl  $FFI_TYPE_FLOAT,%ecx
91
        jne   retdouble
92
        /* Load %ecx with the pointer to storage for the return value  */
93
        movl  24(%ebp),%ecx
94
        fstps (%ecx)
95
        jmp   epilogue
96
 
97
retdouble:
98
        cmpl  $FFI_TYPE_DOUBLE,%ecx
99
        jne   retlongdouble
100
        /* Load %ecx with the pointer to storage for the return value  */
101
        movl  24(%ebp),%ecx
102
        fstpl (%ecx)
103
        jmp   epilogue
104
 
105
retlongdouble:
106
        cmpl  $FFI_TYPE_LONGDOUBLE,%ecx
107
        jne   retint64
108
        /* Load %ecx with the pointer to storage for the return value  */
109
        movl  24(%ebp),%ecx
110
        fstpt (%ecx)
111
        jmp   epilogue
112
 
113
retint64:
114
        cmpl  $FFI_TYPE_SINT64,%ecx
115
        jne   retstruct
116
        /* Load %ecx with the pointer to storage for the return value  */
117
        movl  24(%ebp),%ecx
118
        movl  %eax,0(%ecx)
119
        movl  %edx,4(%ecx)
120
 
121
retstruct:
122
        /* Nothing to do!  */
123
 
124
noretval:
125
epilogue:
126
        movl %ebp,%esp
127
        popl %ebp
128
        ret
129
.LFE1:
130
.ffi_call_SYSV_end:
131
        .size    ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
132
 
133
        .align  4
134
FFI_HIDDEN (ffi_closure_SYSV)
135
.globl ffi_closure_SYSV
136
        .type   ffi_closure_SYSV, @function
137
 
138
ffi_closure_SYSV:
139
.LFB2:
140
        pushl   %ebp
141
.LCFI2:
142
        movl    %esp, %ebp
143
.LCFI3:
144
        subl    $40, %esp
145
        leal    -24(%ebp), %edx
146
        movl    %edx, -12(%ebp) /* resp */
147
        leal    8(%ebp), %edx
148
        movl    %edx, 4(%esp)   /* args = __builtin_dwarf_cfa () */
149
        leal    -12(%ebp), %edx
150
        movl    %edx, (%esp)    /* &resp */
151
#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__
152
        call    ffi_closure_SYSV_inner
153
#else
154
        movl    %ebx, 8(%esp)
155
.LCFI7:
156
        call    1f
157
1:      popl    %ebx
158
        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
159
        call    ffi_closure_SYSV_inner@PLT
160
        movl    8(%esp), %ebx
161
#endif
162
        movl    -12(%ebp), %ecx
163
        cmpl    $FFI_TYPE_INT, %eax
164
        je      .Lcls_retint
165
        cmpl    $FFI_TYPE_FLOAT, %eax
166
        je      .Lcls_retfloat
167
        cmpl    $FFI_TYPE_DOUBLE, %eax
168
        je      .Lcls_retdouble
169
        cmpl    $FFI_TYPE_LONGDOUBLE, %eax
170
        je      .Lcls_retldouble
171
        cmpl    $FFI_TYPE_SINT64, %eax
172
        je      .Lcls_retllong
173
.Lcls_epilogue:
174
        movl    %ebp, %esp
175
        popl    %ebp
176
        ret
177
.Lcls_retint:
178
        movl    (%ecx), %eax
179
        jmp     .Lcls_epilogue
180
.Lcls_retfloat:
181
        flds    (%ecx)
182
        jmp     .Lcls_epilogue
183
.Lcls_retdouble:
184
        fldl    (%ecx)
185
        jmp     .Lcls_epilogue
186
.Lcls_retldouble:
187
        fldt    (%ecx)
188
        jmp     .Lcls_epilogue
189
.Lcls_retllong:
190
        movl    (%ecx), %eax
191
        movl    4(%ecx), %edx
192
        jmp     .Lcls_epilogue
193
.LFE2:
194
        .size   ffi_closure_SYSV, .-ffi_closure_SYSV
195
 
196
#if !FFI_NO_RAW_API
197
 
198
#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
199
#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
200
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
201
#define CIF_FLAGS_OFFSET 20
202
 
203
        .align  4
204
FFI_HIDDEN (ffi_closure_raw_SYSV)
205
.globl ffi_closure_raw_SYSV
206
        .type   ffi_closure_raw_SYSV, @function
207
 
208
ffi_closure_raw_SYSV:
209
.LFB3:
210
        pushl   %ebp
211
.LCFI4:
212
        movl    %esp, %ebp
213
.LCFI5:
214
        pushl   %esi
215
.LCFI6:
216
        subl    $36, %esp
217
        movl    RAW_CLOSURE_CIF_OFFSET(%eax), %esi       /* closure->cif */
218
        movl    RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
219
        movl    %edx, 12(%esp)  /* user_data */
220
        leal    8(%ebp), %edx   /* __builtin_dwarf_cfa () */
221
        movl    %edx, 8(%esp)   /* raw_args */
222
        leal    -24(%ebp), %edx
223
        movl    %edx, 4(%esp)   /* &res */
224
        movl    %esi, (%esp)    /* cif */
225
        call    *RAW_CLOSURE_FUN_OFFSET(%eax)            /* closure->fun */
226
        movl    CIF_FLAGS_OFFSET(%esi), %eax             /* rtype */
227
        cmpl    $FFI_TYPE_INT, %eax
228
        je      .Lrcls_retint
229
        cmpl    $FFI_TYPE_FLOAT, %eax
230
        je      .Lrcls_retfloat
231
        cmpl    $FFI_TYPE_DOUBLE, %eax
232
        je      .Lrcls_retdouble
233
        cmpl    $FFI_TYPE_LONGDOUBLE, %eax
234
        je      .Lrcls_retldouble
235
        cmpl    $FFI_TYPE_SINT64, %eax
236
        je      .Lrcls_retllong
237
.Lrcls_epilogue:
238
        addl    $36, %esp
239
        popl    %esi
240
        popl    %ebp
241
        ret
242
.Lrcls_retint:
243
        movl    -24(%ebp), %eax
244
        jmp     .Lrcls_epilogue
245
.Lrcls_retfloat:
246
        flds    -24(%ebp)
247
        jmp     .Lrcls_epilogue
248
.Lrcls_retdouble:
249
        fldl    -24(%ebp)
250
        jmp     .Lrcls_epilogue
251
.Lrcls_retldouble:
252
        fldt    -24(%ebp)
253
        jmp     .Lrcls_epilogue
254
.Lrcls_retllong:
255
        movl    -24(%ebp), %eax
256
        movl    -20(%ebp), %edx
257
        jmp     .Lrcls_epilogue
258
.LFE3:
259
        .size   ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV
260
#endif
261
 
262
        .section        .eh_frame,EH_FRAME_FLAGS,@progbits
263
.Lframe1:
264
        .long   .LECIE1-.LSCIE1 /* Length of Common Information Entry */
265
.LSCIE1:
266
        .long   0x0     /* CIE Identifier Tag */
267
        .byte   0x1     /* CIE Version */
268
#ifdef __PIC__
269
        .ascii "zR\0"   /* CIE Augmentation */
270
#else
271
        .ascii "\0"     /* CIE Augmentation */
272
#endif
273
        .byte   0x1     /* .uleb128 0x1; CIE Code Alignment Factor */
274
        .byte   0x7c    /* .sleb128 -4; CIE Data Alignment Factor */
275
        .byte   0x8     /* CIE RA Column */
276
#ifdef __PIC__
277
        .byte   0x1     /* .uleb128 0x1; Augmentation size */
278
        .byte   0x1b    /* FDE Encoding (pcrel sdata4) */
279
#endif
280
        .byte   0xc     /* DW_CFA_def_cfa */
281
        .byte   0x4     /* .uleb128 0x4 */
282
        .byte   0x4     /* .uleb128 0x4 */
283
        .byte   0x88    /* DW_CFA_offset, column 0x8 */
284
        .byte   0x1     /* .uleb128 0x1 */
285
        .align 4
286
.LECIE1:
287
.LSFDE1:
288
        .long   .LEFDE1-.LASFDE1        /* FDE Length */
289
.LASFDE1:
290
        .long   .LASFDE1-.Lframe1       /* FDE CIE offset */
291
#ifdef __PIC__
292
        .long   .LFB1-. /* FDE initial location */
293
#else
294
        .long   .LFB1   /* FDE initial location */
295
#endif
296
        .long   .LFE1-.LFB1     /* FDE address range */
297
#ifdef __PIC__
298
        .byte   0x0     /* .uleb128 0x0; Augmentation size */
299
#endif
300
        .byte   0x4     /* DW_CFA_advance_loc4 */
301
        .long   .LCFI0-.LFB1
302
        .byte   0xe     /* DW_CFA_def_cfa_offset */
303
        .byte   0x8     /* .uleb128 0x8 */
304
        .byte   0x85    /* DW_CFA_offset, column 0x5 */
305
        .byte   0x2     /* .uleb128 0x2 */
306
        .byte   0x4     /* DW_CFA_advance_loc4 */
307
        .long   .LCFI1-.LCFI0
308
        .byte   0xd     /* DW_CFA_def_cfa_register */
309
        .byte   0x5     /* .uleb128 0x5 */
310
        .align 4
311
.LEFDE1:
312
.LSFDE2:
313
        .long   .LEFDE2-.LASFDE2        /* FDE Length */
314
.LASFDE2:
315
        .long   .LASFDE2-.Lframe1       /* FDE CIE offset */
316
#ifdef __PIC__
317
        .long   .LFB2-. /* FDE initial location */
318
#else
319
        .long   .LFB2
320
#endif
321
        .long   .LFE2-.LFB2     /* FDE address range */
322
#ifdef __PIC__
323
        .byte   0x0     /* .uleb128 0x0; Augmentation size */
324
#endif
325
        .byte   0x4     /* DW_CFA_advance_loc4 */
326
        .long   .LCFI2-.LFB2
327
        .byte   0xe     /* DW_CFA_def_cfa_offset */
328
        .byte   0x8     /* .uleb128 0x8 */
329
        .byte   0x85    /* DW_CFA_offset, column 0x5 */
330
        .byte   0x2     /* .uleb128 0x2 */
331
        .byte   0x4     /* DW_CFA_advance_loc4 */
332
        .long   .LCFI3-.LCFI2
333
        .byte   0xd     /* DW_CFA_def_cfa_register */
334
        .byte   0x5     /* .uleb128 0x5 */
335
#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__
336
        .byte   0x4     /* DW_CFA_advance_loc4 */
337
        .long   .LCFI7-.LCFI3
338
        .byte   0x83    /* DW_CFA_offset, column 0x3 */
339
        .byte   0xa     /* .uleb128 0xa */
340
#endif
341
        .align 4
342
.LEFDE2:
343
 
344
#if !FFI_NO_RAW_API
345
 
346
.LSFDE3:
347
        .long   .LEFDE3-.LASFDE3        /* FDE Length */
348
.LASFDE3:
349
        .long   .LASFDE3-.Lframe1       /* FDE CIE offset */
350
#ifdef __PIC__
351
        .long   .LFB3-. /* FDE initial location */
352
#else
353
        .long   .LFB3
354
#endif
355
        .long   .LFE3-.LFB3     /* FDE address range */
356
#ifdef __PIC__
357
        .byte   0x0     /* .uleb128 0x0; Augmentation size */
358
#endif
359
        .byte   0x4     /* DW_CFA_advance_loc4 */
360
        .long   .LCFI4-.LFB3
361
        .byte   0xe     /* DW_CFA_def_cfa_offset */
362
        .byte   0x8     /* .uleb128 0x8 */
363
        .byte   0x85    /* DW_CFA_offset, column 0x5 */
364
        .byte   0x2     /* .uleb128 0x2 */
365
        .byte   0x4     /* DW_CFA_advance_loc4 */
366
        .long   .LCFI5-.LCFI4
367
        .byte   0xd     /* DW_CFA_def_cfa_register */
368
        .byte   0x5     /* .uleb128 0x5 */
369
        .byte   0x4     /* DW_CFA_advance_loc4 */
370
        .long   .LCFI6-.LCFI5
371
        .byte   0x86    /* DW_CFA_offset, column 0x6 */
372
        .byte   0x3     /* .uleb128 0x3 */
373
        .align 4
374
.LEFDE3:
375
 
376
#endif
377
 
378
#endif /* ifndef __x86_64__ */

powered by: WebSVN 2.1.0

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