Thanks for this.<p>There is a really good blog post to understand coroutines from an assembly perspective here:
<a href="https://blog.dziban.net/coroutines/" rel="nofollow">https://blog.dziban.net/coroutines/</a><p>I ported the intel assembly syntax in that blog post to at&t syntax and assembled it with GNU Assembler
<a href="https://github.com/samsquire/assembly">https://github.com/samsquire/assembly</a> as coroutines.S<p>there is also protothreads and Tina
<a href="http://dunkels.com/adam/pt/" rel="nofollow">http://dunkels.com/adam/pt/</a>
<a href="https://github.com/slembcke/Tina">https://github.com/slembcke/Tina</a>
Should be saving rdi + 0x0020 on windows to save the current fiber storage pointer on jump.<p>Certain win32 api calls actually use fibers deep down even if you don't use them. You will get a crash after bouncing around.
I vaguely remember(or think) schannel is one such set of win32 functions that'll cause it.
<i>The name is Japanese word bunki (分岐) which means to branch off. I consider the name quite fitting for a coroutine library just google image (分岐) and you will see what I mean.</i><p>Good name! That's very nice.
How does it compare with <a href="https://github.com/edubart/minicoro">https://github.com/edubart/minicoro</a> ?
Don't use stackful coroutines. Compilers don't understand it and you will sooner or later get miscompilations or bugs, particularly if your code uses thread-local storage (which doesn't take a lot of effort, for example "errno" is a thread-local variable).