push %ebp
push %esp, %ebp
push edi
push esi
push ebx
Run Code Online (Sandbox Code Playgroud)
(x86 32位Linux)
为什么这些寄存器被推入堆栈?
迁移出于某种原因......?
但是,为什么只有'edi''esi''ebx'被推?
它是x86代码生成器的gcc实现细节.令人惊讶的是很难找到好的文档,我确实发现这个页面非常准确.关键部分:
退回指令后:
Run Code Online (Sandbox Code Playgroud)%eip contains return address %esp points at arguments pushed by caller called function may have trashed arguments %eax contains return value (or trash if function is void) %ecx, %edx may be trashed %ebp, %ebx, %esi, %edi must contain contents from time of call
"必须包含来自通话时的内容"这个短语解释了为什么他们被推入功能序言并在结语中再次弹出.