comparison dyncallback/dyncall_callback_mips_eabi_gas.s @ 110:9aa75a74614c

- working mips32 eabi callbacks - mips32 eabi doc update - switched some mips32 eabi call assembly to use more portable pseudo instructions for storing floats - fixed weird type use of var declaration in mips callbacks - ToDo update - converted some // comments to old c-style - test code build fix for some test suites on some platforms
author cslag
date Sat, 18 Jun 2016 19:38:22 +0200
parents 1ce60358fbad
children 9e4f1355a388
comparison
equal deleted inserted replaced
109:9e677d4c0b6b 110:9aa75a74614c
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 22
23 */ 23 */
24 24
25 .text 25 /* input:
26 .globl dcCallbackThunkEntry 26 $t4 -> thunk
27 $t4+20 -> cb handler
28 $t4+24 -> userdata
29 */
30
31 .text
32 .globl dcCallbackThunkEntry
33 .ent dcCallbackThunkEntry
34
35 /* Called by thunk - thunk stores pointer to DCCallback in $12 ($t4), and */
36 /* pointer to called function in $25 ($t9, required for PIC) */
27 dcCallbackThunkEntry: 37 dcCallbackThunkEntry:
38 .set noreorder
28 39
40 /* Prolog. */
41 /* Frame size of 88b comes from following: */
42 /* DCargs(fregs:32 + iregs:32 + regcounts:4 + stackptr:4) + retval:8 + ra:4 (+ pad:4) */
43 subu $sp, 88 /* open frame */
44 sw $ra, 84($sp) /* save link register */
45
46 .frame $fp,88,$31 /* specify our frame: fp,size,lr; creates virt $fp */
47 /* code below doesn't use $fp though, as n/a with -O1 */
48 /* Init return value */
49 sw $zero, 72($sp)
50 sw $zero, 76($sp)
51
52 /* Store float and int args where our DCargs member arrays are, in local area. */
53 sw $4, 0($sp)
54 sw $5, 4($sp)
55 sw $6, 8($sp)
56 sw $7, 12($sp)
57 sw $8, 16($sp)
58 sw $9, 20($sp)
59 sw $10, 24($sp)
60 sw $11, 28($sp)
61 s.s $f12, 32($sp)
62 s.s $f13, 36($sp)
63 s.s $f14, 40($sp)
64 s.s $f15, 44($sp)
65 s.s $f16, 48($sp)
66 s.s $f17, 52($sp)
67 s.s $f18, 56($sp)
68 s.s $f19, 60($sp)
69
70 /* Init DCarg's reg_counts and stackptr. */
71 sw $zero, 64($sp) /* reg_count */
72 addiu $4, $sp, 88
73 sw $4, 68($sp) /* stackptr */
74
75 /* Prepare callback handler call. */
76 move $4, $12 /* Param 0 = DCCallback*, $12 ($t4) holds pointer to thunk */
77 move $5, $sp /* Param 1 = DCArgs*, pointer to where pointer to args is stored */
78 addiu $6, $sp, 72 /* Param 2 = results pointer to 8b of local data on stack */
79 lw $7, 24($12) /* Param 3 = userdata pointer */
80
81 lw $25, 20($12) /* 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 lw $2, 72($sp)
87 lw $3, 76($sp)
88 l.d $f0, 72($sp)
89
90 /* Epilog. Tear down frame and return. */
91 lw $ra, 84($sp) /* restore return address */
92 addiu $sp, $sp, 88 /* close frame */
93 j $ra /* return */
94 nop /* branch delay nop */
95
96 .set reorder
97 .end dcCallbackThunkEntry
98 .ident "handwritten"
99