通过 linux x86-64 函数调用保留了哪些寄存器 [英] What registers are preserved through a linux x86-64 function call

查看:32
本文介绍了通过 linux x86-64 函数调用保留了哪些寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我了解 linux x86-64 ABI 如何使用寄存器和堆栈将参数传递给函数(参见 之前的 ABI 讨论).我感到困惑的是,如果/哪些寄存器应该在函数调用中保留.也就是说,哪些寄存器可以保证不被破坏?

I believe I understand how the linux x86-64 ABI uses registers and stack to pass parameters to a function (cf. previous ABI discussion). What I'm confused about is if/what registers are expected to be preserved across a function call. That is, what registers are guarenteed not to get clobbered?

推荐答案

这里是完整的寄存器表及其使用文档 [PDF 链接]:

Here's the complete table of registers and their use from the documentation [PDF Link]:

r12r13r14r15rbxrsprbp 是被调用者保存的寄存器 - 它们在跨函数调用保留"列中有一个是".

r12, r13, r14, r15, rbx, rsp, rbp are the callee-saved registers - they have a "Yes" in the "Preserved across function calls" column.

这篇关于通过 linux x86-64 函数调用保留了哪些寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆