__asm__(
"mov %%rsp, 0(%%rcx);" // save stack
"mov %%rcx, %%rsp;" // switch stack
"callq %%rax;" // run coroutine
"pop %%rsp;" // recovery rsp
"callq %%rbx;" // coroutine_exit()
""::"a"(ready_coroutine->fun), "c"(ready_coroutine->esp3 - 8), "d"(current_coroutine), "b"(coroutine_exit):"memory"
);
I'm learning coroutine and try to implement it. this code was try to switch stack and run a function. I'm confused to this code can run in ubuntu18.04, but not in ubuntu 22.04.
it run success when only switch stack or only call function, but failed when both switch stack and call function