X86和X86-64的函数栈帧结构以及调用约定

写在前头

对于函数栈帧(stack frame)的概念我是早就知道的,对x86的栈帧结构也算的上熟悉,之所以写这篇文章是因为我发现X64平台函数参数传递与X86有很大不同,X64增加了很多寄存器的使用。索性总结一下,供自己以后查阅学习!如有错误的地方,还请读者指出!

写这篇文章主要参考了Eli Bendersky的两篇文章,个人非常喜欢他的文章,总能用探索式的博文将技术细节呈现在我的眼前!

x86函数栈帧结构

 

x64函数栈帧结构

 

参考链接:

《Where the top of the stack is on x86》

《Stack frame layout on x86-64》(中文翻译)

《System V ABI》

《X86-64寄存器和栈帧》

《栈帧 Stack Frame》

《Intel x86 Function-call Conventions - Assembly View》

《Journey to the Stack》

《Calling Conventions》

《深入浅出GNU X86-64 汇编》

《X86-64寄存器和栈帧》

《x86-64 下函数调用及栈帧原理》

《How does one backtrace up the stack when frame pointers are omitted?》

你可能感兴趣的:(汇编语言,C语言基础,程序调试)