comparison dyncall/dyncall_call_mips_o32_gas.s @ 0:3e629dc19168

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:24:28 +0100
parents
children 1ce60358fbad
comparison
equal deleted inserted replaced
-1:000000000000 0:3e629dc19168
1 /*
2
3 Package: dyncall
4 Library: dyncall
5 File: dyncall/dyncall_call_mips_o32_gas.s
6 Description: mips "o32" abi call kernel implementation in GNU Assembler
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 /* $4 target function */
26 /* $5 register data */
27 /* $6 stack size (min 16-byte aligned to 8-bytes already) */
28 /* $7 stack data */
29
30
31
32 .section .mdebug.abi32
33 .previous
34 .abicalls
35 .text
36 .align 2
37 .globl dcCall_mips_o32
38 .ent dcCall_mips_o32
39 .type dcCall_mips_o32, @function
40 dcCall_mips_o32:
41 .frame $fp,40,$31 /* vars=8, regs=2/0, args=16, gp=8 */
42 .mask 0xc0000000,-4
43 .fmask 0x00000000,0
44 .set noreorder
45 .set nomacro
46
47 addiu $sp,$sp,-8
48 sw $31,4($sp) /* save link register */
49 sw $fp,0($sp) /* save frame pointer */
50 nop
51 move $fp,$sp /* frame pointer = sp */
52 sub $sp, $sp, $6 /* increment stack */
53
54 /* copy stack data */
55
56 /* $12 source pointer (parameter stack data) */
57 /* $14 destination (stack pointer) */
58 /* $6 byte count */
59
60 move $12, $7
61 move $14, $sp
62
63 .next:
64 beq $6, $0, .skip
65 nop
66 lw $2, 0($12)
67 nop
68 sw $2, 0($14)
69 addiu $12,$12, 4
70 addiu $14,$14, 4
71 addiu $6, $6, -4
72 j .next
73 nop
74 .skip:
75
76 /* load two double-precision floating-point argument registers ($f12, $f14) */
77
78 l.d $f12, 0($5)
79 l.d $f14, 8($5)
80 /* prepare call */
81
82
83 move $12, $7 /* $12 stack data */
84 move $25, $4 /* $25 target function */
85
86 /* load first four integer arguments ($4-$7) */
87
88 lw $4, 0($12)
89 lw $5, 4($12)
90 lw $6, 8($12)
91 lw $7,12($12)
92
93 /* call target function */
94
95 jalr $25
96 nop
97 move $sp,$fp /* restore stack pointer */
98 nop
99 lw $31,4($sp) /* restore return address */
100 lw $fp,0($sp) /* restore frame pointer */
101 addiu $sp,$sp,8 /* end stack frame */
102 j $31 /* return */
103 nop
104
105 .set macro
106 .set reorder
107 .end dcCall_mips_o32
108 .ident "handwritten"
109