Mercurial > pub > dyncall > dyncall
comparison 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 |
comparison
equal
deleted
inserted
replaced
301:74948b02cfa0 | 302:d55f9d508074 |
---|---|
1 /* | |
2 | |
3 Package: dyncall | |
4 Library: dyncallback | |
5 File: dyncallback/dyncall_callback_mips_n64.S | |
6 Description: Callback Thunk - Implementation for mips64 n64 | |
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 | |
25 /* input: | |
26 $t8 -> thunk | |
27 $t8+56 -> cb handler | |
28 $t8+64 -> userdata | |
29 */ | |
30 | |
31 .section .mdebug.abi64 | |
32 .previous | |
33 .abicalls | |
34 .text | |
35 .align 2 | |
36 .globl dcCallbackThunkEntry | |
37 .ent dcCallbackThunkEntry | |
38 dcCallbackThunkEntry: | |
39 .set noreorder | |
40 | |
41 /* Prolog. */ | |
42 /* Frame size of 160b comes from following: */ | |
43 /* DCargs(fregs:64 + iregs:64 + regcounts:8 + stackptr:8) + retval:8 + ra:8 */ | |
44 daddiu $sp, $sp, -160 /* open frame */ | |
45 sd $ra, 152($sp) /* save link register */ | |
46 | |
47 .frame $fp,160,$31 /* specify our frame: fp,size,lr; creates virt $fp */ | |
48 /* code below doesn't use $fp though, as n/a with -O1 */ | |
49 /* Init return value */ | |
50 sd $zero, 144($sp) | |
51 | |
52 /* Store float and int args where our DCargs member arrays are, in local area. */ | |
53 sd $4, 0($sp) | |
54 sd $5, 8($sp) | |
55 sd $6, 16($sp) | |
56 sd $7, 24($sp) | |
57 sd $8, 32($sp) | |
58 sd $9, 40($sp) | |
59 sd $10, 48($sp) | |
60 sd $11, 56($sp) | |
61 s.d $f12, 64($sp) | |
62 s.d $f13, 72($sp) | |
63 s.d $f14, 80($sp) | |
64 s.d $f15, 88($sp) | |
65 s.d $f16, 96($sp) | |
66 s.d $f17, 104($sp) | |
67 s.d $f18, 112($sp) | |
68 s.d $f19, 120($sp) | |
69 | |
70 /* Init DCarg's reg_counts and stackptr. */ | |
71 sd $zero, 128($sp) /* reg_count */ | |
72 daddiu $4, $sp, 160 | |
73 sd $4, 136($sp) /* stackptr */ | |
74 | |
75 /* Prepare callback handler call. */ | |
76 move $4, $24 /* Param 0 = DCCallback*, $24 ($t8) holds pointer to thunk */ | |
77 move $5, $sp /* Param 1 = DCArgs*, pointer to where pointer to args is stored */ | |
78 daddiu $6, $sp, 144 /* Param 2 = results pointer to 8b of local data on stack */ | |
79 ld $7, 64($24) /* Param 3 = userdata pointer */ | |
80 | |
81 ld $25, 56($24) /* store handler entry in $25 ($t9), required for PIC */ | |
82 jalr $25 /* jump */ | |
83 nop /* branch delay nop */ | |
84 | |
85 /* Copy result in corresponding registers $2-$3 ($v0-$v1) and $f0 */ | |
86 ld $2, 144($sp) /* note: ignoring second possible retval in $3, here */ | |
87 l.d $f0, 144($sp) | |
88 | |
89 /* Epilog. Tear down frame and return. */ | |
90 ld $ra, 152($sp) /* restore return address */ | |
91 daddiu $sp, $sp, 160 /* close frame */ | |
92 j $ra /* return */ | |
93 nop /* branch delay nop */ | |
94 | |
95 .set reorder | |
96 .end dcCallbackThunkEntry | |
97 .ident "handwritten" | |
98 |