#186·libco

【BUG Report】__i386__场景下协程共享栈存在问题

作者: yulesyu创建于 2022年1月23日更新于 2023年10月9日

The latest version submitted at 2019/10/21 18:59:06 has a problem. SHA-1: 18ee765817ae61acc4e1751d91d51ce4768ab3c1 * Replace coctx_swap with Mov version The version modifies the coctx_swap assembly function. In the previous version, regs[0] retains the return address ret, and regs[7] retains the address pointer of esp+4. However, after this version, regs[0] no longer retains the return address, and regs[7] retains the esp address pointing to the stack where the return address is stored. Not retaining the return address causes the following problem in the coctx_swap assembly function for switching contexts in shared stack mode: regs[7] restores esp, but at this time, the return address pointed to by esp on the shared stack may be overwritten by the previous context, so it cannot be correctly jumped to the target context.