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