You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first swap context sets stack pointer to sp[-4] (using the sp defined in initialize_call_frame), and then returns into bootstrap_green_task. that function then puts fptr from R14 into sp[-2], returns again into bootstrap_green_task which is at sp[-3]. the copies from r12, r13, and r14 run again, harmlessly, and then finally it returns into fptr.
I believe the only necessary correction is to change mov %r14, 8(%rsp) to mov %r14, (%rsp) in bootstrap_green_task. The assignment of sp[-3] to bootstrap_green_task in initialize_call_frame can then be eliminated as well.
Alternately, you can not put fptr in regs.gpr[r14] at all, and put it directly into sp[-3], and then eliminate the mov %r14 from the bootstrap entirely.
However, it is also possible I have no idea what I'm talking about, because I've only learned Intel assembly programming very recently.
The text was updated successfully, but these errors were encountered:
You are right. The trampoline may run twice. When I was developing this project, I found that debug and release versions have different stack layout that generated by the compiler. we need to make sure on both versions that we can trap into bootstrap_green_task.
But this version is not as sophisticated as the libfringe version. In next release I will switch to the libfringe branch. It's much faster than the method currently used in master branch. please ref #4.
Hi - I was single-stepping through this code to make sure I understood how it worked, and I discovered that, at least on the x64 unix code (https://github.com/Xudong-Huang/generator-rs/blob/master/src/detail/x86_64_unix.rs), the trampoline ends up running twice.
The first swap context sets stack pointer to sp[-4] (using the sp defined in
initialize_call_frame
), and then returns intobootstrap_green_task
. that function then putsfptr
from R14 into sp[-2], returns again intobootstrap_green_task
which is at sp[-3]. the copies from r12, r13, and r14 run again, harmlessly, and then finally it returns into fptr.I believe the only necessary correction is to change
mov %r14, 8(%rsp)
tomov %r14, (%rsp)
inbootstrap_green_task
. The assignment of sp[-3] to bootstrap_green_task ininitialize_call_frame
can then be eliminated as well.Alternately, you can not put fptr in regs.gpr[r14] at all, and put it directly into sp[-3], and then eliminate the mov %r14 from the bootstrap entirely.
However, it is also possible I have no idea what I'm talking about, because I've only learned Intel assembly programming very recently.
The text was updated successfully, but these errors were encountered: