comparison dyncallback/dyncall_callback_mips_o32_gas.s @ 106:d595eb90efdd

- dyncallback/mips_o32 fixes for when using -O? optimization flags; basically not using $fp directly, anymore
author cslag
date Sat, 11 Jun 2016 13:07:23 +0200
parents dbca6763f2be
children f5453308ff36
comparison
equal deleted inserted replaced
105:ca36937b4613 106:d595eb90efdd
50 /* param: spill:16 */ 50 /* param: spill:16 */
51 subu $sp, 56 /* open frame */ 51 subu $sp, 56 /* open frame */
52 sw $ra, 20($sp) /* save link register */ 52 sw $ra, 20($sp) /* save link register */
53 53
54 .frame $fp,56,$31 /* specify our frame: fp,size,lr; creates virt $fp */ 54 .frame $fp,56,$31 /* specify our frame: fp,size,lr; creates virt $fp */
55 55 /* code below doesn't use $fp though, as n/a with -O1 */
56 /* Init return value */ 56 /* Init return value */
57 sw $zero, 32($sp) 57 sw $zero, 32($sp)
58 sw $zero, 36($sp) 58 sw $zero, 36($sp)
59 59
60 /* Store the arguments passed via registers somewhere for dcArg* to access. */ 60 /* Store the arguments passed via registers somewhere for dcArg* to access. */
61 /* For $4-$7 ($a0-$a3), use dedicated spill area (caller doesn't spill, but */ 61 /* For $4-$7 ($a0-$a3), use dedicated spill area (caller doesn't spill, but */
62 /* provides it at end of _caller's_ frame, so $fp points right to it). */ 62 /* provides it at end of _caller's_ frame, so $fp points right to it). */
63 /* For $f12 and $f14 use our space (in local data), which is adjacent. */ 63 /* For $f12 and $f14 use our space (in local data), which is adjacent. */
64 s.d $f12, 40($sp) /* -16($fp) */ 64 s.d $f12, 40($sp) /* -16($fp) */
65 s.d $f14, 48($sp) /* -8($fp) */ 65 s.d $f14, 48($sp) /* -8($fp) */
66 sw $4, 0($fp) 66 sw $4, 56($sp) /* 0($fp) */
67 sw $5, 4($fp) 67 sw $5, 60($sp) /* 4($fp) */
68 sw $6, 8($fp) 68 sw $6, 64($sp) /* 8($fp) */
69 sw $7, 12($fp) 69 sw $7, 68($sp) /* 12($fp) */
70 70
71 /* Init DCArg, which contains reg_count and stackptr* to the args. Point */ 71 /* Init DCArg, which contains reg_count and stackptr* to the args. Point */
72 /* stackptr to the area where the non-float args start (which is at $fp). */ 72 /* stackptr to the area where the non-float args start (which is at $fp). */
73 addiu $4, $sp, 56 /* non-$fp replacement for: */
74 sw $4, 28($sp) /* sw $fp, 28($sp) */
73 sw $zero, 24($sp) 75 sw $zero, 24($sp)
74 sw $fp, 28($sp)
75 76
76 /* Prepare callback handler call. */ 77 /* Prepare callback handler call. */
77 move $4, $12 /* Param 0 = DCCallback*, $12 ($t4) holds pointer to thunk */ 78 move $4, $12 /* Param 0 = DCCallback*, $12 ($t4) holds pointer to thunk */
78 addiu $5, $sp, 24 /* Param 1 = DCArgs*, pointer to where pointer to args is stored */ 79 addiu $5, $sp, 24 /* Param 1 = DCArgs*, pointer to where pointer to args is stored */
79 addiu $6, $sp, 32 /* Param 2 = results pointer to 8b of local data on stack */ 80 addiu $6, $sp, 32 /* Param 2 = results pointer to 8b of local data on stack */