Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coctx_swap函数:leaq 8(%rsp), %rsp #174

Open
ToBeNiu opened this issue Apr 18, 2021 · 0 comments
Open

coctx_swap函数:leaq 8(%rsp), %rsp #174

ToBeNiu opened this issue Apr 18, 2021 · 0 comments

Comments

@ToBeNiu
Copy link

ToBeNiu commented Apr 18, 2021

leaq 8(%rsp), %rsp
pushq 72(%rsi)

movq 64(%rsi), %rsi
ret

如果调入协程是新协程,上述代码会切换到新协程,并且使rsp指向ctx->ss_sp + ctx->ss_size,充分利用协程栈空间;
如果调入协程不是新协程,是个已经执行过的协程,本次只是重新调入而已,那么上述代码(leaq 8(%rsp), %rsp)是不是破坏了栈的完整性?是不是覆盖了rsp原有的数据??

希望有空解释下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant