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

Subversion Repositories scarts

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* -----------------------------------------------------------------------
2
   sysv.S
3
 
4
   m68k Foreign Function Interface
5
   ----------------------------------------------------------------------- */
6
 
7
#define LIBFFI_ASM
8
#include 
9
#include 
10
 
11
        .text
12
 
13
        .globl  ffi_call_SYSV
14
        .type   ffi_call_SYSV,@function
15
 
16
ffi_call_SYSV:
17
        link    %fp,#0
18
        move.l  %d2,-(%sp)
19
 
20
        | Make room for all of the new args.
21
        sub.l   16(%fp),%sp
22
 
23
        | Call ffi_prep_args
24
        move.l  12(%fp),-(%sp)
25
        pea     4(%sp)
26
        move.l  8(%fp),%a0
27
        jsr     (%a0)
28
        addq.l  #8,%sp
29
 
30
        | Pass pointer to struct value, if any
31
        move.l  %a0,%a1
32
 
33
        | Call the function
34
        move.l  32(%fp),%a0
35
        jsr     (%a0)
36
 
37
        | Remove the space we pushed for the args
38
        add.l   16(%fp),%sp
39
 
40
        | Load the pointer to storage for the return value
41
        move.l  28(%fp),%a1
42
 
43
        | Load the return type code
44
        move.l  20(%fp),%d2
45
 
46
        | If the return value pointer is NULL, assume no return value.
47
        tst.l   %a1
48
        jbeq    noretval
49
 
50
        btst    #0,%d2
51
        jbeq    retlongint
52
        move.l  %d0,(%a1)
53
        jbra    epilogue
54
 
55
retlongint:
56
        btst    #1,%d2
57
        jbeq    retfloat
58
        move.l  %d0,(%a1)
59
        move.l  %d1,4(%a1)
60
        jbra    epilogue
61
 
62
retfloat:
63
        btst    #2,%d2
64
        jbeq    retdouble
65
        fmove.s %fp0,(%a1)
66
        jbra    epilogue
67
 
68
retdouble:
69
        btst    #3,%d2
70
        jbeq    retlongdouble
71
        fmove.d %fp0,(%a1)
72
        jbra    epilogue
73
 
74
retlongdouble:
75
        btst    #4,%d2
76
        jbeq    retpointer
77
        fmove.x %fp0,(%a1)
78
        jbra    epilogue
79
 
80
retpointer:
81
        btst    #5,%d2
82
        jbeq    retstruct
83
        move.l  %a0,(%a1)
84
        jbra    epilogue
85
 
86
retstruct:
87
        btst    #6,%d2
88
        jbeq    noretval
89
        move.l  24(%fp),%d2
90
        bfins   %d0,(%a1){#0,%d2}
91
 
92
noretval:
93
epilogue:
94
        move.l  (%sp)+,%d2
95
        unlk    %a6
96
        rts
97
        .size   ffi_call_SYSV,.-ffi_call_SYSV

powered by: WebSVN 2.1.0

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