annotate dyncall/dyncall_call_mips_o32.S @ 302:d55f9d508074

- mips softfloat support for o32 callconv (calls and callbacks, little and big endian) - cleanup of some mips files, removed unnecessary file, renamings.. - doc/manual cleanups, changelog entry
author Tassilo Philipp
date Mon, 21 May 2018 02:48:12 +0200
parents dyncall/dyncall_call_mips_o32_gas.s@f5453308ff36
children 72b450cc3be8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 Package: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 Library: dyncall
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
5 File: dyncall/dyncall_call_mips_o32.S
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 Description: mips "o32" abi call kernel implementation in GNU Assembler
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 License:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
9 Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 Tassilo Philipp <tphilipp@potion-studios.com>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 /* $4 target function */
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
26 /* $5 register data */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 /* $6 stack size (min 16-byte aligned to 8-bytes already) */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 /* $7 stack data */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 .section .mdebug.abi32
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 .previous
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 .abicalls
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 .text
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
36 .align 2
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
37 .globl dcCall_mips_o32
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
38 .ent dcCall_mips_o32
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
39 .type dcCall_mips_o32, @function
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 dcCall_mips_o32:
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
41 .frame $fp,40,$31 /* vars=8, regs=2/0, args=16, gp=8 */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
42 .mask 0xc0000000,-4
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
43 .fmask 0x00000000,0
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
44 .set noreorder
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
46 addiu $sp,$sp,-8
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
47 sw $31,4($sp) /* save link register */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
48 sw $fp,0($sp) /* save frame pointer */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 nop
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
50 move $fp,$sp /* frame pointer = sp */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
51 sub $sp, $sp, $6 /* increment stack */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 /* copy stack data */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 /* $12 source pointer (parameter stack data) */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 /* $14 destination (stack pointer) */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 /* $6 byte count */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
59 move $12, $7
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
60 move $14, $sp
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 .next:
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
63 beq $6, $0, .skip
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 nop
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
65 lw $2, 0($12)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 nop
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
67 sw $2, 0($14)
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
68 addiu $12,$12, 4
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
69 addiu $14,$14, 4
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
70 addiu $6, $6, -4
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
71 j .next
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 nop
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 .skip:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
75 #if defined(DC__ABI_HARDFLOAT)
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
76 /* load two double-precision floating-point argument registers ($f12, $f14) - not for softfloat */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 l.d $f12, 0($5)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 l.d $f14, 8($5)
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
80 #endif
101
1ce60358fbad - mips related cleanup, mostly comments, cpp macro lib
cslag
parents: 0
diff changeset
81
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82 /* prepare call */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
84 move $12, $7 /* $12 stack data */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
85 move $25, $4 /* $25 target function */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 /* load first four integer arguments ($4-$7) */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
89 lw $4, 0($12)
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
90 lw $5, 4($12)
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
91 lw $6, 8($12)
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
92 lw $7,12($12)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 /* call target function */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
96 jalr $25
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 nop
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
98 move $sp,$fp /* restore stack pointer */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 nop
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
100 lw $31,4($sp) /* restore return address */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
101 lw $fp,0($sp) /* restore frame pointer */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
102 addiu $sp,$sp,8 /* end stack frame */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
103 j $31 /* return */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 nop
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
106 .set reorder
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
107 .end dcCall_mips_o32
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 107
diff changeset
108 .ident "handwritten"
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109