libco icon indicating copy to clipboard operation
libco copied to clipboard

coctx_swap 最后的 xorl %eax, %eax 用意何在 ?

Open prettykernel opened this issue 7 years ago • 3 comments

32 位 和 64 位的实现最后都把 eax 清 0,这是为了符合什么规范吗 ?

prettykernel avatar Aug 30 '17 07:08 prettykernel

eax中的值(0)作为函数返回值给调用者

inter169 avatar Aug 31 '17 01:08 inter169

这个函数的原型是; extern "C" { extern void coctx_swap( coctx_t ,coctx_t ) asm("coctx_swap"); }; 返回值不是void么?

prettykernel avatar Aug 31 '17 04:08 prettykernel

32位不知道,64位兼容32位,eax实际是rax的低32位,为了清零低32位,数据对齐。

hammersmith-xie avatar Jun 22 '18 12:06 hammersmith-xie