Mercurial > pub > dyncall > dyncall
annotate dyncallback/dyncall_callback_mips_n64.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 | dyncallback/dyncall_callback_mips_n64_gas.s@1b0c02e827c4 |
children | b104c5beec8b |
rev | line source |
---|---|
94 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: dyncallback | |
302
d55f9d508074
- mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents:
138
diff
changeset
|
5 File: dyncallback/dyncall_callback_mips_n64.S |
101
1ce60358fbad
- mips related cleanup, mostly comments, cpp macro lib
cslag
parents:
94
diff
changeset
|
6 Description: Callback Thunk - Implementation for mips64 n64 |
94 | 7 License: |
8 | |
9 Copyright (c) 2016 Tassilo Philipp <tphilipp@potion-studios.com> | |
10 | |
11 Permission to use, copy, modify, and distribute this software for any | |
12 purpose with or without fee is hereby granted, provided that the above | |
13 copyright notice and this permission notice appear in all copies. | |
14 | |
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
22 | |
23 */ | |
24 | |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
25 /* input: |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
26 $t8 -> thunk |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
27 $t8+56 -> cb handler |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
28 $t8+64 -> userdata |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
29 */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
30 |
116 | 31 .section .mdebug.abi64 |
32 .previous | |
33 .abicalls | |
34 .text | |
35 .align 2 | |
94 | 36 .globl dcCallbackThunkEntry |
116 | 37 .ent dcCallbackThunkEntry |
94 | 38 dcCallbackThunkEntry: |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
39 .set noreorder |
94 | 40 |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
41 /* Prolog. */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
42 /* Frame size of 160b comes from following: */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
43 /* DCargs(fregs:64 + iregs:64 + regcounts:8 + stackptr:8) + retval:8 + ra:8 */ |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
44 daddiu $sp, $sp, -160 /* open frame */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
45 sd $ra, 152($sp) /* save link register */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
46 |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
47 .frame $fp,160,$31 /* specify our frame: fp,size,lr; creates virt $fp */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
48 /* code below doesn't use $fp though, as n/a with -O1 */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
49 /* Init return value */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
50 sd $zero, 144($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
51 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
52 /* Store float and int args where our DCargs member arrays are, in local area. */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
53 sd $4, 0($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
54 sd $5, 8($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
55 sd $6, 16($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
56 sd $7, 24($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
57 sd $8, 32($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
58 sd $9, 40($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
59 sd $10, 48($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
60 sd $11, 56($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
61 s.d $f12, 64($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
62 s.d $f13, 72($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
63 s.d $f14, 80($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
64 s.d $f15, 88($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
65 s.d $f16, 96($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
66 s.d $f17, 104($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
67 s.d $f18, 112($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
68 s.d $f19, 120($sp) |
116 | 69 |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
70 /* Init DCarg's reg_counts and stackptr. */ |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
71 sd $zero, 128($sp) /* reg_count */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
72 daddiu $4, $sp, 160 |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
73 sd $4, 136($sp) /* stackptr */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
74 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
75 /* Prepare callback handler call. */ |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
76 move $4, $24 /* Param 0 = DCCallback*, $24 ($t8) holds pointer to thunk */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
77 move $5, $sp /* Param 1 = DCArgs*, pointer to where pointer to args is stored */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
78 daddiu $6, $sp, 144 /* Param 2 = results pointer to 8b of local data on stack */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
79 ld $7, 64($24) /* Param 3 = userdata pointer */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
80 |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
81 ld $25, 56($24) /* store handler entry in $25 ($t9), required for PIC */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
82 jalr $25 /* jump */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
83 nop /* branch delay nop */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
84 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
85 /* Copy result in corresponding registers $2-$3 ($v0-$v1) and $f0 */ |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
86 ld $2, 144($sp) /* note: ignoring second possible retval in $3, here */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
87 l.d $f0, 144($sp) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
88 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
89 /* Epilog. Tear down frame and return. */ |
138
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
90 ld $ra, 152($sp) /* restore return address */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
91 daddiu $sp, $sp, 160 /* close frame */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
92 j $ra /* return */ |
1b0c02e827c4
mips n64 fixes for platforms using hiword of addresses
cslag
parents:
124
diff
changeset
|
93 nop /* branch delay nop */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
94 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
95 .set reorder |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
96 .end dcCallbackThunkEntry |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
97 .ident "handwritten" |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
116
diff
changeset
|
98 |