File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ yafl_switch:
7777 movl 0x14 (%esp ), %ebx /* restore EBX */
7878 movl 0x18 (%esp ), %ebp /* restore EBP */
7979
80- leal 0x24 (%esp ), %esp /* prepare stack */
80+ leal 0x20 (%esp ), %esp /* prepare stack for direct data return */
8181
8282 /* return and pass data directly */
8383 movl %edx , %eax
Original file line number Diff line number Diff line change @@ -79,11 +79,11 @@ yafl_switch:
7979 s.d $f31, 56 ($sp) # save F31
8080#endif
8181
82- # store SP (pointing to old context-data) in v0 as return
83- move $v0, $sp
82+ # save current context through the first argument pointer
83+ sd $sp, 0 ($a0)
8484
85- # get SP (pointing to new context-data) from a0 param
86- move $sp, $a0
85+ # restore target context from the second argument
86+ move $sp, $a1
8787
8888#if defined(__mips_hard_float)
8989 l.d $f24, 0 ($sp) # restore F24
@@ -113,8 +113,9 @@ yafl_switch:
113113 # adjust stack
114114 daddiu $sp, $sp, 160
115115
116- move $a0, $v0 # move old sp from v0 to a0 as param
117- move $v1, $a1 # move *data from a1 to v1 as return
116+ # return and pass data directly
117+ move $v0, $a2
118+ move $a0, $a2
118119
119120 # jump to context
120121 jr $t9
You can’t perform that action at this time.
0 commit comments