0
|
1 /*
|
|
2
|
|
3 Package: dyncall
|
|
4 Library: dyncall
|
|
5 File: dyncall/dyncall_call_mips_eabi_gas.s
|
94
|
6 Description: mips "eabi" abi call kernel implementation in GNU Assembler
|
0
|
7 License:
|
|
8
|
|
9 Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
|
|
10 Tassilo Philipp <tphilipp@potion-studios.com>
|
|
11
|
|
12 Permission to use, copy, modify, and distribute this software for any
|
|
13 purpose with or without fee is hereby granted, provided that the above
|
|
14 copyright notice and this permission notice appear in all copies.
|
|
15
|
|
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
23
|
|
24 */
|
|
25
|
|
26
|
|
27 /*//////////////////////////////////////////////////////////////////////
|
|
28
|
|
29 dyncall_call_mips_eabi_gas.s
|
|
30
|
|
31 MIPS 32bit family of processors.
|
|
32 2008-01-03
|
|
33
|
|
34 //////////////////////////////////////////////////////////////////////*/
|
|
35 .text
|
|
36 .globl dcCall_mips_eabi
|
|
37
|
|
38 dcCall_mips_eabi:
|
|
39 /* $4 target function */
|
110
|
40 /* $5 register data */
|
0
|
41 /* $6 stack size */
|
|
42 /* $7 stack data */
|
|
43 addiu $sp,$sp,-16
|
|
44 sw $16,8($sp)
|
|
45 sw $31,4($sp)
|
|
46 sw $fp,0($sp)
|
|
47
|
|
48 move $fp,$sp
|
110
|
49
|
0
|
50 move $2, $0
|
|
51 add $2, 8
|
|
52 neg $2
|
|
53 and $sp, $2
|
|
54 add $6, 7
|
|
55 and $6, $2
|
|
56
|
|
57 move $12,$4 /* target function */
|
|
58 move $13,$5 /* register data */
|
|
59 move $16,$6 /* stack size */
|
110
|
60
|
0
|
61 sub $sp,$sp,$16 /* allocate stack frame */
|
110
|
62
|
0
|
63 /* copy stack data */
|
|
64
|
|
65 .next:
|
|
66 beq $6,$0, .skip
|
|
67 nop
|
|
68 addiu $6,$6, -4
|
|
69
|
|
70 lw $2, 0($7)
|
|
71 sw $2, 0($sp)
|
|
72 addiu $7,$7, 4
|
|
73 addiu $sp,$sp, 4
|
|
74 j .next
|
|
75 nop
|
110
|
76
|
|
77 .skip:
|
0
|
78
|
|
79 sub $sp,$sp,$16
|
|
80
|
|
81 /* load integer parameter registers */
|
|
82
|
|
83 lw $4 , 0($13)
|
|
84 lw $5 , 4($13)
|
|
85 lw $6 , 8($13)
|
|
86 lw $7 ,12($13)
|
|
87 lw $8 ,16($13)
|
|
88 lw $9 ,20($13)
|
|
89 lw $10,24($13)
|
|
90 lw $11,28($13)
|
|
91
|
109
|
92 /* load single-precision floating pointer parameter registers */
|
0
|
93
|
110
|
94 l.s $f12, 32($13)
|
|
95 l.s $f13, 36($13)
|
|
96 l.s $f14, 40($13)
|
|
97 l.s $f15, 44($13)
|
|
98 l.s $f16, 48($13)
|
|
99 l.s $f17, 52($13)
|
|
100 l.s $f18, 56($13)
|
|
101 l.s $f19, 60($13)
|
0
|
102
|
|
103 jal $12
|
|
104 nop
|
|
105
|
|
106 /* add $sp,$sp,$16 */
|
|
107 move $sp,$fp
|
|
108
|
|
109 lw $16,8($sp)
|
|
110 lw $31,4($sp)
|
|
111 lw $fp,0($sp)
|
|
112 addiu $sp,$sp,16
|
|
113 j $31
|
|
114 nop
|
|
115
|